]> xenbits.xensource.com Git - qemu-upstream-4.6-testing.git/commitdiff
QMP: Add cpu-add command
authorIgor Mammedov <imammedo@redhat.com>
Tue, 30 Apr 2013 13:41:25 +0000 (15:41 +0200)
committerAnthony PERARD <anthony.perard@citrix.com>
Mon, 17 Jun 2013 11:31:11 +0000 (12:31 +0100)
Adds "cpu-add id=xxx" QMP command.

cpu-add's "id" argument is a CPU number in a range [0..max-cpus)

Example QMP command:
 -> { "execute": "cpu-add", "arguments": { "id": 2 } }
 <- { "return": {} }

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Acked-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
(cherry picked from QEMU commit 69ca3ea5e192251f27510554611bcff6f036a00b)
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
qapi-schema.json
qmp-commands.hx
qmp.c

index 5dfa0523915e1b3ea88d674492c3eb3ffb81a24f..64cecbe2df39409be2105f9a32abfbd41fdef63b 100644 (file)
 ##
 { 'command': 'cpu', 'data': {'index': 'int'} }
 
+##
+# @cpu-add
+#
+# Adds CPU with specified ID
+#
+# @id: ID of CPU to be created, valid values [0..max_cpus)
+#
+# Returns: Nothing on success
+#
+# Since 1.5
+##
+{ 'command': 'cpu-add', 'data': {'id': 'int'} }
+
 ##
 # @memsave:
 #
index 5c692d0cb531910ecacdd0d1041c847ae929d9c8..88e097ab800d8432be793f548cc44a8c2a9009b8 100644 (file)
@@ -382,6 +382,29 @@ Example:
 
 Note: CPUs' indexes are obtained with the 'query-cpus' command.
 
+EQMP
+
+    {
+        .name       = "cpu-add",
+        .args_type  = "id:i",
+        .mhandler.cmd_new = qmp_marshal_input_cpu_add,
+    },
+
+SQMP
+cpu-add
+-------
+
+Adds virtual cpu
+
+Arguments:
+
+- "id": cpu id (json-int)
+
+Example:
+
+-> { "execute": "cpu-add", "arguments": { "id": 2 } }
+<- { "return": {} }
+
 EQMP
 
     {
diff --git a/qmp.c b/qmp.c
index e3a7f0b21771aaf94f503f31c683bbcd5a4ff55f..a904568da9e1d519ce86df5bd5c4c3300a22ad25 100644 (file)
--- a/qmp.c
+++ b/qmp.c
@@ -23,6 +23,7 @@
 #include "hw/qdev.h"
 #include "blockdev.h"
 #include "qemu/qom-qobject.h"
+#include "hw/boards.h"
 
 NameInfo *qmp_query_name(Error **errp)
 {
@@ -107,6 +108,15 @@ void qmp_cpu(int64_t index, Error **errp)
     /* Just do nothing */
 }
 
+void qmp_cpu_add(int64_t id, Error **errp)
+{
+    if (current_machine->hot_add_cpu) {
+        current_machine->hot_add_cpu(id, errp);
+    } else {
+        error_setg(errp, "Not supported");
+    }
+}
+
 #ifndef CONFIG_VNC
 /* If VNC support is enabled, the "true" query-vnc command is
    defined in the VNC subsystem */