render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
6ae9ed
From 2f158bf21cf944a1c6ec6a3498cf702a9e6be161 Mon Sep 17 00:00:00 2001
6ae9ed
Message-Id: <2f158bf21cf944a1c6ec6a3498cf702a9e6be161@dist-git>
6ae9ed
From: Peter Krempa <pkrempa@redhat.com>
6ae9ed
Date: Wed, 14 Sep 2016 13:04:22 +0200
6ae9ed
Subject: [PATCH] qemu: monitor: Add vcpu state information to monitor data
6ae9ed
6ae9ed
https://bugzilla.redhat.com/show_bug.cgi?id=1375783
6ae9ed
6ae9ed
Return whether a vcpu entry is hotpluggable or online so that upper
6ae9ed
layers don't have to infer the information from other data.
6ae9ed
6ae9ed
Advantage is that this code can be tested by unit tests.
6ae9ed
6ae9ed
(cherry picked from commit 2a0e68be9185eecb9207ebdfdc4f8f0933f38bb3)
6ae9ed
---
6ae9ed
 src/qemu/qemu_monitor.c                            | 10 +++++
6ae9ed
 src/qemu/qemu_monitor.h                            |  4 ++
6ae9ed
 .../qemumonitorjson-cpuinfo-ppc64-basic.data       | 48 ++++++++++++++++++++++
6ae9ed
 .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data   | 48 ++++++++++++++++++++++
6ae9ed
 .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data   | 48 ++++++++++++++++++++++
6ae9ed
 .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data   | 48 ++++++++++++++++++++++
6ae9ed
 .../qemumonitorjson-cpuinfo-ppc64-no-threads.data  | 32 +++++++++++++++
6ae9ed
 ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 16 ++++++++
6ae9ed
 .../qemumonitorjson-cpuinfo-x86-full.data          | 22 ++++++++++
6ae9ed
 tests/qemumonitorjsontest.c                        |  3 ++
6ae9ed
 10 files changed, 279 insertions(+)
6ae9ed
6ae9ed
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
6ae9ed
index b88b0de..6801c13 100644
6ae9ed
--- a/src/qemu/qemu_monitor.c
6ae9ed
+++ b/src/qemu/qemu_monitor.c
6ae9ed
@@ -1768,6 +1768,7 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
6ae9ed
     int order = 1;
6ae9ed
     size_t totalvcpus = 0;
6ae9ed
     size_t mastervcpu; /* this iterator is used for iterating hotpluggable entities */
6ae9ed
+    size_t slavevcpu; /* this corresponds to subentries of a hotpluggable entry */
6ae9ed
     size_t anyvcpu; /* this iterator is used for any vcpu entry in the result */
6ae9ed
     size_t i;
6ae9ed
     size_t j;
6ae9ed
@@ -1811,6 +1812,9 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
6ae9ed
      * logical vcpus in the guest */
6ae9ed
     mastervcpu = 0;
