virt-manager/virt-manager-0.8.0-conn-close-exception.patch

50 lines
2.1 KiB
Diff
Raw Normal View History

# HG changeset patch
# User Cole Robinson <crobinso@redhat.com>
# Date 1253131339 14400
# Node ID 1c886d1863f72e7ddd5fb99050362296be6a9deb
# Parent 9242a7fe76b16c6505bdd3d3d328ae8f0c56da10
Don't close connection on all libvirt errors: only if libvirtd goes away.
diff -r 9242a7fe76b1 -r 1c886d1863f7 src/virtManager/connection.py
--- a/src/virtManager/connection.py Wed Sep 16 16:01:54 2009 -0400
+++ b/src/virtManager/connection.py Wed Sep 16 16:02:19 2009 -0400
@@ -941,7 +941,15 @@
updateVMs = newVMs
for uuid in updateVMs:
- self.vms[uuid].tick(now)
+ vm = self.vms[uuid]
+ try:
+ vm.tick(now)
+ except libvirt.libvirtError, e:
+ if e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR:
+ raise
+ logging.exception("Tick for VM '%s' failed" % vm.get_name())
+ except Exception, e:
+ logging.exception("Tick for VM '%s' failed" % vm.get_name())
if not noStatsUpdate:
self._recalculate_stats(now)
diff -r 9242a7fe76b1 -r 1c886d1863f7 src/virtManager/engine.py
--- a/src/virtManager/engine.py Wed Sep 16 16:01:54 2009 -0400
+++ b/src/virtManager/engine.py Wed Sep 16 16:02:19 2009 -0400
@@ -199,10 +199,14 @@
self.connections[uri]["connection"].tick()
except KeyboardInterrupt:
raise
- except:
- logging.exception("Could not refresh connection %s." % uri)
- logging.debug("Closing connection since refresh failed.")
- self.connections[uri]["connection"].close()
+ except libvirt.libvirtError, e:
+ if e.get_error_code() == libvirt.VIR_ERR_SYSTEM_ERROR:
+ logging.exception("Could not refresh connection %s." % uri)
+ logging.debug("Closing connection since libvirtd "
+ "appears to have stopped.")
+ self.connections[uri]["connection"].close()
+ else:
+ raise
return 1
def change_timer_interval(self,ignore1,ignore2,ignore3,ignore4):