[libvirt] [PATCH] event: don't overwrite registration error message

Eric Blake eblake at redhat.com
Thu Jan 2 12:52:59 UTC 2014


On 01/02/2014 03:20 AM, Martin Kletzander wrote:
> On Tue, Dec 31, 2013 at 07:22:53AM -0700, Eric Blake wrote:
>> Prior to this patch, an attempt to register an event without an
>> event loop started results in the vague:
>>
>> libvirt: Remote Driver error : adding cb to list
>>
>> Now it gives the much nicer:
>>
>> libvirt:  error : internal error: could not initialize domain event timer
>>
>> This also avoids hiding other reasonable error messages, such as
>> attempts to register a duplicate callback or OOM errors.
>>
>> Also, document the event loop usage requirement, since that was how
>> I ran into the issue.

I actually moved the doc changes into a separate patch, since they
turned out to be bigger in nature:
https://www.redhat.com/archives/libvir-list/2013-December/msg01334.html

> 
> ACK, although I wasn't (somehow) able to test it with python bindings.

Thanks for the review.  It turns out reproducing this in python is
fairly straightforward; here run pre-patch:

$ python
>>> def hi():
...	print('hi')
...
>>> import libvirt
>>> conn = libvirt.open('qemu:///system')
>>> conn.domainEventRegisterAny(None, 0, hi, '')
libvirt: Remote Driver error : adding cb to list
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/site-packages/libvirt.py", line 3865, in
domainEventRegisterAny
    raise libvirtError ('virConnectDomainEventRegisterAny() failed',
conn=self)
libvirt.libvirtError: adding cb to list

Not that I'm sure how to set up the python event loop, but that's one
way to see the improved error message.

At any rate, I've pushed the patch (while waiting for the doc patch review).

-- 
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: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140102/846b8880/attachment-0001.sig>


More information about the libvir-list mailing list