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

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



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.


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


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