Liron Aravot has uploaded a new change for review.

Change subject: hsm: lock pool when running upgradeStoragePool
......................................................................

hsm: lock pool when running upgradeStoragePool

When running upgradeStoragePool we use the pool metadata to know which
domains needs upgrade, having no pool lock means that races with flows
that manipulate the pool metadata like activateSd and deactivateSd might
occur.

Change-Id: I1d5b65a75b1b50d5f5991334cf6221c067a31f5b
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1260429
Signed-off-by: Liron Aravot <[email protected]>
---
M vdsm/storage/hsm.py
1 file changed, 5 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/67/45967/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 662a3d6..88fa564 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -3529,7 +3529,11 @@
     def upgradeStoragePool(self, spUUID, targetDomVersion):
         targetDomVersion = int(targetDomVersion)
         pool = self.getPool(spUUID)
-        pool._upgradePool(targetDomVersion)
+        # This lock has to be mutual with the pool metadata operations (like
+        # activateSD/deactivateSD) as it uses the pool metadata.
+        with rmanager.acquireResource(STORAGE, spUUID,
+                                      rm.LockType.exclusive):
+            pool._upgradePool(targetDomVersion)
         return {"upgradeStatus": "started"}
 
     def _getDomsStats(self, domainMonitor, doms):


-- 
To view, visit https://gerrit.ovirt.org/45967
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1d5b65a75b1b50d5f5991334cf6221c067a31f5b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Liron Aravot <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to