[PATCH 09/12] qemu: Add support for setting downtime-limit migration parameter

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

 



We already support setting the maximum downtime with a dedicated
virDomainMigrateSetMaxDowntime API. This patch does not implement
another way of setting the downtime by adding a new public migration
parameter. It just makes sure any parameter we are able to get from a
QEMU monitor by query-migrate-parameters can be passed back to QEMU via
migrate-set-parameters.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 5 +++--
 src/qemu/qemu_monitor_json.c | 6 ++++++
 tests/qemumonitorjsontest.c  | 8 +++++++-
 3 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 71069827e..c88726735 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2607,14 +2607,15 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
     VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
               "decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
               "cpuThrottleIncrement=%d:%d tlsAlias=%s "
-              "tlsHostname=%s",
+              "tlsHostname=%s downtimeLimit=%d:%llu",
               params->compressLevel_set, params->compressLevel,
               params->compressThreads_set, params->compressThreads,
               params->decompressThreads_set, params->decompressThreads,
               params->cpuThrottleInitial_set, params->cpuThrottleInitial,
               params->cpuThrottleIncrement_set, params->cpuThrottleIncrement,
               NULLSTR(params->migrateTLSAlias),
-              NULLSTR(params->migrateTLSHostname));
+              NULLSTR(params->migrateTLSHostname),
+              params->downtimeLimit_set, params->downtimeLimit);
 
     QEMU_CHECK_MONITOR_JSON(mon);
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index d3c37ded8..a2f3e3317 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2753,6 +2753,10 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
     APPEND(params->VAR,                                                     \
            virJSONValueObjectAppendString, VAR, FIELD)
 
+#define APPEND_ULONG(VAR, FIELD)                                            \
+    APPEND(params->VAR ## _set,                                             \
+           virJSONValueObjectAppendNumberUlong, VAR, FIELD)
+
     APPEND_INT(compressLevel, "compress-level");
     APPEND_INT(compressThreads, "compress-threads");
     APPEND_INT(decompressThreads, "decompress-threads");
@@ -2760,10 +2764,12 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
     APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment");
     APPEND_STR(migrateTLSAlias, "tls-creds");
     APPEND_STR(migrateTLSHostname, "tls-hostname");
+    APPEND_ULONG(downtimeLimit, "downtime-limit");
 
 #undef APPEND
 #undef APPEND_INT
 #undef APPEND_STR
+#undef APPEND_ULONG
 
     if (virJSONValueObjectKeysNumber(args) == 0) {
         ret = 0;
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index 2cefdcac9..cc55b0c43 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1803,7 +1803,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
                                "        \"compress-level\": 1,"
                                "        \"cpu-throttle-initial\": 20,"
                                "        \"tls-creds\": \"tls0\","
-                               "        \"tls-hostname\": \"\""
+                               "        \"tls-hostname\": \"\","
+                               "        \"downtime-limit\": 500"
                                "    }"
                                "}") < 0) {
         goto cleanup;
@@ -1830,6 +1831,9 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
 #define CHECK_INT(VAR, FIELD, VALUE)                                        \
     CHECK_NUM(VAR, FIELD, VALUE, "%d")
 
+#define CHECK_ULONG(VAR, FIELD, VALUE)                                      \
+    CHECK_NUM(VAR, FIELD, VALUE, "%llu")
+
 #define CHECK_STR(VAR, FIELD, VALUE)                                        \
     do {                                                                    \
         if (!params.VAR) {                                                  \
@@ -1851,9 +1855,11 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
     CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10);
     CHECK_STR(migrateTLSAlias, "tls-creds", "tls0");
     CHECK_STR(migrateTLSHostname, "tls-hostname", "");
+    CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL);
 
 #undef CHECK_NUM
 #undef CHECK_INT
+#undef CHECK_ULONG
 #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