qemu: Add support for block-incremental migration parameter

We handle incremental storage migration in a different way. The support
for this new (as of QEMU 2.10) parameter is only needed for full
coverage of migration parameters used by QEMU.

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 21:51:37 +02:00
parent f6e2a70ae2
commit a1e3e8ddbd
4 changed files with 24 additions and 3 deletions

View File

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

View File

@ -633,6 +633,9 @@ struct _qemuMonitorMigrationParams {
bool downtimeLimit_set;
unsigned long long downtimeLimit;
bool blockIncremental_set;
bool blockIncremental;
};
int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,

View File

@ -2690,6 +2690,9 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
#define PARSE_ULONG(VAR, FIELD) \
PARSE_SET(virJSONValueObjectGetNumberUlong, VAR, FIELD)
#define PARSE_BOOL(VAR, FIELD) \
PARSE_SET(virJSONValueObjectGetBoolean, VAR, FIELD)
#define PARSE_STR(VAR, FIELD) \
do { \
const char *str; \
@ -2708,10 +2711,12 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
PARSE_STR(tlsHostname, "tls-hostname");
PARSE_ULONG(maxBandwidth, "max-bandwidth");
PARSE_ULONG(downtimeLimit, "downtime-limit");
PARSE_BOOL(blockIncremental, "block-incremental");
#undef PARSE_SET
#undef PARSE_INT
#undef PARSE_ULONG
#undef PARSE_BOOL
#undef PARSE_STR
ret = 0;
@ -2758,6 +2763,10 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
APPEND(params->VAR ## _set, \
virJSONValueObjectAppendNumberUlong, VAR, FIELD)
#define APPEND_BOOL(VAR, FIELD) \
APPEND(params->VAR ## _set, \
virJSONValueObjectAppendBoolean, VAR, FIELD)
APPEND_INT(compressLevel, "compress-level");
APPEND_INT(compressThreads, "compress-threads");
APPEND_INT(decompressThreads, "decompress-threads");
@ -2767,6 +2776,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
APPEND_STR(tlsHostname, "tls-hostname");
APPEND_ULONG(maxBandwidth, "max-bandwidth");
APPEND_ULONG(downtimeLimit, "downtime-limit");
APPEND_BOOL(blockIncremental, "block-incremental");
#undef APPEND
#undef APPEND_INT

View File

@ -1805,7 +1805,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
" \"tls-creds\": \"tls0\","
" \"tls-hostname\": \"\","
" \"max-bandwidth\": 1234567890,"
" \"downtime-limit\": 500"
" \"downtime-limit\": 500,"
" \"block-incremental\": true"
" }"
"}") < 0) {
goto cleanup;
@ -1835,6 +1836,9 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
#define CHECK_ULONG(VAR, FIELD, VALUE) \
CHECK_NUM(VAR, FIELD, VALUE, "%llu")
#define CHECK_BOOL(VAR, FIELD, VALUE) \
CHECK_NUM(VAR, FIELD, VALUE, "%d")
#define CHECK_STR(VAR, FIELD, VALUE) \
do { \
if (!params.VAR) { \
@ -1858,10 +1862,12 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
CHECK_STR(tlsHostname, "tls-hostname", "");
CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL);
CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL);
CHECK_BOOL(blockIncremental, "block-incremental", true);
#undef CHECK_NUM
#undef CHECK_INT
#undef CHECK_ULONG
#undef CHECK_BOOL
#undef CHECK_STR
ret = 0;