]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
Ignore error from query-cpu-definitions
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 28 Sep 2012 14:55:54 +0000 (15:55 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 28 Sep 2012 15:50:51 +0000 (16:50 +0100)
Some architectures provide the query-cpu-definitions command,
but are set to always return a "GenericError" from it :-(
Catch this & treat it as if there was an empty list of CPUs
returned

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/qemu/qemu_monitor_json.c

index 166c431634edd56f3fde3ad80df17aa065668369..bd52ce44e83ad2d5c479f20aa94a08a13c12e70c 100644 (file)
@@ -3957,6 +3957,18 @@ int qemuMonitorJSONGetCPUDefinitions(qemuMonitorPtr mon,
 
     ret = qemuMonitorJSONCommand(mon, cmd, &reply);
 
+    if (ret == 0) {
+        /* Urgh, some QEMU architectures have the query-cpu-definitions
+         * command, but return 'GenericError' with string "Not supported",
+         * instead of simply omitting the command entirely :-(
+         */
+        if (qemuMonitorJSONHasError(reply, "GenericError")) {
+            ret = 0;
+            goto cleanup;
+        }
+        ret = qemuMonitorJSONCheckError(cmd, reply);
+    }
+
     if (ret == 0)
         ret = qemuMonitorJSONCheckError(cmd, reply);