查看运行的KVM的虚机
[root@ok 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 ""
[root@ok Desktop]# ./demo.py ID = 1 Name = win7 State = 1 ID = 2 Name = centos02 State = 1 ID = 4 Name = 12c State = 1
联系方式QQ:326528263 EMAIL:clnking@163.com 网名:bass 分享技术 突破难点 创新思维