From 295bda40da400bea10d997e84780659169bee778 Mon Sep 17 00:00:00 2001 From: "Daniel P. Berrange" Date: Fri, 28 Sep 2012 15:55:54 +0100 Subject: [PATCH] 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 --- src/qemu/qemu_monitor_json.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); -- 2.39.5