[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
原文链接:https://www.cnblogs.com/bass6/p/5645197.html
本文来源 爱码网,其版权均为 原网址 所有 与本站无关,文章内容系作者个人观点,不代表 本站 对观点赞同或支持。如需转载,请注明文章来源。
© 版权声明
文章版权归作者所有,未经允许请勿转载。