]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu_monitor: make qemuMonitorJSONParseCPUModelData command-agnostic
authorCollin Walling <walling@linux.ibm.com>
Thu, 19 Sep 2019 20:24:57 +0000 (16:24 -0400)
committerJiri Denemark <jdenemar@redhat.com>
Mon, 7 Oct 2019 08:09:49 +0000 (10:09 +0200)
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>
src/qemu/qemu_monitor_json.c

index fb44df9f8d1c7b2f84564a7f140c04a7c077fc4d..b9b66826e3936a806b4140021d7ed169dd7789ec 100644 (file)
@@ -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;