[PATCH 06/12] qemu: Drop giant if statement from qemuMonitorSetMigrationParams

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

 



The check can be easily replaced with a simple test in the JSON
implementation and we don't need to update it every time a new parameter
is added.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 9 ---------
 src/qemu/qemu_monitor_json.c | 5 +++++
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index dd9d64a20..71069827e 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2618,15 +2618,6 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
 
     QEMU_CHECK_MONITOR_JSON(mon);
 
-    if (!params->compressLevel_set &&
-        !params->compressThreads_set &&
-        !params->decompressThreads_set &&
-        !params->cpuThrottleInitial_set &&
-        !params->cpuThrottleIncrement_set &&
-        !params->migrateTLSAlias &&
-        !params->migrateTLSHostname)
-        return 0;
-
     return qemuMonitorJSONSetMigrationParams(mon, params);
 }
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 826133543..d3c37ded8 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2765,6 +2765,11 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
 #undef APPEND_INT
 #undef APPEND_STR
 
+    if (virJSONValueObjectKeysNumber(args) == 0) {
+        ret = 0;
+        goto cleanup;
+    }
+
     if (virJSONValueObjectAppend(cmd, "arguments", args) < 0)
         goto cleanup;
     args = NULL;
-- 
2.14.3

--
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