New patch submitted by Yotam Oron (yoron@redhat.com)
You can review this change at: http://gerrit.usersys.redhat.com/700
commit 6b27cdc4cae27c74959c30609d874a39ba35e7ca Author: Yotam Oron yoron@redhat.com Date: Wed Jul 13 11:56:06 2011 +0300
BZ#705058 - StoragePool instanciations should be lock protected.
Add a storage shared lock on the call to _restorePool, since creates a new pool object
Change-Id: I4ad3cdb07299d63203db98ae3223559b6fdc4eab
diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py index b0d5d21..f763120 100644 --- a/vdsm/storage/hsm.py +++ b/vdsm/storage/hsm.py @@ -162,16 +162,14 @@ class HSM: 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._restorePool(spUUID) - #TODO Once we support simultaneous connection to multiple pools, remove following line (break) - break - except Exception: - self.log.error("Unexpected error", exc_info=True) + spUUID = os.listdir(_poolsTmpDir)[0] + vars.task.getSharedLock(STORAGE, spUUID) + poolPath = os.path.join(self.storage_repository, spUUID) + try: + if os.path.exists(poolPath): + self._restorePool(spUUID) + except Exception: + self.log.error("Unexpected error", exc_info=True)
threading.Thread(target=storageRefresh).start()