[libvirt] [PATCH] Fix python error reporting for some storage operations

Cole Robinson crobinso at redhat.com
Mon Aug 11 19:58:55 UTC 2008


In the python bindings, all vir* classes expect to be
passed a virConnect object when instantiated. Before
the storage stuff, these classes were only instantiated
in virConnect methods, so the generator is hardcoded to
pass 'self' as the connection instance to these classes.

Problem is there are some methods that return pool or vol
instances which aren't called from virConnect: you can
lookup a storage volume's associated pool, and can lookup
volumes from a pool. In these cases passing 'self' doesn't
give the vir* instance a connection, so when it comes time
to raise an exception crap hits the fan.

Rather than rework the generator to accomodate this edge
case, I just fixed the init functions for virStorage* to
pull the associated connection out of the passed value
if it's not a virConnect instance.

Thanks,
Cole

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libvirt-python-fix-storage-conn-patch
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080811/e78ef6bc/attachment-0001.ksh>


More information about the libvir-list mailing list