[libvirt-users] libvirt python api for storage-volumes and storage-pools

Alex Jia ajia at redhat.com
Mon May 7 05:54:56 UTC 2012

On 05/07/2012 01:28 PM, John Wayne wrote:
> hi,
> how do i list storage pools and volumes using the python bindings?
> basically the python api calls for virsh pool-list and virsh vol-list
I think I have answered your question in previous mail:

You may use 'dir' to list all of class/method of libvirt/sub-class:
 >>> import libvirt
 >>> con = libvirt.open(None)
 >>> dir(con)
 >>>dir(libvirt. virConnect)

s/virConnect/virStoragePool/ to list all of methods of a pool,
and s/virConnect/virStorageVol/ to list all of methods of a volume.

If you don't know how to pass a arguments to above methods, please use 
help() to see it such as help(con.listStoragePools) and 
'dir' and 'help' are a python built-in method, which hasn't any 
relationship with libvirt.
so it doesn't matter if you don't familiar with libvirt.
> thanks
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users

More information about the libvirt-users mailing list