]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: monitor: remove mon->json checks
authorJán Tomko <jtomko@redhat.com>
Fri, 14 Jun 2019 18:06:48 +0000 (20:06 +0200)
committerJán Tomko <jtomko@redhat.com>
Thu, 20 Jun 2019 11:47:41 +0000 (13:47 +0200)
Remove all the mon->json checks in qemuMonitor functions.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Acked-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_monitor.c

index f62913550311813e08c28b7406e2f2bfeee0b99b..4eea0a1bbadb8c4ba288262d595f6d0dba31591c 100644 (file)
@@ -1197,7 +1197,7 @@ qemuMonitorInitBalloonObjectPath(qemuMonitorPtr mon,
 
 /**
  * To update video memory size in status XML we need to load correct values from
- * QEMU.  This is supported only with JSON monitor.
+ * QEMU.
  *
  * Returns 0 on success, -1 on failure and sets proper error message.
  */
@@ -1211,29 +1211,25 @@ qemuMonitorUpdateVideoMemorySize(qemuMonitorPtr mon,
 
     QEMU_CHECK_MONITOR(mon);
 
-    if (mon->json) {
-        ret = qemuMonitorJSONFindLinkPath(mon, videoName,
-                                          video->info.alias, &path);
-        if (ret < 0) {
-            if (ret == -2)
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Failed to find QOM Object path for "
-                                 "device '%s'"), videoName);
-            return -1;
-        }
-
-        ret = qemuMonitorJSONUpdateVideoMemorySize(mon, video, path);
-        VIR_FREE(path);
-        return ret;
+    ret = qemuMonitorJSONFindLinkPath(mon, videoName,
+                                      video->info.alias, &path);
+    if (ret < 0) {
+        if (ret == -2)
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to find QOM Object path for "
+                             "device '%s'"), videoName);
+        return -1;
     }
 
-    return 0;
+    ret = qemuMonitorJSONUpdateVideoMemorySize(mon, video, path);
+    VIR_FREE(path);
+    return ret;
 }
 
 
 /**
  * To update video vram64 size in status XML we need to load correct value from
- * QEMU.  This is supported only with JSON monitor.
+ * QEMU.
  *
  * Returns 0 on success, -1 on failure and sets proper error message.
  */
@@ -1247,23 +1243,19 @@ qemuMonitorUpdateVideoVram64Size(qemuMonitorPtr mon,
 
     QEMU_CHECK_MONITOR(mon);
 
-    if (mon->json) {
-        ret = qemuMonitorJSONFindLinkPath(mon, videoName,
-                                          video->info.alias, &path);
-        if (ret < 0) {
-            if (ret == -2)
-                virReportError(VIR_ERR_INTERNAL_ERROR,
-                               _("Failed to find QOM Object path for "
-                                 "device '%s'"), videoName);
-            return -1;
-        }
-
-        ret = qemuMonitorJSONUpdateVideoVram64Size(mon, video, path);
-        VIR_FREE(path);
-        return ret;
+    ret = qemuMonitorJSONFindLinkPath(mon, videoName,
+                                      video->info.alias, &path);
+    if (ret < 0) {
+        if (ret == -2)
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Failed to find QOM Object path for "
+                             "device '%s'"), videoName);
+        return -1;
     }
 
-    return 0;
+    ret = qemuMonitorJSONUpdateVideoVram64Size(mon, video, path);
+    VIR_FREE(path);
+    return ret;
 }
 
 
@@ -1700,9 +1692,6 @@ qemuMonitorSetCapabilities(qemuMonitorPtr mon)
 {
     QEMU_CHECK_MONITOR(mon);
 
-    if (!mon->json)
-        return 0;
-
     return qemuMonitorJSONSetCapabilities(mon);
 }
 
@@ -2015,9 +2004,6 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
     if (VIR_ALLOC_N(info, maxvcpus) < 0)
         return -1;
 
-    if (!mon->json)
-        hotplug = false;
-
     /* initialize a few non-zero defaults */
     qemuMonitorCPUInfoClear(info, maxvcpus);
 
@@ -2168,9 +2154,6 @@ qemuMonitorSetMemoryStatsPeriod(qemuMonitorPtr mon,
     if (!mon)
         return -1;
 
-    if (!mon->json)
-        return -1;
-
     if (period < 0)
         return -1;
 
@@ -2696,10 +2679,6 @@ qemuMonitorGetDumpGuestMemoryCapability(qemuMonitorPtr mon,
 
     QEMU_CHECK_MONITOR(mon);
 
-    /* No capability is supported without JSON monitor */
-    if (!mon->json)
-        return 0;
-
     return qemuMonitorJSONGetDumpGuestMemoryCapability(mon, capability);
 }
 
@@ -3303,7 +3282,7 @@ qemuMonitorBlockCommit(qemuMonitorPtr mon, const char *device,
 bool
 qemuMonitorSupportsActiveCommit(qemuMonitorPtr mon)
 {
-    if (!mon || !mon->json)
+    if (!mon)
         return false;
 
     return qemuMonitorJSONSupportsActiveCommit(mon);
@@ -3854,10 +3833,6 @@ qemuMonitorGetMigrationCapabilities(qemuMonitorPtr mon,
 {
     QEMU_CHECK_MONITOR(mon);
 
-    /* No capability is supported without JSON monitor */
-    if (!mon->json)
-        return 0;
-
     return qemuMonitorJSONGetMigrationCapabilities(mon, capabilities);
 }
 
@@ -4172,12 +4147,6 @@ qemuMonitorGetIOThreads(qemuMonitorPtr mon,
 
     QEMU_CHECK_MONITOR(mon);
 
-    /* Requires JSON to make the query */
-    if (!mon->json) {
-        *iothreads = NULL;
-        return 0;
-    }
-
     return qemuMonitorJSONGetIOThreads(mon, iothreads);
 }
 
@@ -4224,9 +4193,6 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitorPtr mon,
 
     QEMU_CHECK_MONITOR(mon);
 
-    if (!mon->json)
-        return -2;
-
     if (!(*info = virHashCreate(10, virHashValueFree)))
         return -1;