[libvirt] [RFC][scale] new API for querying domains stats

Li Wei lw at cn.fujitsu.com
Mon Aug 4 03:38:41 UTC 2014


Hi,

On 07/22/2014 03:25 PM, Richard W.M. Jones wrote:
> 
> Did anything come of this discussion, and/or is someone working on this?

I am working on an API to query block stats in a bulk style and proposed an
API as follow:

virDomainBlockStatsBulkFlags(virDomainPtr dom,
			     virTypedParameterPtr params,
			     int nparams,
			     int ndisks,
			     unsigned int flags)

@dom: pointer to domain object
@params: an array of typed param to be populated with block stats
@nparams: how many params used for each block device
@ndisks: how many block devices to query
@flags: flags to filter block devices (not used for now)

Returns -1 in case of error, 0 in case of success.
with params == NULL, nparams == -1, ndisks == 1, return number of params for each block device.
with params == NULL, nparams == -1, ndisks == -1, return number of disks in the domain.

A typical usage of this API should be:
nparams = virDomainBlockStatsBulkFlags(dom, NULL, -1, 1, 0);
ndisks = virDomainBlockStatsBulkFlags(dom, NULL, -1, -1, 0);

params = VIR_ALLOC_N(params, nparams * ndisks);

ret = virDomainBlockStatsBulkFlags(dom, params, nparams, ndisks, 0);

... do something with params

VIR_FREE(params);

With this bulk API, virt-top can updates in a short interval for a domain with a lot of disks.
Any comments?

PS:
It seems we need a bunch of bulk APIs to query stats, I wonder if I can submit a patchset for each
bulk API or must supply all the bulk APIs in one patchset?

Thanks,
Li Wei


> 
> Rich.
> 




More information about the libvir-list mailing list