From: "Zeeshan Ali (Khattak)" <zeeshanak(a)gnome.org>
---
libvirt-gobject/libvirt-gobject-connection.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/libvirt-gobject/libvirt-gobject-connection.c
b/libvirt-gobject/libvirt-gobject-connection.c
index a258847..02b54a1 100644
--- a/libvirt-gobject/libvirt-gobject-connection.c
+++ b/libvirt-gobject/libvirt-gobject-connection.c
@@ -264,6 +264,7 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
GVirConnection *gconn = opaque;
GVirDomain *gdom;
GVirConnectionPrivate *priv = gconn->priv;
+ gboolean was_unknown = FALSE;
if (virDomainGetUUIDString(dom, uuid) < 0) {
g_warning("Failed to get domain UUID on %p", dom);
@@ -282,6 +283,8 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
g_mutex_lock(priv->lock);
g_hash_table_insert(priv->domains, (gpointer)gvir_domain_get_uuid(gdom),
gdom);
g_mutex_unlock(priv->lock);
+
+ was_unknown = TRUE;
}
switch (event) {
@@ -307,9 +310,12 @@ static int domain_event_cb(virConnectPtr conn G_GNUC_UNUSED,
break;
case VIR_DOMAIN_EVENT_STARTED:
- if (detail == VIR_DOMAIN_EVENT_STARTED_BOOTED)
+ if (detail == VIR_DOMAIN_EVENT_STARTED_BOOTED) {
+ if (was_unknown)
+ /* Most probably a transient domain */
+ g_signal_emit(gconn, signals[VIR_DOMAIN_ADDED], 0, gdom);
g_signal_emit_by_name(gdom, "started::booted");
- else if (detail == VIR_DOMAIN_EVENT_STARTED_MIGRATED)
+ } else if (detail == VIR_DOMAIN_EVENT_STARTED_MIGRATED)
g_signal_emit_by_name(gdom, "started::migrated");
else if (detail == VIR_DOMAIN_EVENT_STARTED_RESTORED)
g_signal_emit_by_name(gdom, "started::restored");
--
1.7.7.3