[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] Don't list capabilities entries if emulators can't be accessed



The patch below fixes capabilities xml generation for
the qemu driver if the emulators aren't found in the
hardcoded paths. Current behavior will add a <guest>
entry for the emulator even if it does not exist, patch
fixes this to check that we actually have access.

This brings up another issue, that hardcoded paths
aren't exactly distro friendly. I'm not really familiar
with what options we have to allow specifying these
at build time (or something else). Anyone have an
idea?

Thanks,
Cole
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
index dc9e42a..0328cc1 100644
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -230,6 +230,10 @@ qemudCapsInitGuest(virCapsPtr caps,
     virCapsGuestPtr guest;
     int i;
 
+    /* Check for existance of base emulator */
+    if (access(info->binary, X_OK) == -1)
+        return 0;
+
     if ((guest = virCapabilitiesAddGuest(caps,
                                          hvm ? "hvm" : "xen",
                                          info->arch,
@@ -241,9 +245,7 @@ qemudCapsInitGuest(virCapsPtr caps,
         return -1;
 
     if (hvm) {
-        /* Check for existance of base emulator */
-        if (access(info->binary, X_OK) == 0 &&
-            virCapabilitiesAddGuestDomain(guest,
+        if (virCapabilitiesAddGuestDomain(guest,
                                           "qemu",
                                           NULL,
                                           NULL,
@@ -263,6 +265,7 @@ qemudCapsInitGuest(virCapsPtr caps,
                 return -1;
 
             if (access("/dev/kvm", F_OK) == 0 &&
+                access("/usr/bin/qemu-kvm", X_OK) == 0 &&
                 virCapabilitiesAddGuestDomain(guest,
                                               "kvm",
                                               "/usr/bin/qemu-kvm",

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]