]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: Add support for max-bandwidth migration parameter
authorJiri Denemark <jdenemar@redhat.com>
Thu, 26 Oct 2017 18:47:16 +0000 (20:47 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Thu, 2 Nov 2017 21:14:20 +0000 (22:14 +0100)
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@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 3e2c69a9ab5dc48a097b2323e2615b84aa70c7f9..04b18baf9c5a9943419c48889e9aa1a7b4ab2026 100644 (file)
@@ -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);
index e123baaaeaafd2aff9959432ed47227c5682339b..7836dd33225ac424ff2db1cebb0645fe9dc90d6f 100644 (file)
@@ -628,6 +628,9 @@ struct _qemuMonitorMigrationParams {
     char *tlsCreds;
     char *tlsHostname;
 
+    bool maxBandwidth_set;
+    unsigned long long maxBandwidth;
+
     bool downtimeLimit_set;
     unsigned long long downtimeLimit;
 };
index 9f238bc30b41a42c382cfe891d5459e71eb10607..115610e50e51dd30138a8b5ebbb9d701caf51569 100644 (file)
@@ -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
index aa5da8be98f5154ccc0d7a88f060c663a4b8b67c..488c79cc33e4512a7c329bcacfd6d32bff4a39f7 100644 (file)
@@ -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