qemu: Use macro for parsing ull migration parameters

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Jiri Denemark 2017-10-23 17:17:58 +02:00
parent 4fabc0caa0
commit 7ddcab891e

View File

@ -2687,6 +2687,9 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
#define PARSE_INT(VAR, FIELD) \
PARSE_SET(virJSONValueObjectGetNumberInt, VAR, FIELD)
#define PARSE_ULONG(VAR, FIELD) \
PARSE_SET(virJSONValueObjectGetNumberUlong, VAR, FIELD)
#define PARSE_STR(VAR, FIELD) \
do { \
const char *str; \
@ -2703,15 +2706,13 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment");
PARSE_STR(migrateTLSAlias, "tls-creds");
PARSE_STR(migrateTLSHostname, "tls-hostname");
PARSE_ULONG(downtimeLimit, "downtime-limit");
#undef PARSE_SET
#undef PARSE_INT
#undef PARSE_ULONG
#undef PARSE_STR
if (virJSONValueObjectGetNumberUlong(result, "downtime-limit",
&params->downtimeLimit) == 0)
params->downtimeLimit_set = true;
ret = 0;
cleanup:
virJSONValueFree(cmd);