[libvirt] [PATCH 11/12] qemu: Add support for max-bandwidth migration parameter

Jiri Denemark jdenemar at redhat.com
Thu Oct 26 22:04:00 UTC 2017


We already support several ways of setting migration bandwidth and this
is not adding another one. With this patch we are able to read and write
this parameter using query-migrate-parameters and migrate-set-parameters
in one call with all other parameters.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 src/qemu/qemu_monitor.c      | 3 ++-
 src/qemu/qemu_monitor.h      | 3 +++
 src/qemu/qemu_monitor_json.c | 2 ++
 tests/qemumonitorjsontest.c  | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 3e2c69a9a..04b18baf9 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2607,13 +2607,14 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
     VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
               "decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
               "cpuThrottleIncrement=%d:%d tlsCreds=%s tlsHostname=%s "
-              "downtimeLimit=%d:%llu",
+              "maxBandwidth=%d:%llu 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->tlsCreds), NULLSTR(params->tlsHostname),
+              params->maxBandwidth_set, params->maxBandwidth,
               params->downtimeLimit_set, params->downtimeLimit);
 
     QEMU_CHECK_MONITOR_JSON(mon);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index e123baaae..7836dd332 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -628,6 +628,9 @@ struct _qemuMonitorMigrationParams {
     char *tlsCreds;
     char *tlsHostname;
 
+    bool maxBandwidth_set;
+    unsigned long long maxBandwidth;
+
     bool downtimeLimit_set;
     unsigned long long downtimeLimit;
 };
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 9f238bc30..115610e50 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2706,6 +2706,7 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
     PARSE_INT(cpuThrottleIncrement, "cpu-throttle-increment");
     PARSE_STR(tlsCreds, "tls-creds");
     PARSE_STR(tlsHostname, "tls-hostname");
+    PARSE_ULONG(maxBandwidth, "max-bandwidth");
     PARSE_ULONG(downtimeLimit, "downtime-limit");
 
 #undef PARSE_SET
@@ -2764,6 +2765,7 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
     APPEND_INT(cpuThrottleIncrement, "cpu-throttle-increment");
     APPEND_STR(tlsCreds, "tls-creds");
     APPEND_STR(tlsHostname, "tls-hostname");
+    APPEND_ULONG(maxBandwidth, "max-bandwidth");
     APPEND_ULONG(downtimeLimit, "downtime-limit");
 
 #undef APPEND
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index aa5da8be9..488c79cc3 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1804,6 +1804,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
                                "        \"cpu-throttle-initial\": 20,"
                                "        \"tls-creds\": \"tls0\","
                                "        \"tls-hostname\": \"\","
+                               "        \"max-bandwidth\": 1234567890,"
                                "        \"downtime-limit\": 500"
                                "    }"
                                "}") < 0) {
@@ -1855,6 +1856,7 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
     CHECK_INT(cpuThrottleIncrement, "cpu-throttle-increment", 10);
     CHECK_STR(tlsCreds, "tls-creds", "tls0");
     CHECK_STR(tlsHostname, "tls-hostname", "");
+    CHECK_ULONG(maxBandwidth, "max-bandwidth", 1234567890ULL);
     CHECK_ULONG(downtimeLimit, "downtime-limit", 500ULL);
 
 #undef CHECK_NUM
-- 
2.14.3




More information about the libvir-list mailing list