[libvirt] [PATCH 1/8] qemu: bulk stats: extend internal collection API

Peter Krempa pkrempa at redhat.com
Tue Sep 9 12:14:23 UTC 2014


On 09/08/14 15:05, Francesco Romani wrote:
> Future patches which will implement more
> bulk stats groups for QEMU will need to access
> the connection object.
> 
> To accomodate that, a few changes are needed:
> 
> * enrich internal prototype to pass connection object.
> * add per-group flag to mark if one collector needs
>   monitor access or not.
> * if at least one collector of the requested stats
>   needs monitor access, thus we must start a query job
>   for each domain. The specific collectors will
>   run nested monitor jobs inside that.
> 
> Signed-off-by: Francesco Romani <fromani at redhat.com>
> ---
>  src/qemu/qemu_driver.c | 51 ++++++++++++++++++++++++++++++++++++++++++--------
>  1 file changed, 43 insertions(+), 8 deletions(-)
> 
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index d724eeb..2950a4b 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c

> @@ -17338,7 +17339,8 @@ qemuDomainGetStatsState(virDomainObjPtr dom,
>  
>  
>  typedef int
> -(*qemuDomainGetStatsFunc)(virDomainObjPtr dom,
> +(*qemuDomainGetStatsFunc)(virConnectPtr conn,

Looking through the rest of the series. Rather than the complete
connection object you need just the virQEMUDriverPtr for entering the
monitor, but I can live with this.


> +                          virDomainObjPtr dom,
>                            virDomainStatsRecordPtr record,
>                            int *maxparams,
>                            unsigned int flags);
>  
>  

> @@ -17483,11 +17503,21 @@ qemuConnectGetAllDomainStats(virConnectPtr conn,
>              !virConnectGetAllDomainStatsCheckACL(conn, dom->def))
>              continue;
>  
> -        if (qemuDomainGetStats(conn, dom, stats, &tmp, flags) < 0)
> +        if (needmon && qemuDomainObjBeginJob(driver, dom, QEMU_JOB_QUERY) < 0)
>              goto cleanup;
>  
> -        if (tmp)
> -            tmpstats[nstats++] = tmp;
> +        if ((needmon && virDomainObjIsActive(dom)) || !needmon) {

Hmm this skips offline domains entirely if one of the stats groups needs
the monitor.

I think we should rather skip individual stats groups, or better stats
fields that we can't provide.

Any ideas?


> +            if (qemuDomainGetStats(conn, dom, stats, &tmp, flags) < 0)
> +                goto endjob;
> +
> +            if (tmp)
> +                tmpstats[nstats++] = tmp;
> +        }
> +
> +        if (needmon && !qemuDomainObjEndJob(driver, dom)) {
> +            dom = NULL;
> +            goto cleanup;
> +        }
>  
>          virObjectUnlock(dom);
>          dom = NULL;

Peter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140909/05a8c8e8/attachment-0001.sig>


More information about the libvir-list mailing list