Forgot to hit 'reply-all' :(
---------- Forwarded message ----------
From: Zeeshan Ali (Khattak) <zeeshanak(a)gnome.org>
Date: Thu, Sep 29, 2011 at 2:25 PM
Subject: Re: [libvirt] [libvirt-glib 8/9] Connect a bunch of domain
event to signals
To: "Daniel P. Berrange" <berrange(a)redhat.com>
On Thu, Sep 29, 2011 at 11:45 AM, Daniel P. Berrange
<berrange(a)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?
--
Regards,
Zeeshan Ali (Khattak)
FSF member#5124