[Libvir] [PATCH] Python bindings now generate exceptions for libvirt errors (third version)

Richard W.M. Jones rjones at redhat.com
Wed Mar 28 09:23:06 UTC 2007

Third version of this patch, which should allow virt-manager to start up 

virt-manager relies on virDomainGetID returning -1 in the case when a 
domain is inactive.  On further investigation it turns out that 
virDomainGetID and virDomainGetName can never fail**, since all they do 
is read fields from the domain pointer that you pass.  It was also 
claimed that virDomainGetUUID was also error-free, but that's actually 
not the case.

So this patch disables exceptions in those two functions only.

Note that the documentation for virDomainGetID is wrong.

Thanks to Hugh Brock and Dan Berrange for finding and diagnosing the 


* Not tested: for me virt-manager fails for another reason, with or 
without this patch.

** Well, they can fail in the case where you've corrupted memory and 
your virDomainPtr isn't really a virDomainPtr, but at that point all 
bets are off anyway ...

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-3.patch
Type: text/x-patch
Size: 8213 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20070328/c3a5f3f6/attachment-0002.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/20070328/c3a5f3f6/attachment-0003.bin>

More information about the libvir-list mailing list