提交 2384b6f0 编写于 作者: J Jiri Denemark

qemu: Add support for setting downtime-limit migration parameter

We already support setting the maximum downtime with a dedicated
virDomainMigrateSetMaxDowntime API. This patch does not implement
another way of setting the downtime by adding a new public migration
parameter. It just makes sure any parameter we are able to get from a
QEMU monitor by query-migrate-parameters can be passed back to QEMU via
migrate-set-parameters.
Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
Reviewed-by: NJohn Ferlan <jferlan@redhat.com>
上级 9b5d1bd2
...@@ -2607,14 +2607,15 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, ...@@ -2607,14 +2607,15 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d " VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
"decompressThreads=%d:%d cpuThrottleInitial=%d:%d " "decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
"cpuThrottleIncrement=%d:%d tlsAlias=%s " "cpuThrottleIncrement=%d:%d tlsAlias=%s "
"tlsHostname=%s", "tlsHostname=%s downtimeLimit=%d:%llu",
params->compressLevel_set, params->compressLevel, params->compressLevel_set, params->compressLevel,
params->compressThreads_set, params->compressThreads, params->compressThreads_set, params->compressThreads,
params->decompressThreads_set, params->decompressThreads, params->decompressThreads_set, params->decompressThreads,
params->cpuThrottleInitial_set, params->cpuThrottleInitial, params->cpuThrottleInitial_set, params->cpuThrottleInitial,
params->cpuThrottleIncrement_set, params->cpuThrottleIncrement, params->cpuThrottleIncrement_set, params->cpuThrottleIncrement,
NULLSTR(params->migrateTLSAlias), NULLSTR(params->migrateTLSAlias),
NULLSTR(params->migrateTLSHostname)); NULLSTR(params->migrateTLSHostname),
params->downtimeLimit_set, params->downtimeLimit);
QEMU_CHECK_MONITOR_JSON(mon); QEMU_CHECK_MONITOR_JSON(mon);
......
...@@ -2753,6 +2753,10 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, ...@@ -2753,6 +2753,10 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
APPEND(params->VAR, \ APPEND(params->VAR, \
virJSONValueObjectAppendString, VAR, FIELD) virJSONValueObjectAppendString, VAR, FIELD)
#define APPEND_ULONG(VAR, FIELD) \
APPEND(params->VAR ## _set, \
virJSONValueObjectAppendNumberUlong, VAR, FIELD)
APPEND_INT(compressLevel, "compress-level"); APPEND_INT(compressLevel, "compress-level");
APPEND_INT(compressThreads, "compress-threads"); APPEND_INT(compressThreads, "compress-threads");
APPEND_INT(decompressThreads, "decompress-threads"); APPEND_INT(decompressThreads, "decompress-threads");
...@@ -2760,10 +2764,12 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, ...@@ -2760,10 +2764,12 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment"); APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment");
APPEND_STR(migrateTLSAlias, "tls-creds"); APPEND_STR(migrateTLSAlias, "tls-creds");
APPEND_STR(migrateTLSHostname, "tls-hostname"); APPEND_STR(migrateTLSHostname, "tls-hostname");
APPEND_ULONG(downtimeLimit, "downtime-limit");
#undef APPEND #undef APPEND
#undef APPEND_INT #undef APPEND_INT
#undef APPEND_STR #undef APPEND_STR
#undef APPEND_ULONG
if (virJSONValueObjectKeysNumber(args) == 0) { if (virJSONValueObjectKeysNumber(args) == 0) {
ret = 0; ret = 0;
......
...@@ -1803,7 +1803,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) ...@@ -1803,7 +1803,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
" \"compress-level\": 1," " \"compress-level\": 1,"
" \"cpu-throttle-initial\": 20," " \"cpu-throttle-initial\": 20,"
" \"tls-creds\": \"tls0\"," " \"tls-creds\": \"tls0\","
" \"tls-hostname\": \"\"" " \"tls-hostname\": \"\","
" \"downtime-limit\": 500"
" }" " }"
"}") < 0) { "}") < 0) {
goto cleanup; goto cleanup;
...@@ -1830,6 +1831,9 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) ...@@ -1830,6 +1831,9 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
#define CHECK_INT(VAR, FIELD, VALUE) \ #define CHECK_INT(VAR, FIELD, VALUE) \
CHECK_NUM(VAR, FIELD, VALUE, "%d") CHECK_NUM(VAR, FIELD, VALUE, "%d")
#define CHECK_ULONG(VAR, FIELD, VALUE) \
CHECK_NUM(VAR, FIELD, VALUE, "%llu")
#define CHECK_STR(VAR, FIELD, VALUE) \ #define CHECK_STR(VAR, FIELD, VALUE) \
do { \ do { \
if (!params.VAR) { \ if (!params.VAR) { \
...@@ -1851,9 +1855,11 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) ...@@ -1851,9 +1855,11 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10); CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10);
CHECK_STR(migrateTLSAlias, "tls-creds", "tls0"); CHECK_STR(migrateTLSAlias, "tls-creds", "tls0");
CHECK_STR(migrateTLSHostname, "tls-hostname", ""); CHECK_STR(migrateTLSHostname, "tls-hostname", "");
CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL);
#undef CHECK_NUM #undef CHECK_NUM
#undef CHECK_INT #undef CHECK_INT
#undef CHECK_ULONG
#undef CHECK_STR #undef CHECK_STR
ret = 0; ret = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册