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

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

 



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",
--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]