[libvirt-users] listing active and defined vs inactive and defined domains

John Wayne m01z04-libvirt at yahoo.com
Sat May 5 05:10:40 UTC 2012


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} 




More information about the libvirt-users mailing list