[Libvir] [PATCH] Python bindings now generate exceptions for libvirt errors

Richard W.M. Jones rjones at redhat.com
Tue Mar 27 11:45:13 UTC 2007


Following on from this thread:
https://www.redhat.com/archives/libvir-list/2007-March/thread.html#00341

The first attachment is a patch which changes the generated Python 
bindings so that they always raise an exception when an underlying error 
occurs in the C libvirt library.

The second attachment is for information only (not to be applied) - it 
shows the differences in the generated file libvirtclass.py.  I have 
checked each of these changes by hand against both the libvirt.c 
interface description and the C implementation of the Python bindings 
(libvir.c and libvirt-py.c), and each change seems correct.

I have _not_ tested this against virt-manager.  It is quite possible 
that virt-manager will cease to work if it wasn't checking the return 
values from affected functions carefully.  I'll check this later today 
and supply a patch (to virt-manager) if necessary.

I have some additional questions about the Python bindings, but I'll put 
those in a separate thread.

Rich.

-- 
Emerging Technologies, Red Hat  http://et.redhat.com/~rjones/
64 Baker Street, London, W1U 7DF     Mobile: +44 7866 314 421
  "[Negative numbers] darken the very whole doctrines of the equations
  and make dark of the things which are in their nature excessively
  obvious and simple" (Francis Maseres FRS, mathematician, 1759)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirt-python-exceptions-20070327.patch
Type: text/x-patch
Size: 7014 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070327/51941dac/attachment-0003.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libvirtclass.py.diff
Type: text/x-patch
Size: 14144 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070327/51941dac/attachment-0004.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3237 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070327/51941dac/attachment-0005.bin>


More information about the libvir-list mailing list