[libvirt] [PATCH] daemon: Don't blindly unregister domain events

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

 



The daemon will attempt to unregister domain events on client disconnect,
even if no events were ever registered. This raises an unneeded error.

Track in the qemu_client structure if events have been registered, and
check this when performing cleanup.

Signed-off-by: Cole Robinson <crobinso@xxxxxxxxxx>
---
 daemon/libvirtd.c |    2 +-
 daemon/libvirtd.h |    1 +
 daemon/remote.c   |    4 ++++
 3 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index c53ef0a..61a9728 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1447,7 +1447,7 @@ void qemudDispatchClientFailure(struct qemud_client *client) {
     }
 
     /* Deregister event delivery callback */
-    if(client->conn) {
+    if (client->conn && client->domain_events_registered) {
         DEBUG0("Deregistering to relay remote events");
         virConnectDomainEventDeregister(client->conn, remoteRelayDomainEvent);
     }
diff --git a/daemon/libvirtd.h b/daemon/libvirtd.h
index e3624c6..2f647f3 100644
--- a/daemon/libvirtd.h
+++ b/daemon/libvirtd.h
@@ -177,6 +177,7 @@ struct qemud_client {
     int watch;
     int readonly:1;
     int closing:1;
+    int domain_events_registered:1;
 
     struct sockaddr_storage addr;
     socklen_t addrlen;
diff --git a/daemon/remote.c b/daemon/remote.c
index 41b9974..e39d6d1 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -4775,6 +4775,8 @@ remoteDispatchDomainEventsRegister (struct qemud_server *server ATTRIBUTE_UNUSED
 
     if (ret)
         ret->cb_registered = 1;
+
+    client->domain_events_registered = 1;
     return 0;
 }
 
@@ -4796,6 +4798,8 @@ remoteDispatchDomainEventsDeregister (struct qemud_server *server ATTRIBUTE_UNUS
 
     if (ret)
         ret->cb_registered = 0;
+
+    client->domain_events_registered = 0;
     return 0;
 }
 
-- 
1.6.5.2

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