How to use Python Binding with Lbivirt.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
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.
 
Here is my  simple code:
 

#!/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)

dom0.info()

print "Domain 0: id %d running %s" % (dom0.ID(), dom0.OSType())

print dom0.info()   

except:

print 'Failed to find the main domain'

sys.exit(

)
The output is :
 
Domain 0: id 2 running hvm
[1, 131072L, 131072L, 1, 14921710000000L]
Domain 0: id 3 running hvm
[1, 131072L, 131072L, 1, 30880000000L]
 
Here I am not able to understand these values are represent what type of information, which value is representing what resource of host machine.Could you please help me to understand how I could find out CPU,VM ,memory related information seperately through python binding?.
I didn't find Python binding Reference in the Libvirt site.Could you help me by providing the Reference link for Python binding?
 
Thanks in Advance!!
 
Arpita

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux