On Wed, Jan 13, 2010 at 03:50:04PM -0500, Cole Robinson wrote:
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(a)redhat.com>
---
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;
}
ACK
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|