Re: [PATCH] Return right error code for baselineCPU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]