6ae9ed
     for (i = 0; i < nhotplugvcpus; i++) {
6ae9ed
+        vcpus[mastervcpu].online = !!hotplugvcpus[i].qom_path;
6ae9ed
+        vcpus[mastervcpu].hotpluggable = !!hotplugvcpus[i].alias ||
6ae9ed
+                                         !vcpus[mastervcpu].online;
6ae9ed
         vcpus[mastervcpu].socket_id = hotplugvcpus[i].socket_id;
6ae9ed
         vcpus[mastervcpu].core_id = hotplugvcpus[i].core_id;
6ae9ed
         vcpus[mastervcpu].thread_id = hotplugvcpus[i].thread_id;
6ae9ed
@@ -1820,6 +1824,12 @@ qemuMonitorGetCPUInfoHotplug(struct qemuMonitorQueryHotpluggableCpusEntry *hotpl
6ae9ed
         VIR_STEAL_PTR(vcpus[mastervcpu].type, hotplugvcpus[i].type);
6ae9ed
         vcpus[mastervcpu].id = hotplugvcpus[i].enable_id;
6ae9ed
 
6ae9ed
+        /* copy state information to slave vcpus */
6ae9ed
+        for (slavevcpu = mastervcpu + 1; slavevcpu < mastervcpu + hotplugvcpus[i].vcpus; slavevcpu++) {
6ae9ed
+            vcpus[slavevcpu].online = vcpus[mastervcpu].online;
6ae9ed
+            vcpus[slavevcpu].hotpluggable = vcpus[mastervcpu].hotpluggable;
6ae9ed
+        }
6ae9ed
+
6ae9ed
         /* calculate next master vcpu (hotpluggable unit) entry */
6ae9ed
         mastervcpu += hotplugvcpus[i].vcpus;
6ae9ed
     }
6ae9ed
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
6ae9ed
index 09c404a..b1b6062 100644
6ae9ed
--- a/src/qemu/qemu_monitor.h
6ae9ed
+++ b/src/qemu/qemu_monitor.h
6ae9ed
@@ -422,6 +422,10 @@ struct _qemuMonitorCPUInfo {
6ae9ed
     pid_t tid;
6ae9ed
     int id; /* order of enabling of the given cpu */
6ae9ed
 
6ae9ed
+    /* state data */
6ae9ed
+    bool online;
6ae9ed
+    bool hotpluggable;
6ae9ed
+
6ae9ed
     /* topology info for hotplug purposes. Hotplug of given vcpu impossible if
6ae9ed
      * all entries are -1 */
6ae9ed
     int socket_id;
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data
6ae9ed
index 9fc8148..ae7c2f4 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-basic.data
6ae9ed
@@ -1,40 +1,88 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21925'
6ae9ed
     qemu-id='1'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[1]'
6ae9ed
     topology: core='0' vcpus='8'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21926'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21927'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21928'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21930'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21931'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21932'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21933'
6ae9ed
 [vcpu libvirt-id='8']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='8' vcpus='8'
6ae9ed
 [vcpu libvirt-id='9']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='10']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='11']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='12']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='13']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='14']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='15']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='16']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='16' vcpus='8'
6ae9ed
 [vcpu libvirt-id='17']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='18']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='19']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='20']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='21']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='22']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='23']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data
6ae9ed
index b0139b5..5c0a6af 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-1.data
6ae9ed
@@ -1,24 +1,42 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21925'
6ae9ed
     qemu-id='1'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[1]'
6ae9ed
     topology: core='0' vcpus='8'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21926'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21927'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21928'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21930'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21931'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21932'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21933'
6ae9ed
 [vcpu libvirt-id='8']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22131'
6ae9ed
     qemu-id='2'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
@@ -26,26 +44,56 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu0'
6ae9ed
     topology: core='8' vcpus='8'
6ae9ed
 [vcpu libvirt-id='9']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22132'
6ae9ed
 [vcpu libvirt-id='10']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22133'
6ae9ed
 [vcpu libvirt-id='11']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22134'
6ae9ed
 [vcpu libvirt-id='12']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22135'
6ae9ed
 [vcpu libvirt-id='13']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22136'
6ae9ed
 [vcpu libvirt-id='14']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22137'
6ae9ed
 [vcpu libvirt-id='15']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22138'
6ae9ed
 [vcpu libvirt-id='16']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='16' vcpus='8'
6ae9ed
 [vcpu libvirt-id='17']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='18']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='19']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='20']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='21']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='22']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
 [vcpu libvirt-id='23']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data
6ae9ed
index ea4b099..ba4044e 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-2.data
6ae9ed
@@ -1,24 +1,42 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21925'
6ae9ed
     qemu-id='1'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[1]'
6ae9ed
     topology: core='0' vcpus='8'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21926'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21927'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21928'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21930'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21931'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21932'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21933'
6ae9ed
 [vcpu libvirt-id='8']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22131'
6ae9ed
     qemu-id='2'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
@@ -26,20 +44,36 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu0'
6ae9ed
     topology: core='8' vcpus='8'
6ae9ed
 [vcpu libvirt-id='9']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22132'
6ae9ed
 [vcpu libvirt-id='10']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22133'
6ae9ed
 [vcpu libvirt-id='11']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22134'
6ae9ed
 [vcpu libvirt-id='12']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22135'
6ae9ed
 [vcpu libvirt-id='13']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22136'
6ae9ed
 [vcpu libvirt-id='14']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22137'
6ae9ed
 [vcpu libvirt-id='15']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22138'
6ae9ed
 [vcpu libvirt-id='16']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22223'
6ae9ed
     qemu-id='3'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
@@ -47,16 +81,30 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu1'
6ae9ed
     topology: core='16' vcpus='8'
6ae9ed
 [vcpu libvirt-id='17']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22224'
