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

Eric Blake eblake at redhat.com
Thu Jul 3 19:42:36 UTC 2014


On 07/01/2014 02:35 AM, Daniel P. Berrange wrote:

> 1. A custom callback to run per API
> 
>      typedef (void)(*virDomainBlockInfoCallback)(virDomainPtr dom,
>                                                  bool isError,
>                                                  virDomainBlockInfoPtr info,
>                                                  void *opaque);
> 

It might be nice to require the callback to return an int; 0 to keep
going, non-zero to stop immediately.

>     int virDomainGetBlockInfoAsync(virDomainPtr dom,
>                                    const char *disk,
>                                    virDomainBlockInfoCallback cb,
>                                    void *opaque,
>                                    unsigned int flags);

What should this function return on success, 0 or the number of times
the callback was reached?  However, even if we add a callback return
value (non-zero to quit immediately), I don't think feeding it directly
to the return value is nice; we still want to reserve negative values
for errors (couldn't even invoke callbacks, perhaps because dom was a
bad pointer).  Besides, a user can always use opaque to collect counts
of how many times the callback was invoked, and/or a specific return
value on early exit.


-- 
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: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140703/4fdd00c7/attachment-0001.sig>


More information about the libvir-list mailing list