[PATCH v5 06/15] qemu_monitor: make qemuMonitorJSONParseCPUModelData command-agnostic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Modify the error messages in qemuMonitorJSONParseCPUModelData to print
the command name provided to the function.

Signed-off-by: Collin Walling <walling@xxxxxxxxxxxxx>
---
 src/qemu/qemu_monitor_json.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index ddcf425..13ee323 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -5833,27 +5833,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;
     }
 
@@ -5951,7 +5952,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;
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux