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
signature.asc
Description: OpenPGP digital signature
-- libvir-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/libvir-list
