[libvirt] Just to make sure I understand the API

Maximilian Wilhelm max at rfc2324.org
Mon Jan 11 18:22:29 UTC 2010

Anno domini 2010 Daniel P. Berrange scripsit:


> > Yes, that's the correct behavior of these functions.
> > virConnectListDefinedDomains list domains that are inactive but
> > defined and virConnectListDomains lists domains that are active.

> > If you combine the output of both functions then you get the complete
> > list of domains libvirt knows about for a given host.

> Modulo the obvious race condition where a guest starts/stops in between
> the time you call those two functions :-)

> One of these days I'll have time to add an API I've long wanted - one
> that lists all domains, and returns the virDomainPtr objects directly

>   virConnectListAllDomains(virConnectPtr conn, virDomainPtr *domains, int *ndomains);

> where libvirt allocates 'domains' to be the right size, not requiring
> the caller todo so. Similarly this same API pattern for all other objects
> virNetworkPtr, virStoragePoolPtr, etc, etc

This would be _really_ appreciated :)

Eine Freie Meinung in einem Freien Kopf
für einen Freien Staat voll Freier Bürger.

More information about the libvir-list mailing list