From 4fd911b70cc5a70f853e37eb2c8d8bbe604ebf39 Mon Sep 17 00:00:00 2001 From: Anushree Mathur Date: Wed, 4 Nov 2026 16:39:28 +0530 Subject: [PATCH] avocado-setup: use the available QEMU emulator binary for guest tests The guest test configs hardcode /usr/bin/qemu-system-ppc64 for qemu_binary and emulator_path. RHEL 10 ships only /usr/libexec/qemu-kvm, so virt-install fails with: Cannot check QEMU binary /usr/bin/qemu-system-ppc64: No such file or directory Add helper.get_qemu_emulator(), which returns /usr/libexec/qemu-kvm when /usr/bin/qemu-system-ppc64 is missing and /usr/libexec/qemu-kvm exists, and the existing default otherwise. TestSuite.config() uses it to rewrite the emulator path in the copied backend cfg, leaving the user config files untouched. Signed-off-by: Anushree Mathur --- avocado-setup.py | 5 +++++ lib/helper.py | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/avocado-setup.py b/avocado-setup.py index 482c3bdf..a78cb1ac 100644 --- a/avocado-setup.py +++ b/avocado-setup.py @@ -114,6 +114,11 @@ def config(self): self.shortname) cmd = 'cp -f %s %s' % (local_cfg, cfg) os.system(cmd) + emulator = helper.get_qemu_emulator() + if emulator != '/usr/bin/qemu-system-ppc64': + cmd = "sed -i 's#/usr/bin/qemu-system-ppc64#%s#g' %s" % ( + emulator, cfg) + os.system(cmd) self.conf = cfg elif self.type == 'host': local_cfg = "%s/%s/%s.cfg" % (TEST_CONF_PATH, diff --git a/lib/helper.py b/lib/helper.py index 4e749ae3..9377d50b 100644 --- a/lib/helper.py +++ b/lib/helper.py @@ -231,6 +231,22 @@ def is_rhel8(): return False +def get_qemu_emulator(): + """ + Return the QEMU emulator binary to use for guest tests + + Older releases provide /usr/bin/qemu-system-ppc64, newer ones (RHEL 10 + and later) ship only /usr/libexec/qemu-kvm. + + :return: path of the emulator binary which exists on the host + """ + default = "/usr/bin/qemu-system-ppc64" + alternate = "/usr/libexec/qemu-kvm" + if not os.path.exists(default) and os.path.exists(alternate): + return alternate + return default + + def remove_file(src, dest): """ Remove Files from Destination Folder which is common in Source and Destination