Nir Soffer has uploaded a new change for review. Change subject: domainMonitor: Ensure that host id is released ......................................................................
domainMonitor: Ensure that host id is released Previously unexpected exception could cause the domain monitor thread to exit without releasing the host id. Stale host id will prevent removal of logical volume and the underlying devices, and prevent stopping of sanlock, requiring a reboot to upgrade a host. Now try finally block ensures that host id is is always released. Change-Id: I99b8a11b055a671d180feff92500091b3e0e1287 Signed-off-by: Nir Soffer <[email protected]> --- M vdsm/storage/domainMonitor.py 1 file changed, 16 insertions(+), 14 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/22/30922/1 diff --git a/vdsm/storage/domainMonitor.py b/vdsm/storage/domainMonitor.py index 09f5f26..0d182f8 100644 --- a/vdsm/storage/domainMonitor.py +++ b/vdsm/storage/domainMonitor.py @@ -149,9 +149,8 @@ log = logging.getLogger('Storage.DomainMonitorThread') def __init__(self, domainMonitor, sdUUID, hostId, interval): - self.thread = threading.Thread(target=self._monitorLoop) + self.thread = threading.Thread(target=self._run) self.thread.setDaemon(True) - self.domainMonitor = domainMonitor self.stopEvent = threading.Event() self.domain = None @@ -180,9 +179,23 @@ return self.status.copy() @utils.traceback(on=log.name) - def _monitorLoop(self): + def _run(self): self.log.debug("Starting domain monitor for %s", self.sdUUID) + try: + self._monitorLoop() + finally: + self.log.debug("Stopping domain monitor for %s", self.sdUUID) + # If this is an ISO domain we didn't acquire the host id and + # releasing it is superfluous. + if self.domain and not self.isIsoDomain: + try: + self.domain.releaseHostId(self.hostId, unused=True) + except: + self.log.debug("Unable to release the host id %s for " + "domain %s", self.hostId, self.sdUUID, + exc_info=True) + def _monitorLoop(self): while not self.stopEvent.is_set(): try: self._monitorDomain() @@ -190,17 +203,6 @@ self.log.error("The domain monitor for %s failed unexpectedly", self.sdUUID, exc_info=True) self.stopEvent.wait(self.interval) - - self.log.debug("Stopping domain monitor for %s", self.sdUUID) - - # If this is an ISO domain we didn't acquire the host id and releasing - # it is superfluous. - if self.domain and not self.isIsoDomain: - try: - self.domain.releaseHostId(self.hostId, unused=True) - except: - self.log.debug("Unable to release the host id %s for domain " - "%s", self.hostId, self.sdUUID, exc_info=True) def _monitorDomain(self): self.nextStatus.clear() -- To view, visit http://gerrit.ovirt.org/30922 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I99b8a11b055a671d180feff92500091b3e0e1287 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <[email protected]> _______________________________________________ vdsm-patches mailing list [email protected] https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
