On Mon, Aug 04, 2014 at 11:38:41AM +0800, Li Wei wrote:
> 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?

I think this works OK for the case where you have 1 domains with
lots of disks.

However if you have a large number of domains each with 1 or 2
disks I think you would have the same problem as currently.

Is it possible to design an API that can work across all domains
in a single call?

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

Whichever is easiest to review.  I suspect that smaller patches, each
containing a single new API, will be simpler to review, but that's
just my opinion.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to