[[email protected] Desktop]# cat demo.py #!/usr/bin/python import libvirt conn = libvirt.open("qemu:///system") for id in conn.listDomainsID(): dom = conn.lookupByID(id) infos = dom.info() print "" print "ID = %d" % id print "Name = %s" %dom.name() print "State = %d" % infos[0] print ""
[[email protected] Desktop]# ./demo.py ID = 1 Name = win7 State = 1 ID = 2 Name = centos02 State = 1 ID = 4 Name = 12c State = 1
时间: 2024-10-11 22:01:39