[libvirt] [PATCH 3/4] qemu: monitor: Add vcpu state information to monitor data
Pavel Hrdina
phrdina at redhat.com
Wed Sep 14 08:37:36 UTC 2016
On Tue, Sep 13, 2016 at 06:27:45PM +0200, Peter Krempa wrote:
> 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.
> ---
> src/qemu/qemu_monitor.c | 11 +++++
> 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, 280 insertions(+)
>
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index 4489997..e700b15 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -1773,6 +1773,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;
> @@ -1816,6 +1817,10 @@ 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;
> + if (!vcpus[mastervcpu].online)
> + vcpus[mastervcpu].hotpluggable = true;
This could be merged together:
vcpus[mastervcpu].hotpluggable = !!hotplugvcpus[i].alias ||
!vcpus[mastervcpu].online
ACK
Pavel
More information about the libvir-list
mailing list