On 02/22/2011 08:49 AM, Lyre wrote:
From my understanding virConnectListActiveDomains() is listing all
the active (running) domains and virConnectListDefinedDomains() is
listing all the inactive domains that are defined since if we
create a domain directly from XML, i.e. non-persistent, we have
the domain in active domains list but it's not defined. Only
inactive but defined domains are in the defined list AFAIK.
I can't find the function virConnectListActiveDomains(), did you mean
virConnectListActiveDomains()?
Oh, sorry. It's called virConnectListDomains() in libvirt: Collect the
list of active domains, and store their ID in @maxids. So that's why I
rewrote it to lookup domain by ID and get the domain name to add to the
list. I did rewrite some codes there and also I'm thinking of adding
comments there. This will be later used to generate API documentation
for the site.
If we have 2 domains created *directly* from XML file, 3
persistent domains active and 4 domains inactive (but defined) we
should be getting number 5 from virConnectListActiveDomains()
since 2 + 3. For defined (inactive) domains we should be getting
number for and total number should be 2 + 3 + 4 = 9 domains.
Confused, do you missed some words?
I apologize. I made a typo there since I meant "For defined (inactive)
domains we should be getting number four (4)".
Shouldn't it be:
2 active but not defined
3 active but defined
4 inactive and defined
2 + 3 = 5 active
3 + 4 = 7 defined
2 + 3 + 4 = 9 total
Well, from what I know defined domains are those that are both defined
and *not* active as written at [1]: "Provides the number of defined but
inactive domains.". Please note "but inactive". So therefore defined is
returns number 4.
Michal
[1]
http://libvirt.org/html/libvirt-libvirt.html#virConnectNumOfDefinedDomains
--
Michal Novotny<minovotn(a)redhat.com>, RHCE
Virtualization Team (xen userspace), Red Hat