]> xenbits.xensource.com Git - libvirt.git/commitdiff
Only enforce check for YAJL when starting a VM
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 4 Jul 2012 09:44:58 +0000 (10:44 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 20 Jul 2012 19:31:46 +0000 (20:31 +0100)
The previous check for YAJL would have many undesirable
consequences, the most important being that it caused the
capabilities XML to lose all <guest> elements. There is
no user visible feedback as to what is wrong in this respect,
merely a syslog message. The empty capabilities causes
libvirtd to then throw away all guest XML configs that are
stored.

This changes the code so that the check for YAJL is only
performed at the time we attempt to spawn a QEMU process

error: Failed to start domain vm-vnc
error: unsupported configuration: this qemu binary requires libvirt to be compiled with yajl

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_capabilities.c
src/qemu/qemu_capabilities.h
src/qemu/qemu_command.c
src/qemu/qemu_driver.c
src/qemu/qemu_process.c

index 7861beefc4b4d186376541cd3847e08adaa93105..8e1177c46592ac5ccfebc9a0a8c5a652d7a7097b 100644 (file)
@@ -661,7 +661,8 @@ qemuCapsInitGuest(virCapsPtr caps,
 
     /* Ignore binary if extracting version info fails */
     if (binary &&
-        qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCaps) < 0)
+        qemuCapsExtractVersionInfo(binary, info->arch,
+                                   false, NULL, &qemuCaps) < 0)
         VIR_FREE(binary);
 
     /* qemu-kvm/kvm binaries can only be used if
@@ -683,7 +684,8 @@ qemuCapsInitGuest(virCapsPtr caps,
                 continue;
 
             if (qemuCapsExtractVersionInfo(kvmbin, info->arch,
-                                           NULL, &kvmCaps) < 0) {
+                                           false, NULL,
+                                           &kvmCaps) < 0) {
                 VIR_FREE(kvmbin);
                 continue;
             }
@@ -1489,7 +1491,9 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
     return 0;
 }
 
-int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
+int qemuCapsExtractVersionInfo(const char *qemu,
+                               const char *arch,
+                               bool check_yajl,
                                unsigned int *retversion,
                                virBitmapPtr *retflags)
 {
@@ -1522,7 +1526,8 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
 
     if (!(flags = qemuCapsNew()) ||
         qemuCapsParseHelpStr(qemu, help, flags,
-                             &version, &is_kvm, &kvm_version, true) == -1)
+                             &version, &is_kvm, &kvm_version,
+                             check_yajl) == -1)
         goto cleanup;
 
     /* Currently only x86_64 and i686 support PCI-multibus. */
@@ -1600,7 +1605,8 @@ int qemuCapsExtractVersion(virCapsPtr caps,
         return -1;
     }
 
-    if (qemuCapsExtractVersionInfo(binary, ut.machine, version, NULL) < 0) {
+    if (qemuCapsExtractVersionInfo(binary, ut.machine, false,
+                                   version, NULL) < 0) {
         return -1;
     }
 
index 6526ea838df9a982484e938aa7cac30e5d40b192..ca5482914154016043c13562dcf6dea493d22aa8 100644 (file)
@@ -169,7 +169,9 @@ int qemuCapsProbeCPUModels(const char *qemu,
 
 int qemuCapsExtractVersion(virCapsPtr caps,
                            unsigned int *version);
-int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
+int qemuCapsExtractVersionInfo(const char *qemu,
+                               const char *arch,
+                               bool check_yajl,
                                unsigned int *version,
                                virBitmapPtr *qemuCaps);
 
index d34af96db42bf8bb80b2d37aa1a3957e5aaed8f0..d6df4ee10fcb000ab4dd167f34d496b488e65ada 100644 (file)
@@ -776,7 +776,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def, virBitmapPtr qemuCaps)
     if (!qemuCaps) {
         /* need to get information from real environment */
         if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
-                                       NULL,
+                                       false, NULL,
                                        &localCaps) < 0)
             goto cleanup;
         qemuCaps = localCaps;
@@ -1015,6 +1015,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
     if (!qemuCaps) {
         /* need to get information from real environment */
         if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
+                                       false,
                                        NULL,
                                        &localCaps) < 0)
             goto cleanup;
index 46831a68a427c09f828d5c76ebce574a7fb66db2..ecd2ec18dc7cb124d8ed9ddfca97be3e9a944ebe 100644 (file)
@@ -4761,6 +4761,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     }
 
     if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
+                                   false,
                                    NULL,
                                    &qemuCaps) < 0)
         goto cleanup;
index 5bdf7335470cf3c61d8014bfcdf4a1ebca060e71..dad5304940881998a303da80d6442492750cb3e9 100644 (file)
@@ -3104,6 +3104,7 @@ qemuProcessReconnect(void *opaque)
      */
     if (!priv->qemuCaps &&
         qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
+                                   false,
                                    NULL,
                                    &priv->qemuCaps) < 0)
         goto error;
@@ -3504,6 +3505,7 @@ int qemuProcessStart(virConnectPtr conn,
     qemuCapsFree(priv->qemuCaps);
     priv->qemuCaps = NULL;
     if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch,
+                                   true,
                                    NULL,
                                    &priv->qemuCaps) < 0)
         goto cleanup;
@@ -4248,6 +4250,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
     priv->qemuCaps = NULL;
     if (qemuCapsExtractVersionInfo(vm->def->emulator,
                                    vm->def->os.arch,
+                                   false,
                                    NULL,
                                    &priv->qemuCaps) < 0)
         goto cleanup;