提交 eb3e0184 编写于 作者: J Jiri Denemark

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: NJiri Denemark <jdenemar@redhat.com>
上级 b1473708
...@@ -2537,6 +2537,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, ...@@ -2537,6 +2537,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
virJSONValuePtr cmd = NULL; virJSONValuePtr cmd = NULL;
virJSONValuePtr reply = NULL; virJSONValuePtr reply = NULL;
memset(params, 0, sizeof(*params));
if (!(cmd = qemuMonitorJSONMakeCommand("query-migrate-parameters", NULL))) if (!(cmd = qemuMonitorJSONMakeCommand("query-migrate-parameters", NULL)))
return -1; return -1;
...@@ -2548,32 +2550,18 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, ...@@ -2548,32 +2550,18 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
result = virJSONValueObjectGet(reply, "return"); result = virJSONValueObjectGet(reply, "return");
if (virJSONValueObjectGetNumberInt(result, "compress-level", #define PARSE(VAR, FIELD) \
&params->compressLevel) < 0) { do { \
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", if (virJSONValueObjectGetNumberInt(result, FIELD, \
_("malformed/missing compress-level " &params->VAR) == 0) \
"in migrate parameters")); params->VAR ## _set = true; \
goto cleanup; } while (0)
}
params->compressLevel_set = true;
if (virJSONValueObjectGetNumberInt(result, "compress-threads", PARSE(compressLevel, "compress-level");
&params->compressThreads) < 0) { PARSE(compressThreads, "compress-threads");
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", PARSE(decompressThreads, "decompress-threads");
_("malformed/missing compress-threads "
"in migrate parameters"));
goto cleanup;
}
params->compressThreads_set = true;
if (virJSONValueObjectGetNumberInt(result, "decompress-threads", #undef PARSE
&params->decompressThreads) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("malformed/missing decompress-threads "
"in migrate parameters"));
goto cleanup;
}
params->decompressThreads_set = true;
ret = 0; ret = 0;
cleanup: cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册