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

John Wayne m01z04-libvirt at yahoo.com
Mon May 7 06:53:00 UTC 2012


----- Original Message -----
From: Alex Jia <ajia at redhat.com>
To: John Wayne <m01z04-libvirt at yahoo.com>
Cc: "libvirt-users at redhat.com" <libvirt-users at redhat.com>
Sent: Sunday, May 6, 2012 10:54 PM
Subject: Re: [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-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 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

More information about the libvirt-users mailing list