Re: [libvirt] [PATCH 05/11] qemu: Rework qemuMonitorJSONSetMigrationParams

2016-06-22 Thread Ján Tomko

On Tue, Jun 21, 2016 at 01:47:11PM +0200, Jiri Denemark wrote:

Signed-off-by: Jiri Denemark 
---
src/qemu/qemu_monitor_json.c | 23 +++
1 file changed, 11 insertions(+), 12 deletions(-)



ACK

Jan

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


[libvirt] [PATCH 05/11] qemu: Rework qemuMonitorJSONSetMigrationParams

2016-06-21 Thread Jiri Denemark
Signed-off-by: Jiri Denemark 
---
 src/qemu/qemu_monitor_json.c | 23 +++
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 99678c1..0434522 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2589,20 +2589,19 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
 if (!(args = virJSONValueNewObject()))
 goto cleanup;
 
-if (params->compressLevel_set &&
-virJSONValueObjectAppendNumberInt(args, "compress-level",
-  params->compressLevel) < 0)
-goto cleanup;
+#define APPEND(VAR, FIELD)  \
+do {\
+if (params->VAR ## _set &&  \
+virJSONValueObjectAppendNumberInt(args, FIELD,  \
+  params->VAR) < 0) \
+goto cleanup;   \
+} while (0)
 
-if (params->compressThreads_set &&
-virJSONValueObjectAppendNumberInt(args, "compress-threads",
-  params->compressThreads) < 0)
-goto cleanup;
+APPEND(compressLevel, "compress-level");
+APPEND(compressThreads, "compress-threads");
+APPEND(decompressThreads, "decompress-threads");
 
-if (params->decompressThreads_set &&
-virJSONValueObjectAppendNumberInt(args, "decompress-threads",
-  params->decompressThreads) < 0)
-goto cleanup;
+#undef APPEND
 
 if (virJSONValueObjectAppend(cmd, "arguments", args) < 0)
 goto cleanup;
-- 
2.9.0

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