diff mbox series

[3/3] hmp: add hmp for migrate_set_max_cpu_throttle

Message ID 1533026124-6740-4-git-send-email-liq3ea@gmail.com (mailing list archive)
State New, archived
Headers show
Series Add a new migrate_set_max_cpu_throttle qmp command | expand

Commit Message

Li Qiang July 31, 2018, 8:35 a.m. UTC
Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
 hmp-commands.hx | 14 ++++++++++++++
 hmp.c           |  6 ++++++
 hmp.h           |  1 +
 3 files changed, 21 insertions(+)
diff mbox series

Patch

diff --git a/hmp-commands.hx b/hmp-commands.hx
index 91dfe51c37..9d54ecbe4e 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1042,6 +1042,20 @@  Set maximum speed to @var{value} (in bytes) for migrations.
 ETEXI
 
     {
+        .name       = "migrate_set_max_cpu_throttle",
+        .args_type  = "value:i",
+        .params     = "value",
+        .help       = "set maximum cpu throttle  for migrations.",
+        .cmd        = hmp_migrate_set_max_cpu_throttle,
+    },
+
+STEXI
+@item hmp_migrate_set_max_cpu_throttle @var{value}
+@findex migrate_set_max_cpu_throttle
+Set maximum cpu throttle to @var{value}  for migrations.
+ETEXI
+
+    {
         .name       = "migrate_set_downtime",
         .args_type  = "value:T",
         .params     = "value",
diff --git a/hmp.c b/hmp.c
index 2aafb50e8e..4ee9af7165 100644
--- a/hmp.c
+++ b/hmp.c
@@ -1574,6 +1574,12 @@  void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict)
     qmp_migrate_set_speed(value, NULL);
 }
 
+void hmp_migrate_set_max_cpu_throttle(Monitor *mon, const QDict *qdict)
+{
+    int64_t value = qdict_get_int(qdict, "value");
+    qmp_migrate_set_max_cpu_throttle(value, NULL);
+}
+
 void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict)
 {
     const char *cap = qdict_get_str(qdict, "capability");
diff --git a/hmp.h b/hmp.h
index 33354f1bdd..e57f7e4005 100644
--- a/hmp.h
+++ b/hmp.h
@@ -73,6 +73,7 @@  void hmp_migrate_recover(Monitor *mon, const QDict *qdict);
 void hmp_migrate_pause(Monitor *mon, const QDict *qdict);
 void hmp_migrate_set_downtime(Monitor *mon, const QDict *qdict);
 void hmp_migrate_set_speed(Monitor *mon, const QDict *qdict);
+void hmp_migrate_set_max_cpu_throttle(Monitor *mon, const QDict *qdict);
 void hmp_migrate_set_capability(Monitor *mon, const QDict *qdict);
 void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict);
 void hmp_migrate_set_cache_size(Monitor *mon, const QDict *qdict);