Don't close connection on all libvirt errors: only if libvirtd goes away.

This commit is contained in:
Cole Robinson 2009-09-16 16:02:19 -04:00
parent 9fe564e14b
commit 3d22dbf020
2 changed files with 17 additions and 5 deletions

View File

@ -941,7 +941,15 @@ class vmmConnection(gobject.GObject):
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)

View File

@ -199,10 +199,14 @@ class vmmEngine(gobject.GObject):
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):