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

Martin Kletzander mkletzan at redhat.com
Thu Jan 2 13:02:01 UTC 2014


On Thu, Jan 02, 2014 at 05:52:59AM -0700, Eric Blake wrote:
> 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:
> 

I was able to reproduce it, but I wasn't able to test it after I
merged the fix.  I'm probably misusing the python bindings (still
didn't get used to the workflow when they are split).

> $ 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).
> 

Getting right on that.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140102/534db1e6/attachment-0001.sig>


More information about the libvir-list mailing list