[libvirt] [PATCH 2/3] libvirtaio: add allow for moving callbacks to other event loop

Daniel P. Berrange berrange at redhat.com
Fri Sep 1 12:16:51 UTC 2017


On Fri, Sep 01, 2017 at 01:51:17PM +0200, Wojtek Porczyk wrote:
> On Fri, Sep 01, 2017 at 10:08:18AM +0100, Daniel P. Berrange wrote:
> > IIUC, you are trying to make it possible to register multiple event
> > loop impls.  This is *not* supported usage of libvirt. You must
> > call 'virEventRegisterImpl' before opening any connection, and once
> > called you are forbidden to call it again.
> 
> Yes, that's correct. Can't I do it, even after I close all the connections?

That would be racy because some cleanup is liable to happen asynchronously.

> Why then libvirt_virEventRegisterImpl (libvirt-python/libvirt-override.c:5434)
> seems to accomodate for running it second time?

That's bogus code that we should remove - in fact the C library
should simply ignore any subsequent virEventRegisterImpl API
calls after the first one.

> The reason for this is we have separate event loop for each test case, but the
> whole suite runs in a single process. The Impl has to use the new loop for
> each test. Would it be better to just substitute the loop in a long-lived Impl
> instance?

Replacing 'loop' would achieve the same effet i guess, but you must
ensure there are no callbacks still registered by libvirt before doing
that.

Generally the expectation is that you register an event loop and then
run it forever until the process exits.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list