summary refs log tree commit diff stats
path: root/hmp.c
diff options
context:
space:
mode:
authorBharata B Rao <bharata@linux.vnet.ibm.com>2016-06-10 06:29:07 +0530
committerDavid Gibson <david@gibson.dropbear.id.au>2016-06-17 16:33:49 +1000
commitd2d8d46ff7f3edb21e09ebace775474d356bb6b7 (patch)
tree51d12d87e10c2e42481f14fc014903f05ff63af0 /hmp.c
parentd4633541ee0ec266ef4e55e1d71a98a18762d80c (diff)
downloadfocaccia-qemu-d2d8d46ff7f3edb21e09ebace775474d356bb6b7.tar.gz
focaccia-qemu-d2d8d46ff7f3edb21e09ebace775474d356bb6b7.zip
hmp: Add 'info hotpluggable-cpus' HMP command
This is the HMP equivalent for QMP query-hotpluggable-cpus.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[dwg: Fixed problem with printf formats on 32-bit host]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hmp.c')
-rw-r--r--hmp.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/hmp.c b/hmp.c
index 30897af6ae..997a768214 100644
--- a/hmp.c
+++ b/hmp.c
@@ -2433,3 +2433,45 @@ void hmp_info_dump(Monitor *mon, const QDict *qdict)
 
     qapi_free_DumpQueryResult(result);
 }
+
+void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
+{
+    Error *err = NULL;
+    HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
+    HotpluggableCPUList *saved = l;
+    CpuInstanceProperties *c;
+
+    if (err != NULL) {
+        hmp_handle_error(mon, &err);
+        return;
+    }
+
+    monitor_printf(mon, "Hotpluggable CPUs:\n");
+    while (l) {
+        monitor_printf(mon, "  type: \"%s\"\n", l->value->type);
+        monitor_printf(mon, "  vcpus_count: \"%" PRIu64 "\"\n",
+                       l->value->vcpus_count);
+        if (l->value->has_qom_path) {
+            monitor_printf(mon, "  qom_path: \"%s\"\n", l->value->qom_path);
+        }
+
+        c = l->value->props;
+        monitor_printf(mon, "  CPUInstance Properties:\n");
+        if (c->has_node) {
+            monitor_printf(mon, "    node: \"%" PRIu64 "\"\n", c->node);
+        }
+        if (c->has_socket) {
+            monitor_printf(mon, "    socket: \"%" PRIu64 "\"\n", c->socket);
+        }
+        if (c->has_core) {
+            monitor_printf(mon, "    core: \"%" PRIu64 "\"\n", c->core);
+        }
+        if (c->has_thread) {
+            monitor_printf(mon, "    thread: \"%" PRIu64 "\"\n", c->thread);
+        }
+
+        l = l->next;
+    }
+
+    qapi_free_HotpluggableCPUList(saved);
+}