From: Jiri Denemark Date: Wed, 8 Nov 2017 12:46:03 +0000 (+0100) Subject: qemu: Add support for xbzrle-cache-size migration parameter X-Git-Tag: v4.3.0-rc1~283 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=323567a6fa3e85830a6fa04aaa92099f9fca2490;p=thirdparty%2Flibvirt.git qemu: Add support for xbzrle-cache-size migration parameter Originally QEMU provided query-migrate-cache-size and migrate-set-cache-size QMP commands for querying/setting XBZRLE cache size. In version 2.11 QEMU added support for XBZRLE cache size to the general migration paramaters commands. This patch adds support for this parameter to libvirt to make sure it is properly restored to its original value after a failed or aborted migration. Signed-off-by: Jiri Denemark Reviewed-by: Ján Tomko --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index c22ed3706f..008d7c1ca9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2639,7 +2639,7 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, "decompressThreads=%d:%d cpuThrottleInitial=%d:%d " "cpuThrottleIncrement=%d:%d tlsCreds=%s tlsHostname=%s " "maxBandwidth=%d:%llu downtimeLimit=%d:%llu " - "blockIncremental=%d:%d", + "blockIncremental=%d:%d xbzrleCacheSize=%d:%llu", params->compressLevel_set, params->compressLevel, params->compressThreads_set, params->compressThreads, params->decompressThreads_set, params->decompressThreads, @@ -2648,7 +2648,8 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon, NULLSTR(params->tlsCreds), NULLSTR(params->tlsHostname), params->maxBandwidth_set, params->maxBandwidth, params->downtimeLimit_set, params->downtimeLimit, - params->blockIncremental_set, params->blockIncremental); + params->blockIncremental_set, params->blockIncremental, + params->xbzrleCacheSize_set, params->xbzrleCacheSize); QEMU_CHECK_MONITOR_JSON(mon); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index eeb4e4c622..cc4a6647e6 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -673,6 +673,9 @@ struct _qemuMonitorMigrationParams { bool blockIncremental_set; bool blockIncremental; + + bool xbzrleCacheSize_set; + unsigned long long xbzrleCacheSize; }; int qemuMonitorGetMigrationParams(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index c6cb71addf..acc126629e 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2833,6 +2833,7 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon, PARSE_ULONG(maxBandwidth, "max-bandwidth"); PARSE_ULONG(downtimeLimit, "downtime-limit"); PARSE_BOOL(blockIncremental, "block-incremental"); + PARSE_ULONG(xbzrleCacheSize, "xbzrle-cache-size"); #undef PARSE_SET #undef PARSE_INT @@ -2898,6 +2899,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon, APPEND_ULONG(maxBandwidth, "max-bandwidth"); APPEND_ULONG(downtimeLimit, "downtime-limit"); APPEND_BOOL(blockIncremental, "block-incremental"); + APPEND_ULONG(xbzrleCacheSize, "xbzrle-cache-size"); #undef APPEND #undef APPEND_INT diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 1cad383596..8a5b0be64b 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1810,7 +1810,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) " \"tls-hostname\": \"\"," " \"max-bandwidth\": 1234567890," " \"downtime-limit\": 500," - " \"block-incremental\": true" + " \"block-incremental\": true," + " \"xbzrle-cache-size\": 67108864" " }" "}") < 0) { goto cleanup; @@ -1867,6 +1868,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data) CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL); CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL); CHECK_BOOL(blockIncremental, "block-incremental", true); + CHECK_ULONG(xbzrleCacheSize, "xbzrle-cache-size", 67108864ULL); #undef CHECK_NUM #undef CHECK_INT