]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Add support for block-incremental migration parameter
authorJiri Denemark <jdenemar@redhat.com>
Thu, 26 Oct 2017 19:51:37 +0000 (21:51 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 2 Nov 2017 21:14:20 +0000 (22:14 +0100)
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>
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
src/qemu/qemu_monitor_json.c
tests/qemumonitorjsontest.c

index 04b18baf9c5a9943419c48889e9aa1a7b4ab2026..611876ff89793310662e42a593c241d3b0879e57 100644 (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);
 
index 7836dd33225ac424ff2db1cebb0645fe9dc90d6f..f81fb7f2ad00aaa665a22d4a077bc43a503367cb 100644 (file)
@@ -633,6 +633,9 @@ struct _qemuMonitorMigrationParams {
 
     bool downtimeLimit_set;
     unsigned long long downtimeLimit;
+
+    bool blockIncremental_set;
+    bool blockIncremental;
 };
 
 int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
index 115610e50e51dd30138a8b5ebbb9d701caf51569..aa2599209b0d6051625d81d4e13a345a48f53932 100644 (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
index 488c79cc33e4512a7c329bcacfd6d32bff4a39f7..aa2f679472d645970c37659b66a7ba339f617aee 100644 (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;