[libvirt] [PATCH for 3.0.0 0/2] Fix qemuMonitorJSONParseCPUModelProperty

qemuMonitorJSONParseCPUModelProperty was made a little bit to strict which could cause compatibility issues between libvirt 3.0.0 and QEMU 2.9.0 (or newer depending on when query-cpu-model-expansion is implemented for x86). Jiri Denemark (2): qemu: Don't check CPU model property key qemu: Ignore non-boolean CPU model properties src/qemu/qemu_monitor_json.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) -- 2.11.0

The qemuMonitorJSONParseCPUModelProperty function is a callback for virJSONValueObjectForeachKeyValue and is called for each key/value pair, thus it doesn't really make sense to check whether key is NULL. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_monitor_json.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e767437c0..9b9c098dc 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4982,12 +4982,6 @@ qemuMonitorJSONParseCPUModelProperty(const char *key, size_t n = machine_model->nprops; bool supported; - if (!key) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-cpu-model-expansion reply data is missing a" - " property name")); - return -1; - } if (VIR_STRDUP(machine_model->props[n].name, key) < 0) return -1; -- 2.11.0

The query-cpu-model-expansion is currently implemented for s390(x) only and all CPU properties it returns are booleans. However, x86 implementation will report more types of properties. Without making the code more tolerant older libvirt would fail to probe newer QEMU versions. Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/qemu/qemu_monitor_json.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 9b9c098dc..3afd56f38 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4982,15 +4982,12 @@ qemuMonitorJSONParseCPUModelProperty(const char *key, size_t n = machine_model->nprops; bool supported; + if (virJSONValueGetBoolean(value, &supported) < 0) + return 0; + if (VIR_STRDUP(machine_model->props[n].name, key) < 0) return -1; - if (virJSONValueGetBoolean(value, &supported) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-cpu-model-expansion reply data is missing a" - " feature support value")); - return -1; - } machine_model->props[n].supported = supported; machine_model->nprops++; -- 2.11.0

On Wed, Jan 11, 2017 at 03:00:46PM +0100, Jiri Denemark wrote:
qemuMonitorJSONParseCPUModelProperty was made a little bit to strict which could cause compatibility issues between libvirt 3.0.0 and QEMU 2.9.0 (or newer depending on when query-cpu-model-expansion is implemented for x86).
Jiri Denemark (2): qemu: Don't check CPU model property key qemu: Ignore non-boolean CPU model properties
ACK series and safe for freeze Pavel
participants (2)
-
Jiri Denemark
-
Pavel Hrdina