[libvirt] PATCH: Fix python binding for listing storage pools/volumes

The python binding for the APIs to list storage pools and volumes has a hand written C layer, but an auto-generated python layer. The latter was auto-generating incorrectly, so this patch overrides its API contract making the generator work correctly. Dan. Index: libvirt-python-api.xml =================================================================== RCS file: /data/cvs/libvirt/python/libvirt-python-api.xml,v retrieving revision 1.12 diff -u -r1.12 libvirt-python-api.xml --- libvirt-python-api.xml 14 Mar 2008 11:08:03 -0000 1.12 +++ libvirt-python-api.xml 23 May 2008 15:15:55 -0000 @@ -110,5 +110,20 @@ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='params' type='virSchedParameterPtr' info='pointer to scheduler parameter objects'/> </function> + <function name='virConnectListStoragePools' file='python'> + <info>list the storage pools, stores the pointers to the names in @names</info> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + <return type='str *' info='the list of Names of None in case of error'/> + </function> + <function name='virConnectListDefinedStoragePools' file='python'> + <info>list the defined storage pool, stores the pointers to the names in @names</info> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + <return type='str *' info='the list of Names of None in case of error'/> + </function> + <function name='virStoragePoolListVolumes' file='python'> + <info>list the storage volumes, stores the pointers to the names in @names</info> + <arg name='pool' type='virStoragePoolPtr' info='pointer to the storage pool'/> + <return type='str *' info='the list of Names of None in case of error'/> + </function> </symbols> </api> -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, May 23, 2008 at 04:17:26PM +0100, Daniel P. Berrange wrote:
The python binding for the APIs to list storage pools and volumes has a hand written C layer, but an auto-generated python layer. The latter was auto-generating incorrectly, so this patch overrides its API contract making the generator work correctly.
The getinfo APIs need overriding too... Index: libvirt-python-api.xml =================================================================== RCS file: /data/cvs/libvirt/python/libvirt-python-api.xml,v retrieving revision 1.12 diff -u -r1.12 libvirt-python-api.xml --- libvirt-python-api.xml 14 Mar 2008 11:08:03 -0000 1.12 +++ libvirt-python-api.xml 23 May 2008 15:29:01 -0000 @@ -110,5 +110,30 @@ <arg name='domain' type='virDomainPtr' info='pointer to domain object'/> <arg name='params' type='virSchedParameterPtr' info='pointer to scheduler parameter objects'/> </function> + <function name='virConnectListStoragePools' file='python'> + <info>list the storage pools, stores the pointers to the names in @names</info> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + <return type='str *' info='the list of Names of None in case of error'/> + </function> + <function name='virConnectListDefinedStoragePools' file='python'> + <info>list the defined storage pool, stores the pointers to the names in @names</info> + <arg name='conn' type='virConnectPtr' info='pointer to the hypervisor connection'/> + <return type='str *' info='the list of Names of None in case of error'/> + </function> + <function name='virStoragePoolListVolumes' file='python'> + <info>list the storage volumes, stores the pointers to the names in @names</info> + <arg name='pool' type='virStoragePoolPtr' info='pointer to the storage pool'/> + <return type='str *' info='the list of Names of None in case of error'/> + </function> + <function name='virStoragePoolGetInfo' file='python'> + <info>Extract information about a storage pool. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> + <return type='int *' info='the list of information or None in case of error'/> + <arg name='pool' type='virStoragePoolPtr' info='a storage pool object'/> + </function> + <function name='virStorageVolGetInfo' file='python'> + <info>Extract information about a storage pool. Note that if the connection used to get the domain is limited only a partial set of the information can be extracted.</info> + <return type='int *' info='the list of information or None in case of error'/> + <arg name='vol' type='virStorageVolPtr' info='a storage vol object'/> + </function> </symbols> </api> -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Fri, May 23, 2008 at 04:29:59PM +0100, Daniel P. Berrange wrote:
On Fri, May 23, 2008 at 04:17:26PM +0100, Daniel P. Berrange wrote:
The python binding for the APIs to list storage pools and volumes has a hand written C layer, but an auto-generated python layer. The latter was auto-generating incorrectly, so this patch overrides its API contract making the generator work correctly.
The getinfo APIs need overriding too...
Looks fine, so we added to the C module but didn't override in the XML, right ? Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

On Wed, May 28, 2008 at 10:12:42AM -0400, Daniel Veillard wrote:
On Fri, May 23, 2008 at 04:29:59PM +0100, Daniel P. Berrange wrote:
On Fri, May 23, 2008 at 04:17:26PM +0100, Daniel P. Berrange wrote:
The python binding for the APIs to list storage pools and volumes has a hand written C layer, but an auto-generated python layer. The latter was auto-generating incorrectly, so this patch overrides its API contract making the generator work correctly.
The getinfo APIs need overriding too...
Looks fine, so we added to the C module but didn't override in the XML, right ?
Yes, I missed it because the generator was quite happy generating code for them. I just didn't notice the code it was generating was broken ! Dan -- |: Red Hat, Engineering, Boston -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
participants (2)
-
Daniel P. Berrange
-
Daniel Veillard