[libvirt] RFE: virConnectListAllDomains()

dennis jenkins dennis.jenkins.75 at gmail.com
Sat May 19 15:47:36 UTC 2012


On Fri, May 18, 2012 at 6:52 PM, Eric Blake <eblake at redhat.com> wrote:

> Use of virConnectListDomains() and virConnectListDefinedDomains() is:
>
> 1. inherently racy.  A domain can change between active and inactive
> between two back-to-back calls, and thus be entirely skipped or
> enumerated twice when concatenating lists.
>
> 2. painful to use.  ListDomains gives ids, ListDefinedDomains gives
> names, and the user must then call virDomainLookupByID() and
> virDomainLookupByName() to convert into UUIDs.
>
> 3. requires pre-allocation.  The user must call virConnectNumOfDomains()
> then over-allocate before calling virConnectListDomains(), in order to
> guarantee that the list size didn't change between the two calls.
>
> This is a proposal for a new API that addresses all three points - by
> returning virDomainPtr rather than id or strings, the UUID of each
> domain can be grabbed in one shot.  By consolidating things into a
> single API call, there is no race in trying to piece together the
> complete list.  By having libvirt allocate the resulting array, rather
> than making the caller pre-allocate, the user doesn't have to worry
> about a race between getting a count and using that count.  It also
> provides the convenience of returning smaller lists based on various
> filtering groups.
>
> Thoughts before I expand this API and add the actual implementation?
>
>
>
Very nice idea.  Will the perl wrapper, Sys-Virt, be updated to expose this
new C api?



>
> --
> Eric Blake   eblake at redhat.com    +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
>
>
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120519/36d279e2/attachment-0001.htm>


More information about the libvir-list mailing list