Daniel P. Berrange schreef:
In the case of the Xen drivers, this requires O(n) calls to XenD
which
are rather expensive. XenD does actually have ability to return data about
all domains in a single request. So if we had an API for fetching all
domains at once it'd only require O(1) expensive XenD calls. I'd imagine
something like this
int virConnectListAllDomains(virConnectPtr conn,
virDomainPtr **domains,
int stateflags);
The 'stateflags' parameter would be a bit-field where each bit corresponded
to one of the virDomainState enumeration values. The 'domains' list would
be allocated by libvirt, and filled in with all the domain objects, and
the total number of domains as the return value.
Yes; initially I was looking for something like this. I think this is a
great idea. Now I wonder, if it could be faster (with the lookup
mechanism) to check if the domain exists, before connecting to it.
Stefan