John Wayne
2012-May-07 05:28 UTC
[libvirt-users] libvirt python api for storage-volumes and storage-pools
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 thanks
Alex Jia
2012-May-07 05:54 UTC
[libvirt-users] libvirt python api for storage-volumes and storage-pools
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-listI 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) >>>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 python's help() to see it such as help(con.listStoragePools) and help(libvirt.virStoragePool.listVolumes), '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