1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| import libvirt
conn = libvirt.open('qemu:///system')
for id in conn.listDomainsID():
dom = conn.lookupByID(id)
print "Dom %s State %s" % ( dom.name(), dom.info()[0] )
dom.suspend()
print "Dom %s State %s (after suspend)" % ( dom.name(), dom.info()[0] )
dom.resume()
print "Dom %s State %s (after resume)" % ( dom.name(), dom.info()[0] )
dom.destroy()
|