From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id C3452158090 for ; Sun, 15 May 2022 15:53:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DB519E0207; Sun, 15 May 2022 15:53:19 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B9B3CE0207 for ; Sun, 15 May 2022 15:53:19 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8939E341C84 for ; Sun, 15 May 2022 15:53:18 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8FDD93AA for ; Sun, 15 May 2022 15:53:11 +0000 (UTC) From: "Aisha Tammy" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Aisha Tammy" Message-ID: <1652629982.5c1c154ef90eb1815542cbcbc38f05f54a8d5820.epsilon-0@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: sys-apps/qemu-openrc/files/, sys-apps/qemu-openrc/ X-VCS-Repository: repo/proj/guru X-VCS-Files: sys-apps/qemu-openrc/Manifest sys-apps/qemu-openrc/files/qemu-openrc-0.10.0-guest-agent.patch sys-apps/qemu-openrc/metadata.xml sys-apps/qemu-openrc/qemu-openrc-0.10.0.ebuild sys-apps/qemu-openrc/qemu-openrc-9999.ebuild X-VCS-Directories: sys-apps/qemu-openrc/ sys-apps/qemu-openrc/files/ X-VCS-Committer: epsilon-0 X-VCS-Committer-Name: Aisha Tammy X-VCS-Revision: 5c1c154ef90eb1815542cbcbc38f05f54a8d5820 X-VCS-Branch: dev Date: Sun, 15 May 2022 15:53:11 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 806280cc-69bf-44f3-9bbe-5144d2c63c72 X-Archives-Hash: 7d348df26edd267cb1730a6678c13fa3 commit: 5c1c154ef90eb1815542cbcbc38f05f54a8d5820 Author: Aisha Tammy aisha cc> AuthorDate: Sun May 15 15:52:52 2022 +0000 Commit: Aisha Tammy aisha cc> CommitDate: Sun May 15 15:53:02 2022 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5c1c154e sys-apps/qemu-openrc: initial import Signed-off-by: Aisha Tammy aisha.cc> sys-apps/qemu-openrc/Manifest | 1 + .../files/qemu-openrc-0.10.0-guest-agent.patch | 87 ++++++++++++++++++++++ sys-apps/qemu-openrc/metadata.xml | 8 ++ sys-apps/qemu-openrc/qemu-openrc-0.10.0.ebuild | 32 ++++++++ sys-apps/qemu-openrc/qemu-openrc-9999.ebuild | 32 ++++++++ 5 files changed, 160 insertions(+) diff --git a/sys-apps/qemu-openrc/Manifest b/sys-apps/qemu-openrc/Manifest new file mode 100644 index 000000000..e8dc7b35a --- /dev/null +++ b/sys-apps/qemu-openrc/Manifest @@ -0,0 +1 @@ +DIST qemu-openrc-0.10.0.tar.gz 8367 BLAKE2B 34447e04c1a81fa13bddf2f4a742059beea6eeb0025ec32219ef3718a0ff62b98a3d0c39083068f52362eb6fe3eb105338febdd36ea696f144a6b2ce583b3441 SHA512 cdcf51dc59dbca96102c1b73032a726a44cb62c0c93a42adb9b6806609a0fa24bf8dde4814ed5010de63d54fde75f661bb9f5245d85e28de08cdba08d538c959 diff --git a/sys-apps/qemu-openrc/files/qemu-openrc-0.10.0-guest-agent.patch b/sys-apps/qemu-openrc/files/qemu-openrc-0.10.0-guest-agent.patch new file mode 100644 index 000000000..e030870b4 --- /dev/null +++ b/sys-apps/qemu-openrc/files/qemu-openrc-0.10.0-guest-agent.patch @@ -0,0 +1,87 @@ +From 6928925968faf8c8c07e6e955b6864e11f614f77 Mon Sep 17 00:00:00 2001 +From: Aisha Tammy +Date: Mon, 24 Jan 2022 13:50:37 +0000 +Subject: [PATCH] allow shutdown via guest agent socket + +This allows shutdown events to be sent +via qemu guest agent, which works for +BSD agents which don't handle ACPI events +correctly. + +Tested with OpenBSD 7.0. + +Signed-off-by: Aisha Tammy +--- + qemu.initd | 31 +++++++++++++++++++++++++++---- + 1 file changed, 27 insertions(+), 4 deletions(-) + +diff --git a/qemu.initd b/qemu.initd +index a80d291..8756080 100644 +--- a/qemu.initd ++++ b/qemu.initd +@@ -25,6 +25,7 @@ VM_NAME="${RC_SVCNAME#qemu.}" + : ${vnc_listen:=0.0.0.0} + : ${hugepages_path:=/dev/hugepages} + : ${monitor_socket:=/run/qemu/${VM_NAME}/monitor.sock} ++: ${guest_agent_socket:=/run/qemu/${VM_NAME}/ga.sock} + : ${extra_args:=} + + name="VM $VM_NAME" +@@ -53,7 +54,9 @@ command_args=" + -vga $vga + -device virtio-rng-pci + -device virtio-scsi-pci,id=scsi +- -monitor unix:$monitor_socket,server,nowait" ++ -monitor unix:$monitor_socket,server,nowait ++ -chardev socket,path=$guest_agent_socket,server,nowait,id=qga0 ++ -device isa-serial,chardev=qga0" + command_background='yes' + + start_stop_daemon_args=" +@@ -125,10 +128,22 @@ stop() { + + ebegin "Stopping $name" + ++ if is_running && qemush "${guest_agent_socket}" "{'execute': 'guest-exec', 'arguments': {'path': '/sbin/halt', 'arg': ['-p']}}"; then ++ count="$shutdown_timeout" ++ ++ printf " Waiting $count seconds for VM shutdown via guest agent " ++ while is_running && [ $count -gt 0 ]; do ++ sleep 1 ++ printf '.' ++ count=$(( count - 1 )) ++ done ++ printf '\n' ++ fi ++ + if is_running && qemush 'system_powerdown'; then + count="$shutdown_timeout" + +- printf " Waiting $count seconds for VM shutdown " ++ printf " Waiting $count seconds for VM shutdown via ACPI" + while is_running && [ $count -gt 0 ]; do + sleep 1 + printf '.' +@@ -281,12 +296,20 @@ check_bridge() { + + qemush() { + local IFS=$'\n' +- printf "%b\n" "$*" | socat - "UNIX-CONNECT:${monitor_socket}" 1>/dev/null ++ socket_path="${monitor_socket}" ++ case "$1" in ++ /*) socket_path="$1"; shift; ++ esac ++ printf "%b\n" "$*" | socat - "UNIX-CONNECT:${socket_path}" 1>/dev/null + } + + qemush_show() { + local IFS=$'\n' +- printf "%b\n" "$*" | socat - "UNIX-CONNECT:${monitor_socket}" | tail -n +3 | head -n -1 ++ socket_path="${monitor_socket}" ++ case "$1" in ++ /*) socket_path="$1"; shift; ++ esac ++ printf "%b\n" "$*" | socat - "UNIX-CONNECT:${socket_path}" | tail -n +3 | head -n -1 + } + + gen_macaddr() { diff --git a/sys-apps/qemu-openrc/metadata.xml b/sys-apps/qemu-openrc/metadata.xml new file mode 100644 index 000000000..65ac1f205 --- /dev/null +++ b/sys-apps/qemu-openrc/metadata.xml @@ -0,0 +1,8 @@ + + + + + gentoo@aisha.cc + Aisha Tammy + + diff --git a/sys-apps/qemu-openrc/qemu-openrc-0.10.0.ebuild b/sys-apps/qemu-openrc/qemu-openrc-0.10.0.ebuild new file mode 100644 index 000000000..9db2cfd8f --- /dev/null +++ b/sys-apps/qemu-openrc/qemu-openrc-0.10.0.ebuild @@ -0,0 +1,32 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="OpenRC init script for QEMU/KVM" +HOMEPAGE="https://github.com/jirutka/qemu-openrc" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/jirutka/qemu-openrc" +else + SRC_URI="https://github.com/jirutka/qemu-openrc/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64" +fi + +LICENSE="MIT" +SLOT="0" + +RDEPEND="net-misc/socat" + +PATCHES=( "${FILESDIR}/qemu-openrc-0.10.0-guest-agent.patch") + +src_compile() { + : +} + +src_install() { + newinitd qemu.initd qemu + newconfd qemu.confd qemu + dobin qemush +} diff --git a/sys-apps/qemu-openrc/qemu-openrc-9999.ebuild b/sys-apps/qemu-openrc/qemu-openrc-9999.ebuild new file mode 100644 index 000000000..9db2cfd8f --- /dev/null +++ b/sys-apps/qemu-openrc/qemu-openrc-9999.ebuild @@ -0,0 +1,32 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="OpenRC init script for QEMU/KVM" +HOMEPAGE="https://github.com/jirutka/qemu-openrc" + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/jirutka/qemu-openrc" +else + SRC_URI="https://github.com/jirutka/qemu-openrc/archive/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64" +fi + +LICENSE="MIT" +SLOT="0" + +RDEPEND="net-misc/socat" + +PATCHES=( "${FILESDIR}/qemu-openrc-0.10.0-guest-agent.patch") + +src_compile() { + : +} + +src_install() { + newinitd qemu.initd qemu + newconfd qemu.confd qemu + dobin qemush +}