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 <jdenemar@xxxxxxxxxx> --- src/qemu/qemu_monitor.c | 5 +++-- src/qemu/qemu_monitor.h | 3 +++ src/qemu/qemu_monitor_json.c | 2 ++ tests/qemumonitorjsontest.c | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 09f21ba77d..18b54e2da8 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 c95b3a2ef4..2bb4dbc667 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 -- 2.17.0 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list