summaryrefslogtreecommitdiff
path: root/virtManager
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2014-02-25 15:17:34 -0500
committerCole Robinson <crobinso@redhat.com>2014-02-25 15:17:34 -0500
commitce64d037bff56db994fedd065a9a34b8e827dda2 (patch)
tree08d5115214eff69bc9dd6d46b890a0d704bac5aa /virtManager
parentdd577de636a9e1eb69dd9bf4d0f92360b6ca589b (diff)
downloadvirt-manager-ce64d037bff56db994fedd065a9a34b8e827dda2.tar.gz
engine: Fix closing connection when tick() fails (bz 1069351)
Diffstat (limited to 'virtManager')
-rw-r--r--virtManager/engine.py39
1 files changed, 24 insertions, 15 deletions
diff --git a/virtManager/engine.py b/virtManager/engine.py
index cef3d20e..0e5e15d6 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -344,30 +344,39 @@ class vmmEngine(vmmGObject):
return 1
def _tick_single_conn(self, conn, kwargs):
+ e = None
try:
conn.tick(**kwargs)
except KeyboardInterrupt:
raise
- except libvirt.libvirtError, e:
- from_remote = getattr(libvirt, "VIR_FROM_REMOTE", None)
- from_rpc = getattr(libvirt, "VIR_FROM_RPC", None)
- sys_error = getattr(libvirt, "VIR_ERR_SYSTEM_ERROR", None)
+ except Exception, e:
+ pass
+
+ if e is None:
+ return
+ from_remote = getattr(libvirt, "VIR_FROM_REMOTE", None)
+ from_rpc = getattr(libvirt, "VIR_FROM_RPC", None)
+ sys_error = getattr(libvirt, "VIR_ERR_SYSTEM_ERROR", None)
+
+ dom = -1
+ code = -1
+ if isinstance(e, libvirt.libvirtError):
dom = e.get_error_domain()
code = e.get_error_code()
- if (dom in [from_remote, from_rpc] and
- code in [sys_error]):
- logging.exception("Could not refresh connection %s",
- conn.get_uri())
- logging.debug("Closing connection since libvirtd "
- "appears to have stopped")
- else:
- error_msg = _("Error polling connection '%s': %s") \
- % (conn.get_uri(), e)
- self.idle_add(lambda: self.err.show_err(error_msg))
+ if (dom in [from_remote, from_rpc] and
+ code in [sys_error]):
+ logging.exception("Could not refresh connection %s",
+ conn.get_uri())
+ logging.debug("Closing connection since libvirtd "
+ "appears to have stopped")
+ else:
+ error_msg = _("Error polling connection '%s': %s") \
+ % (conn.get_uri(), e)
+ self.idle_add(lambda: self.err.show_err(error_msg))
- self.idle_add(conn.close)
+ self.idle_add(conn.close)
def increment_window_counter(self, src):