From: Jiri Denemark Date: Mon, 23 Oct 2017 15:06:57 +0000 (+0200) Subject: qemu: Use macro for setting string migration parameters X-Git-Tag: v3.10.0-rc1~261 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bc3d06700c6623147a463c2f10b1893d1e08bd4;p=thirdparty%2Flibvirt.git qemu: Use macro for setting string migration parameters Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 218bbd8bd6..826133543e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -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;