From: Daniel P. Berrange Date: Fri, 28 Sep 2012 14:55:54 +0000 (+0100) Subject: Ignore error from query-cpu-definitions X-Git-Tag: v1.0.0-rc1~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=295bda40da400bea10d997e84780659169bee778;p=thirdparty%2Flibvirt.git Ignore error from query-cpu-definitions 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 --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 166c431634..bd52ce44e8 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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);