Re: [libvirt] [RFC] domain-events-python

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

 



On Tue, Oct 28, 2008 at 06:23:20PM +0000, Daniel P. Berrange wrote:
> 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.

  yes +1 definitely

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

  Agreed too, since we don't care too much about performances in that
code it is really easier to implement and debug if most of the logic is
done in Python rather than C.
  The reference counting problem in callback based interfaces can be
nasty as I found out in libxml2, that too can be simplified greatly by
doing most of the work on the python side.

  thanks !

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel@xxxxxxxxxxxx  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
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]