[libvirt] [PATCHv4] qemu: Implement bulk stats API and one of the stats groups to return

Eric Blake eblake at redhat.com
Thu Aug 28 12:48:41 UTC 2014


On 08/28/2014 06:18 AM, Peter Krempa wrote:
> Implement the API function for virDomainListGetStats and
> virConnectGetAllDomainStats in a modular way and implement the
> VIR_DOMAIN_STATS_STATE group of statistics.
> 
> Although it may look like the function looks universal I'd rather not
> expose it to other drivers as the coming stats groups are likely to do
> qemu specific stuff to obtain the stats.
> ---
> 
> Notes:
>     Version 4:
>     - fixed handling and error checking of @stats
>     - domain filtering flags are now rejected when passing in a domain list

Looks nicer.  Thanks for putting up with me.


> +static int
> +qemuDomainGetStats(virConnectPtr conn,
> +                   virDomainObjPtr dom,

> +
> +    for (i = 0; qemuDomainGetStatsWorkers[i].func; i++) {
> +        if (stats & qemuDomainGetStatsWorkers[i].stats) {
> +            if (qemuDomainGetStatsWorkers[i].func(dom, tmp, &maxparams,

These two if's could be combined into one with &&, for one less level of
indentation (but I'm also okay if you leave it alone).

> +                                                  flags) < 0)
> +                goto cleanup;
> +        }
> +    }
> +
> +    if (!(tmp->dom = virGetDomain(conn, dom->def->name, dom->def->uuid)))

Earlier versions had a comment about doing dom last for a reason.  Not
sure if you want to reinstate it; I can live without it.


> +}
> +
> +
> +
> +static int
> +qemuConnectGetAllDomainStats(virConnectPtr conn,

3 blank lines is unusual.

ACK.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

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


More information about the libvir-list mailing list