6ae9ed
 [vcpu libvirt-id='18']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22225'
6ae9ed
 [vcpu libvirt-id='19']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22226'
6ae9ed
 [vcpu libvirt-id='20']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22227'
6ae9ed
 [vcpu libvirt-id='21']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22228'
6ae9ed
 [vcpu libvirt-id='22']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22229'
6ae9ed
 [vcpu libvirt-id='23']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22230'
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data
6ae9ed
index 22a425d..d2c56ef 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-hotplug-4.data
6ae9ed
@@ -1,24 +1,42 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21925'
6ae9ed
     qemu-id='1'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[1]'
6ae9ed
     topology: core='0' vcpus='8'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21926'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21927'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21928'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21930'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21931'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21932'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='21933'
6ae9ed
 [vcpu libvirt-id='8']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23170'
6ae9ed
     qemu-id='3'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
@@ -26,20 +44,36 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu0'
6ae9ed
     topology: core='8' vcpus='8'
6ae9ed
 [vcpu libvirt-id='9']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23171'
6ae9ed
 [vcpu libvirt-id='10']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23172'
6ae9ed
 [vcpu libvirt-id='11']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23173'
6ae9ed
 [vcpu libvirt-id='12']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23174'
6ae9ed
 [vcpu libvirt-id='13']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23175'
6ae9ed
 [vcpu libvirt-id='14']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23176'
6ae9ed
 [vcpu libvirt-id='15']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='23177'
6ae9ed
 [vcpu libvirt-id='16']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22741'
6ae9ed
     qemu-id='2'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
@@ -47,16 +81,30 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu1'
6ae9ed
     topology: core='16' vcpus='8'
6ae9ed
 [vcpu libvirt-id='17']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22742'
6ae9ed
 [vcpu libvirt-id='18']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22743'
6ae9ed
 [vcpu libvirt-id='19']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22744'
6ae9ed
 [vcpu libvirt-id='20']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22745'
6ae9ed
 [vcpu libvirt-id='21']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22746'
6ae9ed
 [vcpu libvirt-id='22']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22747'
6ae9ed
 [vcpu libvirt-id='23']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='22748'
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data
6ae9ed
index d7ab77b..c2f541b 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-ppc64-no-threads.data
6ae9ed
@@ -1,72 +1,104 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35232'
6ae9ed
     qemu-id='1'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[1]'
6ae9ed
     topology: core='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35233'
6ae9ed
     qemu-id='2'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[2]'
6ae9ed
     topology: core='8' vcpus='1'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35234'
6ae9ed
     qemu-id='3'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[3]'
6ae9ed
     topology: core='16' vcpus='1'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35235'
6ae9ed
     qemu-id='4'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[4]'
6ae9ed
     topology: core='24' vcpus='1'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35236'
6ae9ed
     qemu-id='5'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[5]'
6ae9ed
     topology: core='32' vcpus='1'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35237'
6ae9ed
     qemu-id='6'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[6]'
6ae9ed
     topology: core='40' vcpus='1'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35238'
6ae9ed
     qemu-id='7'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[7]'
6ae9ed
     topology: core='48' vcpus='1'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='35239'
6ae9ed
     qemu-id='8'
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     qom_path='/machine/unattached/device[8]'
6ae9ed
     topology: core='56' vcpus='1'
6ae9ed
 [vcpu libvirt-id='8']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='64' vcpus='1'
6ae9ed
 [vcpu libvirt-id='9']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='72' vcpus='1'
6ae9ed
 [vcpu libvirt-id='10']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='80' vcpus='1'
6ae9ed
 [vcpu libvirt-id='11']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='88' vcpus='1'
6ae9ed
 [vcpu libvirt-id='12']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='96' vcpus='1'
6ae9ed
 [vcpu libvirt-id='13']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='104' vcpus='1'
6ae9ed
 [vcpu libvirt-id='14']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='112' vcpus='1'
6ae9ed
 [vcpu libvirt-id='15']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='host-spapr-cpu-core'
6ae9ed
     topology: core='120' vcpus='1'
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data
6ae9ed
index a367a09..67dfc01 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-basic-pluggable.data
6ae9ed
@@ -1,39 +1,55 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='518291'
6ae9ed
     qemu-id='1'
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     qom_path='/machine/unattached/device[0]'
6ae9ed
     topology: socket='0' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='518292'
