[PATCH 09/11] qemu: Add support for cpu throttling parameters

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

 



Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/qemu/qemu_monitor.c      | 11 ++++++++---
 src/qemu/qemu_monitor.h      |  6 ++++++
 src/qemu/qemu_monitor_json.c |  4 ++++
 tests/qemumonitorjsontest.c  |  6 +++++-
 4 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index 2862cbc..098e654 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2173,16 +2173,21 @@ qemuMonitorSetMigrationParams(qemuMonitorPtr mon,
                               qemuMonitorMigrationParamsPtr params)
 {
     VIR_DEBUG("compressLevel=%d:%d compressThreads=%d:%d "
-              "decompressThreads=%d:%d",
+              "decompressThreads=%d:%d cpuThrottleInitial=%d:%d "
+              "cpuThrottleIncrement=%d:%d",
               params->compressLevel_set, params->compressLevel,
               params->compressThreads_set, params->compressThreads,
-              params->decompressThreads_set, params->decompressThreads);
+              params->decompressThreads_set, params->decompressThreads,
+              params->cpuThrottleInitial_set, params->cpuThrottleInitial,
+              params->cpuThrottleIncrement_set, params->cpuThrottleIncrement);
 
     QEMU_CHECK_MONITOR_JSON(mon);
 
     if (!params->compressLevel_set &&
         !params->compressThreads_set &&
-        !params->decompressThreads_set)
+        !params->decompressThreads_set &&
+        !params->cpuThrottleInitial_set &&
+        !params->cpuThrottleIncrement_set)
         return 0;
 
     return qemuMonitorJSONSetMigrationParams(mon, params);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 28cffc9..6fecca7 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -496,6 +496,12 @@ struct _qemuMonitorMigrationParams {
 
     bool decompressThreads_set;
     int decompressThreads;
+
+    bool cpuThrottleInitial_set;
+    int cpuThrottleInitial;
+
+    bool cpuThrottleIncrement_set;
+    int cpuThrottleIncrement;
 };
 
 int qemuMonitorGetMigrationParams(qemuMonitorPtr mon,
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 0434522..66b9c4c 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -2560,6 +2560,8 @@ qemuMonitorJSONGetMigrationParams(qemuMonitorPtr mon,
     PARSE(compressLevel, "compress-level");
     PARSE(compressThreads, "compress-threads");
     PARSE(decompressThreads, "decompress-threads");
+    PARSE(cpuThrottleInitial, "cpu-throttle-initial");
+    PARSE(cpuThrottleIncrement, "cpu-throttle-increment");
 
 #undef PARSE
 
@@ -2600,6 +2602,8 @@ qemuMonitorJSONSetMigrationParams(qemuMonitorPtr mon,
     APPEND(compressLevel, "compress-level");
     APPEND(compressThreads, "compress-threads");
     APPEND(decompressThreads, "decompress-threads");
+    APPEND(cpuThrottleInitial, "cpu-throttle-initial");
+    APPEND(cpuThrottleIncrement, "cpu-throttle-increment");
 
 #undef APPEND
 
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
index a0079dd..f698c14 100644
--- a/tests/qemumonitorjsontest.c
+++ b/tests/qemumonitorjsontest.c
@@ -1630,8 +1630,10 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
                                "{"
                                "    \"return\": {"
                                "        \"decompress-threads\": 2,"
+                               "        \"cpu-throttle-increment\": 10,"
                                "        \"compress-threads\": 8,"
-                               "        \"compress-level\": 1"
+                               "        \"compress-level\": 1,"
+                               "        \"cpu-throttle-initial\": 20"
                                "    }"
                                "}") < 0) {
         goto cleanup;
@@ -1658,6 +1660,8 @@ testQemuMonitorJSONqemuMonitorJSONGetMigrationParams(const void *data)
     CHECK(compressLevel, "compress-level", 1);
     CHECK(compressThreads, "compress-threads", 8);
     CHECK(decompressThreads, "decompress-threads", 2);
+    CHECK(cpuThrottleInitial, "cpu-throttle-initial", 20);
+    CHECK(cpuThrottleIncrement, "cpu-throttle-increment", 10);
 
 #undef CHECK
 
-- 
2.9.0

--
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]