Nir Soffer has uploaded a new change for review. Change subject: hsm: Log exceptions in storage refresh thread ......................................................................
hsm: Log exceptions in storage refresh thread hsm's storage refresh background thread does not handle exceptions, making it harder then it should to debug stupid errors in underlying calls. This patch log a traceback for such exceptions. Change-Id: I2e69464ba27b7d522c5ceb3a3099949efe7fbc88 Signed-off-by: Nir Soffer <nsof...@redhat.com> --- M vdsm/storage/hsm.py 1 file changed, 24 insertions(+), 20 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/86/21486/1 diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index 5e53f3a..6d2e248 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -374,28 +374,32 @@ self.log.warn("Failed to clean Storage Repository.", exc_info=True) def storageRefresh(): - lvm._lvminfo.bootstrap() - sdCache.refreshStorage() + try: + lvm._lvminfo.bootstrap() + sdCache.refreshStorage() - fileUtils.createdir(self.tasksDir) - # TBD: Should this be run in connectStoragePool? Should tasksDir - # exist under pool link as well (for hsm tasks) - self.taskMng.loadDumpedTasks(self.tasksDir) - self.taskMng.recoverDumpedTasks() + fileUtils.createdir(self.tasksDir) + # TBD: Should this be run in connectStoragePool? Should + # tasksDir exist under pool link as well (for hsm tasks) + self.taskMng.loadDumpedTasks(self.tasksDir) + self.taskMng.recoverDumpedTasks() - _poolsTmpDir = config.get('irs', 'pools_data_dir') - dirList = os.listdir(_poolsTmpDir) - for spUUID in dirList: - poolPath = os.path.join(self.storage_repository, spUUID) - try: - if os.path.exists(poolPath): - self._connectStoragePool(spUUID, None, - None, None, None) - # TODO Once we support simultaneous connection to - # multiple pools, remove following line (break) - break - except Exception: - self.log.error("Unexpected error", exc_info=True) + _poolsTmpDir = config.get('irs', 'pools_data_dir') + dirList = os.listdir(_poolsTmpDir) + for spUUID in dirList: + poolPath = os.path.join(self.storage_repository, spUUID) + try: + if os.path.exists(poolPath): + self._connectStoragePool(spUUID, None, + None, None, None) + # TODO Once we support simultaneous connection to + # multiple pools, remove following line (break) + break + except Exception: + self.log.error("Unexpected error", exc_info=True) + except Exception: + self.log.exception("unhandled exception in storageRefresh" + " thread") storageRefreshThread = threading.Thread(target=storageRefresh, name="storageRefresh") -- To view, visit http://gerrit.ovirt.org/21486 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2e69464ba27b7d522c5ceb3a3099949efe7fbc88 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer <nsof...@redhat.com> _______________________________________________ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches