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

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

 



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

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