提交 a9e723c8 编写于 作者: C Collin Walling 提交者: Jiri Denemark

qemu_monitor: make qemuMonitorJSONParseCPUModelData command-agnostic

Modify the error messages in qemuMonitorJSONParseCPUModelData to print
the command name provided to the function.
Signed-off-by: NCollin Walling <walling@linux.ibm.com>
Message-Id: <1568924706-2311-7-git-send-email-walling@linux.ibm.com>
Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
上级 afd22268
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册