]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Use macro for setting string migration parameters
authorJiri Denemark <jdenemar@redhat.com>
Mon, 23 Oct 2017 15:06:57 +0000 (17:06 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 2 Nov 2017 21:14:19 +0000 (22:14 +0100)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_monitor_json.c

index 218bbd8bd645074df43e556f6b1210dd4236144e..826133543e6c9da3f4f8dec8ab7f467ad1c27272 100644 (file)
@@ -2749,24 +2749,21 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
     APPEND(params->VAR ## _set,                                             \
            virJSONValueObjectAppendNumberInt, VAR, FIELD)
 
+#define APPEND_STR(VAR, FIELD)                                              \
+    APPEND(params->VAR,                                                     \
+           virJSONValueObjectAppendString, VAR, FIELD)
+
     APPEND_INT(compressLevel, "compress-level");
     APPEND_INT(compressThreads, "compress-threads");
     APPEND_INT(decompressThreads, "decompress-threads");
     APPEND_INT(cpuThrottleInitial, "cpu-throttle-initial");
     APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment");
+    APPEND_STR(migrateTLSAlias, "tls-creds");
+    APPEND_STR(migrateTLSHostname, "tls-hostname");
 
 #undef APPEND
 #undef APPEND_INT
-
-    if (params->migrateTLSAlias &&
-        virJSONValueObjectAppendString(args, "tls-creds",
-                                       params->migrateTLSAlias) < 0)
-        goto cleanup;
-
-    if (params->migrateTLSHostname &&
-        virJSONValueObjectAppendString(args, "tls-hostname",
-                                       params->migrateTLSHostname) < 0)
-        goto cleanup;
+#undef APPEND_STR
 
     if (virJSONValueObjectAppend(cmd, "arguments", args) < 0)
         goto cleanup;