Re: [PATCH 2/5] qemu: Add monitor APIs for the detection of halted VCPUs

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

 



On Thu, Jul 14, 2016 at 16:35:39 +0200, Viktor Mihajlovski wrote:
> New monitor function qemuMonitorGetCPUState added to retrieve the
> halted state of VCPUs via the query-cpus command.
> 
> Signed-off-by: Viktor Mihajlovski <mihajlov@xxxxxxxxxxxxxxxxxx>
> Reviewed-by: Bjoern Walk <bwalk@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Boris Fiuczynski <fiuczy@xxxxxxxxxxxxxxxxxx>
> ---
>  src/qemu/qemu_monitor.c      | 22 ++++++++++++++++++
>  src/qemu/qemu_monitor.h      |  2 ++
>  src/qemu/qemu_monitor_json.c | 52 ++++++++++++++++++++++++++++++++++++++----
>  src/qemu/qemu_monitor_json.h |  2 ++
>  src/qemu/qemu_monitor_text.c | 54 +++++++++++++++++++++++++++++++++++---------
>  src/qemu/qemu_monitor_text.h |  2 ++
>  6 files changed, 119 insertions(+), 15 deletions(-)
> 
> diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
> index 098e654..0fdee29 100644
> --- a/src/qemu/qemu_monitor.c
> +++ b/src/qemu/qemu_monitor.c
> @@ -1667,6 +1667,28 @@ qemuMonitorGetCPUInfo(qemuMonitorPtr mon,
>  }
>  
>  
> +/**
> + * qemuMonitorGetCPUState:
> + * @mon: monitor
> + * @halted: returned array of boolean containing the vCPUs halted state
> + *
> + * Detects whether vCPUs are halted. Returns count of detected vCPUs on success,
> + * 0 if qemu didn't report vcpus (does not report libvirt error),
> + * -1 on error (reports libvirt error).
> + */
> +int
> +qemuMonitorGetCPUState(qemuMonitorPtr mon,
> +                       bool **halted)

Extraction of the data is cheap compared to calling the monitor. Also
this adds a lot of duplicated code. I've merged this to the code
returnign the thread ids and dropped the duplicate monitor helpers.

I've kept the extraction code though.

Peter

--
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]