From 487759126be44534e76b69f89e4746d07a8be3c1 Mon Sep 17 00:00:00 2001 From: Jiri Denemark Date: Thu, 26 Oct 2017 22:10:31 +0200 Subject: [PATCH] qemu: Drop giant if statement from qemuMonitorSetMigrationParams 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 Reviewed-by: John Ferlan --- 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 dd9d64a207..71069827e4 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 826133543e..d3c37ded87 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;