On Tue, Oct 28, 2008 at 09:09:53AM -0400, Ben Guthro wrote:
Attached is a preliminary patch implementing the python bindings for
domain events, and the EventImpl code.
This implements a python test app equivalent to the code in the C
event-test app. Contrary to what Daniel B originally suggested, I thought
that the EventImpl would be useful to expose for apps that are strictly
using python, and not integrating with glib, or another event loop. It
also makes the test case easier to debug.
That's a good idea - does make it easier to debug.
I have not marked this with [PATCH] in the subject, as I don't believe
it is quite complete.
I am still having a few issues with the Refcounting in the C code, and
I think there is still some cleanup code I haven't quite handled quite
right.
That said - I would welcome some comments/suggestions on this thus far,
to make sure I'm not going off in a direction contrary to where you
think I should be.
I think my main thought would be to try and domore of the event
dispatch work in the python layer, rather than C layer. So rather
than doing the de-multiplexing to all registered callbacks in
libvirt_virConnectDomainEventCallback, have that C method call
into a python virConnectDomainEventCallback function, and have
that de-multiplex the events out to all application callbacks.
I think it'd probably make the code a little easier to follow,
and might simplify the ref counting problems.
Likewise I think I'd also keep more of the 'DomainEventRegister' and
'Unregister' impl in the python layer. Perhaps keeping the list of
callbacks as an attribute in the 'class virConnect', rather than the
static global variable pyobj_domain_event_cbs.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|