From: Collin Walling Date: Thu, 19 Sep 2019 20:24:57 +0000 (-0400) Subject: qemu_monitor: make qemuMonitorJSONParseCPUModelData command-agnostic X-Git-Tag: v5.9.0-rc1~382 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a9e723c8853622e0d733ae39e0340d177b0badea;p=thirdparty%2Flibvirt.git qemu_monitor: make qemuMonitorJSONParseCPUModelData command-agnostic Modify the error messages in qemuMonitorJSONParseCPUModelData to print the command name provided to the function. Signed-off-by: Collin Walling Message-Id: <1568924706-2311-7-git-send-email-walling@linux.ibm.com> Reviewed-by: Jiri Denemark --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index fb44df9f8d..b9b66826e3 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5736,27 +5736,28 @@ qemuMonitorJSONMakeCPUModel(virCPUDefPtr cpu, static int qemuMonitorJSONParseCPUModelData(virJSONValuePtr data, + const char *cmd_name, bool fail_no_props, virJSONValuePtr *cpu_model, virJSONValuePtr *cpu_props, const char **cpu_name) { if (!(*cpu_model = virJSONValueObjectGetObject(data, "model"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-cpu-model-expansion reply data was missing 'model'")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s reply data was missing 'model'"), cmd_name); return -1; } if (!(*cpu_name = virJSONValueObjectGetString(*cpu_model, "name"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-cpu-model-expansion reply data was missing 'name'")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s reply data was missing 'name'"), cmd_name); return -1; } if (!(*cpu_props = virJSONValueObjectGetObject(*cpu_model, "props")) && fail_no_props) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("query-cpu-model-expansion reply data was missing 'props'")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("%s reply data was missing 'props'"), cmd_name); return -1; } @@ -5854,7 +5855,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitorPtr mon, data = virJSONValueObjectGetObject(reply, "return"); - if (qemuMonitorJSONParseCPUModelData(data, + if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion", fail_no_props, &cpu_model, &cpu_props, &cpu_name) < 0) return -1;