[NEW PATCH] BZ#705058 - StoragePool instanciations should be lock protected. (via gerrit-bot)

Yotam Oron yoron at redhat.com
Tue Jul 19 18:17:35 UTC 2011


New patch submitted by Yotam Oron (yoron at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/725

commit ff73b00b62c2e2daf825fa28d753c2d9f1356999
Author: Yotam Oron <yoron at 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: If17649ae25bbac7bc23fe319c1adfdf669527e60

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index a6de936..ef472af 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -166,11 +166,11 @@ class HSM:
             for spUUID in dirList:
                 poolPath = os.path.join(self.storage_repository, spUUID)
                 try:
-                    vars.task.getSharedLock(STORAGE, spUUID)
                     if os.path.exists(poolPath):
-                        self._restorePool(spUUID)
-                        #TODO Once we support simultaneous connection to multiple pools, remove following line (break)
-                        break
+                        with rmanager.acquireResource(STORAGE, spUUID, rm.LockType.exclusive):
+                            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)
 




More information about the vdsm-patches mailing list