mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
qemu: Rework qemuMonitorJSONGetMigrationParams
We should not require any parameters to be present. After all we have the *_set bools to express that some parameters were not set. Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
b1473708d8
commit
eb3e018414
@ -2537,6 +2537,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
|
||||
virJSONValuePtr cmd = NULL;
|
||||
virJSONValuePtr reply = NULL;
|
||||
|
||||
memset(params, 0, sizeof(*params));
|
||||
|
||||
if (!(cmd = qemuMonitorJSONMakeCommand("query-migrate-parameters", NULL)))
|
||||
return -1;
|
||||
|
||||
@ -2548,32 +2550,18 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
|
||||
|
||||
result = virJSONValueObjectGet(reply, "return");
|
||||
|
||||
if (virJSONValueObjectGetNumberInt(result, "compress-level",
|
||||
¶ms->compressLevel) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed/missing compress-level "
|
||||
"in migrate parameters"));
|
||||
goto cleanup;
|
||||
}
|
||||
params->compressLevel_set = true;
|
||||
#define PARSE(VAR, FIELD) \
|
||||
do { \
|
||||
if (virJSONValueObjectGetNumberInt(result, FIELD, \
|
||||
¶ms->VAR) == 0) \
|
||||
params->VAR ## _set = true; \
|
||||
} while (0)
|
||||
|
||||
if (virJSONValueObjectGetNumberInt(result, "compress-threads",
|
||||
¶ms->compressThreads) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed/missing compress-threads "
|
||||
"in migrate parameters"));
|
||||
goto cleanup;
|
||||
}
|
||||
params->compressThreads_set = true;
|
||||
PARSE(compressLevel, "compress-level");
|
||||
PARSE(compressThreads, "compress-threads");
|
||||
PARSE(decompressThreads, "decompress-threads");
|
||||
|
||||
if (virJSONValueObjectGetNumberInt(result, "decompress-threads",
|
||||
¶ms->decompressThreads) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("malformed/missing decompress-threads "
|
||||
"in migrate parameters"));
|
||||
goto cleanup;
|
||||
}
|
||||
params->decompressThreads_set = true;
|
||||
#undef PARSE
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
|
Loading…
x
Reference in New Issue
Block a user