qemu: Rework qemuMonitorJSONSetMigrationParams

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Jiri Denemark 2016-06-20 16:55:07 +02:00
parent eb3e018414
commit bd3da51697

View File

@ -2589,20 +2589,19 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
if (!(args = virJSONValueNewObject())) if (!(args = virJSONValueNewObject()))
goto cleanup; goto cleanup;
if (params->compressLevel_set && #define APPEND(VAR, FIELD) \
virJSONValueObjectAppendNumberInt(args, "compress-level", do { \
params->compressLevel) < 0) if (params->VAR ## _set && \
goto cleanup; virJSONValueObjectAppendNumberInt(args, FIELD, \
params->VAR) < 0) \
goto cleanup; \
} while (0)
if (params->compressThreads_set && APPEND(compressLevel, "compress-level");
virJSONValueObjectAppendNumberInt(args, "compress-threads", APPEND(compressThreads, "compress-threads");
params->compressThreads) < 0) APPEND(decompressThreads, "decompress-threads");
goto cleanup;
if (params->decompressThreads_set && #undef APPEND
virJSONValueObjectAppendNumberInt(args, "decompress-threads",
params->decompressThreads) < 0)
goto cleanup;
if (virJSONValueObjectAppend(cmd, "arguments", args) < 0) if (virJSONValueObjectAppend(cmd, "arguments", args) < 0)
goto cleanup; goto cleanup;