From: Michal Privoznik Date: Tue, 19 Nov 2013 14:42:28 +0000 (+0100) Subject: qemuMonitorJSONGetCPUx86Data: Don't fail on ancient qemus X-Git-Tag: v1.2.0-rc1~59 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=730af8f2cd7bc0e4c98b97200857909f42ea817f;p=thirdparty%2Flibvirt.git qemuMonitorJSONGetCPUx86Data: Don't fail on ancient qemus On the domain startup, this function is called to dump some info about the CPUs. At the beginning of the function we check if we aren't running older qemu which is not exposing the CPUs via 'qom-list'. However, we are not checking for even older qemus, which throw 'CommandNotFound' error. Signed-off-by: Michal Privoznik --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e716fb3763..ec3b95876d 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5528,11 +5528,13 @@ qemuMonitorJSONGetCPUx86Data(qemuMonitorPtr mon, goto cleanup; /* check if device exists */ - if ((data = virJSONValueObjectGet(reply, "error")) && - STREQ_NULLABLE(virJSONValueObjectGetString(data, "class"), - "DeviceNotFound")) { - ret = -2; - goto cleanup; + if ((data = virJSONValueObjectGet(reply, "error"))) { + const char *klass = virJSONValueObjectGetString(data, "class"); + if (STREQ_NULLABLE(klass, "DeviceNotFound") || + STREQ_NULLABLE(klass, "CommandNotFound")) { + ret = -2; + goto cleanup; + } } if (qemuMonitorJSONCheckError(cmd, reply))