arpita k
2011-Feb-10 12:09 UTC
[libvirt-users] How to retrieve Memory stat of the KVM using python binding with Libvirt API
Hi , I am using ubuntu host machine and KVM is present as guest in that machine.Two virtual machines are there.I am using Python binding to query on the hypervisor and extract the VM related information.I like to print memory stat of the VM like SWAP_IN , SWAP_OUT,free memory, mem cached etc.So, the code, I have written for this, is : #!/usr/local/bin/python import libvirt import sys conn = libvirt.openReadOnly(None) if conn == None: print "Failed to open connection to the hypervisor" sys.exit(1) try: domIds = conn.listDomainsID() for id in domIds: dom0 = conn.lookupByID(id) try: print "memory stats: %s"% dom0.memoryStats().values() except: print 'Failed to find the memory data of this domain' sys.exit(1) except: print 'Failed to find the main domain' sys.exit(1) But this code 'dom0.memoryStats().values()' is returning empty list.I need to collect more information regarding the memory .How should I proceed? Regards, Arpita -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20110210/9969d4cc/attachment.htm>