mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
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 <walling@linux.ibm.com> Message-Id: <1568924706-2311-7-git-send-email-walling@linux.ibm.com> Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
afd222684e
commit
a9e723c885
@ -5736,27 +5736,28 @@ qemuMonitorJSONMakeCPUModel(virCPUDefPtr cpu,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
qemuMonitorJSONParseCPUModelData(virJSONValuePtr data,
|
qemuMonitorJSONParseCPUModelData(virJSONValuePtr data,
|
||||||
|
const char *cmd_name,
|
||||||
bool fail_no_props,
|
bool fail_no_props,
|
||||||
virJSONValuePtr *cpu_model,
|
virJSONValuePtr *cpu_model,
|
||||||
virJSONValuePtr *cpu_props,
|
virJSONValuePtr *cpu_props,
|
||||||
const char **cpu_name)
|
const char **cpu_name)
|
||||||
{
|
{
|
||||||
if (!(*cpu_model = virJSONValueObjectGetObject(data, "model"))) {
|
if (!(*cpu_model = virJSONValueObjectGetObject(data, "model"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("query-cpu-model-expansion reply data was missing 'model'"));
|
_("%s reply data was missing 'model'"), cmd_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*cpu_name = virJSONValueObjectGetString(*cpu_model, "name"))) {
|
if (!(*cpu_name = virJSONValueObjectGetString(*cpu_model, "name"))) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("query-cpu-model-expansion reply data was missing 'name'"));
|
_("%s reply data was missing 'name'"), cmd_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*cpu_props = virJSONValueObjectGetObject(*cpu_model, "props")) &&
|
if (!(*cpu_props = virJSONValueObjectGetObject(*cpu_model, "props")) &&
|
||||||
fail_no_props) {
|
fail_no_props) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("query-cpu-model-expansion reply data was missing 'props'"));
|
_("%s reply data was missing 'props'"), cmd_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5854,7 +5855,7 @@ qemuMonitorJSONGetCPUModelExpansion(qemuMonitorPtr mon,
|
|||||||
|
|
||||||
data = virJSONValueObjectGetObject(reply, "return");
|
data = virJSONValueObjectGetObject(reply, "return");
|
||||||
|
|
||||||
if (qemuMonitorJSONParseCPUModelData(data,
|
if (qemuMonitorJSONParseCPUModelData(data, "query-cpu-model-expansion",
|
||||||
fail_no_props, &cpu_model, &cpu_props,
|
fail_no_props, &cpu_model, &cpu_props,
|
||||||
&cpu_name) < 0)
|
&cpu_name) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user