commit:     1d5cfbbf84ca69ab68caf979f2f3c03b037695c7
Author:     Michal Privoznik <michal.privoznik <AT> gmail <DOT> com>
AuthorDate: Wed Nov  6 20:27:22 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 26 15:25:32 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1d5cfbbf

app-emulation/qemu-guest-agent: Check for VIRTIO_CONSOLE kernel config

To control guests from inside qemu-guest-agent is used. By
default, it listens on a virtio-serial device
(/dev/virtio-ports/org.qemu.guest_agent.0, see [1]) which is available iff
CONFIG_VIRTIO_CONSOLE kernel config is enabled. Due to a bug in
qemu-guest-agent where it daemonizes itself before opening the
device, init scripts are unable to tell whether startup was
successful. Check for the kernel config knob and hope that users
will notice it while emerging the package. There is a fix for the
bug [2] but it's contained in 10.0.0 release.

1: 
https://gitlab.com/qemu-project/qemu/-/blob/88f72048d2f5835a1b9eaba690c7861393aef283/qga/main.c#L46
2: 
https://gitlab.com/qemu-project/qemu/-/commit/c6f5dd7ac8ef62dcdec4cdeda1467c658161afff
Closes: https://bugs.gentoo.org/810628
Signed-off-by: Michal Privoznik <michal.privoznik <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/43567
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild | 9 ++++++++-
 app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild | 9 ++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild 
b/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild
index 066994a80738..a4e4b3ee8fe2 100644
--- a/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild
+++ b/app-emulation/qemu-guest-agent/qemu-guest-agent-8.2.0.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..13} )
 PYTHON_REQ_USE="ensurepip(-),ncurses,readline"
 
-inherit edo systemd toolchain-funcs python-any-r1 udev
+inherit edo linux-info python-any-r1 systemd toolchain-funcs udev
 
 MY_PN="qemu"
 MY_P="${MY_PN}-${PV}"
@@ -39,6 +39,13 @@ python_check_deps() {
        python_has_version "dev-python/distlib[${PYTHON_USEDEP}]"
 }
 
+pkg_setup() {
+       # While qemu-ga supports multiple modes, virtio-serial is the
+       # default. Make sure it's enabled in kernel.
+       CONFIG_CHECK="~VIRTIO_CONSOLE"
+       linux-info_pkg_setup
+}
+
 src_configure() {
        tc-export AR LD OBJCOPY RANLIB
 

diff --git a/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild 
b/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild
index 066994a80738..a4e4b3ee8fe2 100644
--- a/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild
+++ b/app-emulation/qemu-guest-agent/qemu-guest-agent-9.2.0.ebuild
@@ -6,7 +6,7 @@ EAPI=8
 PYTHON_COMPAT=( python3_{10..13} )
 PYTHON_REQ_USE="ensurepip(-),ncurses,readline"
 
-inherit edo systemd toolchain-funcs python-any-r1 udev
+inherit edo linux-info python-any-r1 systemd toolchain-funcs udev
 
 MY_PN="qemu"
 MY_P="${MY_PN}-${PV}"
@@ -39,6 +39,13 @@ python_check_deps() {
        python_has_version "dev-python/distlib[${PYTHON_USEDEP}]"
 }
 
+pkg_setup() {
+       # While qemu-ga supports multiple modes, virtio-serial is the
+       # default. Make sure it's enabled in kernel.
+       CONFIG_CHECK="~VIRTIO_CONSOLE"
+       linux-info_pkg_setup
+}
+
 src_configure() {
        tc-export AR LD OBJCOPY RANLIB
 

Reply via email to