qemu: Add support for max-bandwidth migration parameter

We already support several ways of setting migration bandwidth and this
is not adding another one. With this patch we are able to read and write
this parameter using query-migrate-parameters and migrate-set-parameters
in one call with all other 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-26 20:47:16 +02:00
parent af1d2fe270
commit f6e2a70ae2
4 changed files with 9 additions and 1 deletions

View File

@ -2607,13 +2607,14 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
"decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
"cpuThrottleIncrement=%d:%d tlsCreds=%s tlsHostname=%s "
"downtimeLimit=%d:%llu",
"maxBandwidth=%d:%llu downtimeLimit=%d:%llu",
params->compressLevel_set, params->compressLevel,
params->compressThreads_set, params->compressThreads,
params->decompressThreads_set, params->decompressThreads,
params->cpuThrottleInitial_set, params->cpuThrottleInitial,
params->cpuThrottleIncrement_set, params->cpuThrottleIncrement,
NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname),
params->maxBandwidth_set, params->maxBandwidth,
params->downtimeLimit_set, params->downtimeLimit);
QEMU_CHECK_MONITOR_JSON(mon);

View File

@ -628,6 +628,9 @@ struct _qemuMonitorMigrationParams {
char *tlsCreds;
char *tlsHostname;
bool maxBandwidth_set;
unsigned long long maxBandwidth;
bool downtimeLimit_set;
unsigned long long downtimeLimit;
};

View File

@ -2706,6 +2706,7 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment");
PARSE_STR(tlsCreds, "tls-creds");
PARSE_STR(tlsHostname, "tls-hostname");
PARSE_ULONG(maxBandwidth, "max-bandwidth");
PARSE_ULONG(downtimeLimit, "downtime-limit");
#undef PARSE_SET
@ -2764,6 +2765,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment");
APPEND_STR(tlsCreds, "tls-creds");
APPEND_STR(tlsHostname, "tls-hostname");
APPEND_ULONG(maxBandwidth, "max-bandwidth");
APPEND_ULONG(downtimeLimit, "downtime-limit");
#undef APPEND

View File

@ -1804,6 +1804,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
" \"cpu-throttle-initial\": 20,"
" \"tls-creds\": \"tls0\","
" \"tls-hostname\": \"\","
" \"max-bandwidth\": 1234567890,"
" \"downtime-limit\": 500"
" }"
"}") < 0) {
@ -1855,6 +1856,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10);
CHECK_STR(tlsCreds, "tls-creds", "tls0");
CHECK_STR(tlsHostname, "tls-hostname", "");
CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL);
CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL);
#undef CHECK_NUM