connection: Handle errors when deregistering events on close (bz #1069351)

This commit is contained in:
Cole Robinson 2014-03-10 09:47:51 -04:00
parent 0a224fb498
commit 9f61d853b6
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From daeba426032fa48dec96ecbc5106113152504eb0 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Mon, 10 Mar 2014 09:33:04 -0400
Subject: [PATCH] connection: Handle errors when deregistering events on close
(bz 1069351)
Otherwise this interrupts the close/cleanup routine, and the connection
never appears to disconnect in the UI. This causes error dialog spamming
when libvirtd goes down.
(cherry picked from commit 081e34715ffa5a210e1e0c8670fe3a1a3ec5180b)
---
virtManager/connection.py | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/virtManager/connection.py b/virtManager/connection.py
index 57e143d..4c034b8 100644
--- a/virtManager/connection.py
+++ b/virtManager/connection.py
@@ -929,16 +929,25 @@ class vmmConnection(vmmGObject):
def close(self):
def cleanup(devs):
for dev in devs.values():
- dev.cleanup()
-
- if not self._backend.is_closed():
- if self._domain_cb_id is not None:
- self._backend.domainEventDeregisterAny(self._domain_cb_id)
- self._domain_cb_id = None
+ try:
+ dev.cleanup()
+ except:
+ logging.debug("Failed to cleanup %s", exc_info=True)
- if self._network_cb_id is not None:
- self._backend.networkEventDeregisterAny(self._network_cb_id)
- self._network_cb_id = None
+ try:
+ if not self._backend.is_closed():
+ if self._domain_cb_id is not None:
+ self._backend.domainEventDeregisterAny(
+ self._domain_cb_id)
+ self._domain_cb_id = None
+
+ if self._network_cb_id is not None:
+ self._backend.networkEventDeregisterAny(
+ self._network_cb_id)
+ self._network_cb_id = None
+ except:
+ logging.debug("Failed to deregister events in conn cleanup",
+ exc_info=True)
self._backend.close()
self.record = []

View File

@ -20,7 +20,7 @@
%define _version 1.0.0 %define _version 1.0.0
%define _release 5 %define _release 6
# This macro is used for the continuous automated builds. It just # This macro is used for the continuous automated builds. It just
@ -70,6 +70,9 @@ Patch0015: 0015-xmlbuilder-Log-broken-XML-if-we-can-t-parse-it.patch
Patch0016: 0016-xmlbuilder-Actually-import-logging.patch Patch0016: 0016-xmlbuilder-Actually-import-logging.patch
# addhardware: Fix adding disk through 'customize' dialog (bz #1073808) # addhardware: Fix adding disk through 'customize' dialog (bz #1073808)
Patch0017: 0017-addhardware-Fix-adding-disk-through-customize-dialog.patch Patch0017: 0017-addhardware-Fix-adding-disk-through-customize-dialog.patch
# connection: Handle errors when deregistering events on close (bz
# #1069351)
Patch0018: 0018-connection-Handle-errors-when-deregistering-events-o.patch
BuildArch: noarch BuildArch: noarch
@ -166,6 +169,9 @@ machine).
%patch0016 -p1 %patch0016 -p1
# addhardware: Fix adding disk through 'customize' dialog (bz #1073808) # addhardware: Fix adding disk through 'customize' dialog (bz #1073808)
%patch0017 -p1 %patch0017 -p1
# connection: Handle errors when deregistering events on close (bz
# #1069351)
%patch0018 -p1
%build %build
%if %{qemu_user} %if %{qemu_user}
@ -275,6 +281,9 @@ fi
%changelog %changelog
* Mon Mar 10 2014 Cole Robinson <crobinso@redhat.com> - 1.0.0-6
- connection: Handle errors when deregistering events on close (bz #1069351)
* Fri Mar 07 2014 Cole Robinson <crobinso@redhat.com> - 1.0.0-5 * Fri Mar 07 2014 Cole Robinson <crobinso@redhat.com> - 1.0.0-5
- addhardware: Fix adding disk through 'customize' dialog (bz #1073808) - addhardware: Fix adding disk through 'customize' dialog (bz #1073808)