Checking whether the function has anything to do is better done in the
function rather then requiring callers to do that.
Signed-off-by: Jiri Denemark <jdenemar(a)redhat.com>
---
src/qemu/qemu_migration.c | 3 +--
src/qemu/qemu_monitor.c | 5 +++++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index a1ce84e..575d367 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3455,8 +3455,7 @@ qemuMigrationSetCompression(virQEMUDriverPtr driver,
if (qemuDomainObjEnterMonitorAsync(driver, vm, job) < 0)
return -1;
- if ((params->level_set || params->threads_set || params->dthreads_set)
&&
- qemuMonitorSetMigrationCompression(priv->mon, params) < 0)
+ if (qemuMonitorSetMigrationCompression(priv->mon, params) < 0)
goto cleanup;
if (compression->xbzrle_cache_set &&
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index d8e33a98..f7609e9 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2177,6 +2177,11 @@ qemuMonitorSetMigrationCompression(qemuMonitorPtr mon,
QEMU_CHECK_MONITOR_JSON(mon);
+ if (!compress->level_set &&
+ !compress->threads_set &&
+ !compress->dthreads_set)
+ return 0;
+
return qemuMonitorJSONSetMigrationCompression(mon, compress);
}
--
2.9.0