[PATCH 12/12] qemu: Add support for block-incremental migration parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      |  6 ++++--
 src/qemu/qemu_monitor.h      |  3 +++
 src/qemu/qemu_monitor_json.c | 10 ++++++++++
 tests/qemumonitorjsontest.c  |  8 +++++++-
 4 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 04b18baf9..611876ff8 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -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);
 
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 7836dd332..f81fb7f2a 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -633,6 +633,9 @@ struct _qemuMonitorMigrationParams {
 
     bool downtimeLimit_set;
     unsigned long long downtimeLimit;
+
+    bool blockIncremental_set;
+    bool blockIncremental;
 };
 
 int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 115610e50..aa2599209 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -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
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 488c79cc3..aa2f67947 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -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;
-- 
2.14.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux