]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Ignore unusable binaries
authorJiri Denemark <jdenemar@redhat.com>
Mon, 4 Apr 2011 13:01:22 +0000 (15:01 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 5 Apr 2011 12:02:55 +0000 (14:02 +0200)
When initializing qemu guest capabilities, we should ignore qemu
binaries that we are not able to extract version/help info from since
they will be unusable for creating domains anyway. Ignoring them is also
much better than letting initialization of qemu driver fail.

src/qemu/qemu_capabilities.c

index f86e7f5efbacaffed9d24fbce00af2dbcb8825a0..63486cce782ca548ab143b15a1d8d9cf3058bd6a 100644 (file)
@@ -490,6 +490,12 @@ qemuCapsInitGuest(virCapsPtr caps,
     if (!binary)
         return 0;
 
+    /* Ignore binary if extracting version info fails */
+    if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0) {
+        ret = 0;
+        goto cleanup;
+    }
+
     if (stat(binary, &st) == 0) {
         binary_mtime = st.st_mtime;
     } else {
@@ -554,9 +560,8 @@ qemuCapsInitGuest(virCapsPtr caps,
         !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
         goto error;
 
-    if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0 ||
-        (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
-         !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0)))
+    if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
+        !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0))
         goto error;
 
     if (hvm) {