[libvirt] [PATCH 08/11] qemu: Simplify QEMU binary search

Ján Tomko jtomko at redhat.com
Fri Oct 5 14:43:37 UTC 2018


On Thu, Sep 20, 2018 at 05:25:26PM +0200, Andrea Bolognani wrote:
>Now that we have reduced the number of sensible options down
>to either the native QEMU binary or RHEL's qemu-kvm, we can
>make virQEMUCapsInitGuest() a bit simpler.
>
>Signed-off-by: Andrea Bolognani <abologna at redhat.com>
>---
> src/qemu/qemu_capabilities.c | 29 +++++++----------------------
> 1 file changed, 7 insertions(+), 22 deletions(-)
>
>diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
>index fd8badc60b..72fa19a2b7 100644
>--- a/src/qemu/qemu_capabilities.c
>+++ b/src/qemu/qemu_capabilities.c
>@@ -746,7 +746,6 @@ virQEMUCapsInitGuest(virCapsPtr caps,
>                      virArch hostarch,
>                      virArch guestarch)
> {
>-    size_t i;
>     char *binary = NULL;
>     virQEMUCapsPtr qemubinCaps = NULL;
>     int ret = -1;
>@@ -756,6 +755,13 @@ virQEMUCapsInitGuest(virCapsPtr caps,
>      */
>     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 */

This does not look like something upstream libvirt should worry about.

Jano

>+    if (virQEMUCapsGuestIsNative(hostarch, guestarch) && !binary) {
>+        if (VIR_STRDUP(binary, "/usr/libexec/qemu-kvm") < 0)
>+            return -1;
>+    }
>+
>     /* Ignore binary if extracting version info fails */
>     if (binary) {
>         if (!(qemubinCaps = virQEMUCapsCacheLookup(cache, binary))) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20181005/cc10b8a9/attachment-0001.sig>


More information about the libvir-list mailing list