[libvirt] [libvirt-glib 8/9] Connect a bunch of domain event to signals

Daniel P. Berrange berrange at redhat.com
Thu Sep 29 11:47:47 UTC 2011


On Thu, Sep 29, 2011 at 02:25:43PM +0300, Zeeshan Ali (Khattak) wrote:
> On Thu, Sep 29, 2011 at 11:45 AM, Daniel P. Berrange
> <berrange at redhat.com> wrote:
> > On Wed, Sep 28, 2011 at 09:30:57PM +0200, Marc-André Lureau wrote:
> >> ---
> >>  libvirt-gobject/libvirt-gobject-connection.c |  126 ++++++++++++++++++++++++++
> >>  1 files changed, 126 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/libvirt-gobject/libvirt-gobject-connection.c b/libvirt-gobject/libvirt-gobject-connection.c
> >> index e99a08d..34781e6 100644
> >> --- a/libvirt-gobject/libvirt-gobject-connection.c
> >> +++ b/libvirt-gobject/libvirt-gobject-connection.c
> >
> >> @@ -277,6 +398,10 @@ gboolean gvir_connection_open(GVirConnection *conn,
> >>          return FALSE;
> >>      }
> >>
> >> +    if (virConnectDomainEventRegister(priv->conn, domain_event_cb, conn, NULL) == -1) {
> >> +        g_warning("Failed to register domain events, ignoring");
> >> +    }
> >> +
> >
> > You might have noticed that we jump through some horrific hoops in
> > gvir_connection_fetch_domains(). The reason for this is so that we
> > can issue fake event notifications for start/stopped/added/removed
> > when virConnectDomainEventRegister() is not available. Not all hypervisors
> > support the virConnectDomainEventRegister() API, so we need that fallback
> > code. When you succesfully call virConnectDomainEventRegister(), we should
> > disable the event emitting part at the end of gvir_connection_fetch_domains()
> > to avoid duplicate events.
> 
>   In that case, create_domain() method should emit the signal too when
> event didn't register?

If 'create_domain' updates the hash table directly with the new guest
object, then, yes it should emit a signal.


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list