[libvirt] [PATCH] Return right error code for baselineCPU
Eric Blake
eblake at redhat.com
Mon Nov 25 15:59:54 UTC 2013
On 11/25/2013 08:55 AM, Don Dugger wrote:
>
> I'm basing this on code inspection so I could be wrong but if you look
> at the Python interface code for libvirt_virDomainSetSchedulerParameters
> it checks the return value from virDomainSetSchedulerParameters and,
> if it is <0, then the Pythong code returns -1, without raising an
> exception.
We have two layers of python code. The libvirt-override.c layer returns
None/-1 if a libvirt error is present, then the generated layer turns
that into a python exception to the end user. Look at the generated
libvirt.py for a lot of examples of code that does:
if ret == -1: raise libvirtError ('... failed')
for anything where the C code fails with a -1, and does:
if ret is None: raise libvirtError ('... failed')
for anything where the C code fails with NULL.
The bug that we are fixing here is that we were returning -1 instead of
None for C code that fails with NULL, so the generated wrapper was not
properly throwing a libvirtError.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131125/43a0a4fe/attachment-0001.sig>
More information about the libvir-list
mailing list