John Wayne
2012-May-05 05:10 UTC
[libvirt-users] listing active and defined vs inactive and defined domains
i am trying to list active + defined and inactive + defined domains using libvirt 0.9.4 i can get active domains using: def s_activedomains(conn): #get active domain ids numofdomains=libvirt.virConnect.numOfDomains(conn) activedomains=libvirt.virConnect.listDomainsID(conn) return activedomains i am stuck on how to get inactive domains the example listed here?http://libvirt.org/guide/html/Application_Development_Guide-Guest_Domains-Listing.html under example 4.4 and example 4.5 seems to be outdated looking at?/usr/lib64/python2.6/site-packages/libvirt.py, line 2337 says that "Note that this won't work for inactive domains which have an ID of -1" i think example 4.5 is wrong because if inactive domains have an id of -1, then i can't call?virDomainLookupBy{Name,ID}?
Eric Blake
2012-May-10 23:17 UTC
[libvirt-users] listing active and defined vs inactive and defined domains
On 05/04/2012 11:10 PM, John Wayne wrote:> i am trying to list active + defined and inactive + defined domains using libvirt 0.9.4 > i can get active domains using: > > def s_activedomains(conn): > #get active domain ids > numofdomains=libvirt.virConnect.numOfDomains(conn) > activedomains=libvirt.virConnect.listDomainsID(conn) > return activedomains > > i am stuck on how to get inactive domainsvirConnect.numOfDefinedDomains(conn) virConnect.listDefinedDomains(conn) then convert with virDomainLookupByName I still want to add a new API that returns a filterable list of ALL domains in one API, where the return is virDomainPtr rather than id or name (basically, a virDomainPtr is name, id, and uuid all rolled into one struct), and where you can use flags to filter the list (active only, inactive only, transient only, persistent only, and possibly other useful filters). Too late for 0.9.12, but should hit in 0.9.13... -- Eric Blake eblake at 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: 620 bytes Desc: OpenPGP digital signature URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120510/8a5d62a7/attachment.sig>