]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Add support for xbzrle-cache-size migration parameter
authorJiri Denemark <jdenemar@redhat.com>
Wed, 8 Nov 2017 12:46:03 +0000 (13:46 +0100)
committerJiri Denemark <jdenemar@redhat.com>
Tue, 17 Apr 2018 08:46:23 +0000 (10:46 +0200)
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@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
tests/qemumonitorjsontest.c

index c22ed3706fb4b57055fcafdfb24352b468a21081..008d7c1ca960521a17a117aa14f45bf3dd0b13fb 100644 (file)
@@ -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);
 
index eeb4e4c622f99cd947a486e5957828c6febba780..cc4a6647e6d008816516861eb2da17ae4bb85736 100644 (file)
@@ -673,6 +673,9 @@ struct _qemuMonitorMigrationParams {
 
     bool blockIncremental_set;
     bool blockIncremental;
+
+    bool xbzrleCacheSize_set;
+    unsigned long long xbzrleCacheSize;
 };
 
 int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
index c6cb71addf071b2aecfc4a3eed20347bca598c2f..acc126629e7391e8b4136375c6886d2d09d01acc 100644 (file)
@@ -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
index 1cad383596e04d79f8c6fd3ff3c38c5e7e535950..8a5b0be64b8015a9eea411fbb52ed1cecb5fb02e 100644 (file)
@@ -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