mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
engine: Fix closing connection when tick() fails (bz 1069351)
This commit is contained in:
parent
dd577de636
commit
ce64d037bf
@ -344,30 +344,39 @@ class vmmEngine(vmmGObject):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def _tick_single_conn(self, conn, kwargs):
|
def _tick_single_conn(self, conn, kwargs):
|
||||||
|
e = None
|
||||||
try:
|
try:
|
||||||
conn.tick(**kwargs)
|
conn.tick(**kwargs)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
raise
|
raise
|
||||||
except libvirt.libvirtError, e:
|
except Exception, e:
|
||||||
from_remote = getattr(libvirt, "VIR_FROM_REMOTE", None)
|
pass
|
||||||
from_rpc = getattr(libvirt, "VIR_FROM_RPC", None)
|
|
||||||
sys_error = getattr(libvirt, "VIR_ERR_SYSTEM_ERROR", None)
|
|
||||||
|
|
||||||
|
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()
|
dom = e.get_error_domain()
|
||||||
code = e.get_error_code()
|
code = e.get_error_code()
|
||||||
|
|
||||||
if (dom in [from_remote, from_rpc] and
|
if (dom in [from_remote, from_rpc] and
|
||||||
code in [sys_error]):
|
code in [sys_error]):
|
||||||
logging.exception("Could not refresh connection %s",
|
logging.exception("Could not refresh connection %s",
|
||||||
conn.get_uri())
|
conn.get_uri())
|
||||||
logging.debug("Closing connection since libvirtd "
|
logging.debug("Closing connection since libvirtd "
|
||||||
"appears to have stopped")
|
"appears to have stopped")
|
||||||
else:
|
else:
|
||||||
error_msg = _("Error polling connection '%s': %s") \
|
error_msg = _("Error polling connection '%s': %s") \
|
||||||
% (conn.get_uri(), e)
|
% (conn.get_uri(), e)
|
||||||
self.idle_add(lambda: self.err.show_err(error_msg))
|
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):
|
def increment_window_counter(self, src):
|
||||||
|
Loading…
Reference in New Issue
Block a user