On Mon, Mar 28, 2022 at 02:38:38PM -0600, Jim Fehlig wrote: > A downstream packaging bug resulted in a scenario where no aarch64 emulator > binary was installed on a kvm host. Querying capabilities on the host > succeeds and the capabilities correctly report that no <guest>'s are > supported, but the following error is logged > > libvirtd: Cannot check QEMU binary /usr/libexec/qemu-kvm: No such file or directory > > This error is confusing and not very helpful. Additionally, comments in the > associated code note that /usr/libexec/qemu-kvm is disto-specific, which > suggests the logic is better suited for a downstream patch. Removing the > check for /usr/libexec/qemu-kvm leaves virQEMUCapsGetDefaultEmulator() as > nothing more than a needless wrapper around virQEMUCapsFindBinaryForArch. > Drop virQEMUCapsGetDefaultEmulator() and call virQEMUCapsFindBinaryForArch() > directly in its place, which squelches the unhelpful error. I agree that the message being logged is not very useful, but I don't think the approach you take here is the correct one: we want upstream libvirt to work out of the box when built on a variety of distros, including RHEL and derivatives, and your patch breaks that. I think the diff you're looking for is more along the lines of the (completely untested) one below. You can then rename virQEMUCapsFindBinaryForArch() to virQEMUCapsGetDefaultEmulator() in a second patch to avoid leaving unnecessary wrappers around. diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 6b4ed08499..e35a89f944 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -945,6 +945,12 @@ virQEMUCapsFindBinaryForArch(virArch hostarch, return ret; } + if (virQEMUCapsGuestIsNative(hostarch, guestarch)) { + if ((ret = virFindFileInPath("/usr/libexec/qemu-kvm")) != NULL) { + return ret; + } + } + return ret; } @@ -953,18 +959,7 @@ char * virQEMUCapsGetDefaultEmulator(virArch hostarch, virArch guestarch) { - char *binary = NULL; - /* Check for existence of base emulator, or alternate base - * which can be used with magic cpu choice - */ - binary = virQEMUCapsFindBinaryForArch(hostarch, guestarch); - - /* RHEL doesn't follow the usual naming for QEMU binaries and ships - * a single binary named qemu-kvm outside of $PATH instead */ - if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary) - binary = g_strdup("/usr/libexec/qemu-kvm"); - - return binary; + return virQEMUCapsFindBinaryForArch(hostarch, guestarch); } -- Andrea Bolognani / Red Hat / Virtualization