Blob Blame History Raw
From 2f158bf21cf944a1c6ec6a3498cf702a9e6be161 Mon Sep 17 00:00:00 2001
Message-Id: <2f158bf21cf944a1c6ec6a3498cf702a9e6be161@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Wed, 14 Sep 2016 13:04:22 +0200
Subject: [PATCH] qemu: monitor: Add vcpu state information to monitor data

https://bugzilla.redhat.com/show_bug.cgi?id=1375783

Return whether a vcpu entry is hotpluggable or online so that upper
layers don't have to infer the information from other data.

Advantage is that this code can be tested by unit tests.

(cherry picked from commit 2a0e68be9185eecb9207ebdfdc4f8f0933f38bb3)
---
 src/qemu/qemu_monitor.c                            | 10 +++++
 src/qemu/qemu_monitor.h                            |  4 ++
 .../qemumonitorjson-cpuinfo-ppc64-basic.data       | 48 ++++++++++++++++++++++
 .../qemumonitorjson-cpuinfo-ppc64-hotplug-1.data   | 48 ++++++++++++++++++++++
 .../qemumonitorjson-cpuinfo-ppc64-hotplug-2.data   | 48 ++++++++++++++++++++++
 .../qemumonitorjson-cpuinfo-ppc64-hotplug-4.data   | 48 ++++++++++++++++++++++
 .../qemumonitorjson-cpuinfo-ppc64-no-threads.data  | 32 +++++++++++++++
 ...emumonitorjson-cpuinfo-x86-basic-pluggable.data | 16 ++++++++
 .../qemumonitorjson-cpuinfo-x86-full.data          | 22 ++++++++++
 tests/qemumonitorjsontest.c                        |  3 ++
 10 files changed, 279 insertions(+)

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