6ae9ed
     qemu-id='2'
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     qom_path='/machine/unattached/device[2]'
6ae9ed
     topology: socket='0' core='0' thread='1' vcpus='1'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='518294'
6ae9ed
     qemu-id='3'
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     qom_path='/machine/unattached/device[3]'
6ae9ed
     topology: socket='0' core='1' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='518295'
6ae9ed
     qemu-id='4'
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     qom_path='/machine/unattached/device[4]'
6ae9ed
     topology: socket='0' core='1' thread='1' vcpus='1'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='518296'
6ae9ed
     qemu-id='5'
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     qom_path='/machine/unattached/device[5]'
6ae9ed
     topology: socket='1' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     topology: socket='1' core='0' thread='1' vcpus='1'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     topology: socket='1' core='1' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=no
6ae9ed
+    hotpluggable=yes
6ae9ed
     type='qemu64-x86_64-cpu'
6ae9ed
     topology: socket='1' core='1' thread='1' vcpus='1'
6ae9ed
diff --git a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data
6ae9ed
index a6c1069..dba3745 100644
6ae9ed
--- a/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data
6ae9ed
+++ b/tests/qemumonitorjsondata/qemumonitorjson-cpuinfo-x86-full.data
6ae9ed
@@ -1,10 +1,14 @@
6ae9ed
 [vcpu libvirt-id='0']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=no
6ae9ed
     thread-id='895040'
6ae9ed
     qemu-id='1'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
     qom_path='/machine/unattached/device[0]'
6ae9ed
     topology: socket='0' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='1']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895056'
6ae9ed
     qemu-id='2'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -12,6 +16,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu1'
6ae9ed
     topology: socket='1' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='2']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895057'
6ae9ed
     qemu-id='3'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -19,6 +25,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu2'
6ae9ed
     topology: socket='2' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='3']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895058'
6ae9ed
     qemu-id='4'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -26,6 +34,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu3'
6ae9ed
     topology: socket='3' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='4']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895059'
6ae9ed
     qemu-id='5'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -33,6 +43,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu4'
6ae9ed
     topology: socket='4' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='5']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895060'
6ae9ed
     qemu-id='6'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -40,6 +52,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu5'
6ae9ed
     topology: socket='5' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='6']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895061'
6ae9ed
     qemu-id='7'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -47,6 +61,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu6'
6ae9ed
     topology: socket='6' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='7']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895062'
6ae9ed
     qemu-id='8'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -54,6 +70,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu7'
6ae9ed
     topology: socket='7' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='8']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895063'
6ae9ed
     qemu-id='9'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -61,6 +79,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu8'
6ae9ed
     topology: socket='8' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='9']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895064'
6ae9ed
     qemu-id='10'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
@@ -68,6 +88,8 @@
6ae9ed
     qom_path='/machine/peripheral/vcpu9'
6ae9ed
     topology: socket='9' core='0' thread='0' vcpus='1'
6ae9ed
 [vcpu libvirt-id='10']
6ae9ed
+    online=yes
6ae9ed
+    hotpluggable=yes
6ae9ed
     thread-id='895065'
6ae9ed
     qemu-id='11'
6ae9ed
     type='Broadwell-x86_64-cpu'
6ae9ed
diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c
6ae9ed
index 0410630..e418557 100644
6ae9ed
--- a/tests/qemumonitorjsontest.c
6ae9ed
+++ b/tests/qemumonitorjsontest.c
6ae9ed
@@ -2357,6 +2357,9 @@ testQemuMonitorCPUInfoFormat(qemuMonitorCPUInfoPtr vcpus,
6ae9ed
         virBufferAsprintf(&buf, "[vcpu libvirt-id='%zu']\n", i);
6ae9ed
         virBufferAdjustIndent(&buf, 4);
6ae9ed
 
6ae9ed
+        virBufferAsprintf(&buf, "online=%s\n", vcpu->online ? "yes" : "no");
6ae9ed
+        virBufferAsprintf(&buf, "hotpluggable=%s\n", vcpu->hotpluggable ? "yes" : "no");
6ae9ed
+
6ae9ed
         if (vcpu->tid)
6ae9ed
             virBufferAsprintf(&buf, "thread-id='%llu'\n",
6ae9ed
                               (unsigned long long) vcpu->tid);
6ae9ed
-- 
6ae9ed
2.10.0
6ae9ed