Re: [PATCH 3/4] qemu: monitor: Add vcpu state information to monitor data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]