Change in vdsm[master]: hsm: refresh pool connection on connectStoragePool

Federico Simoncelli fsimonce at redhat.com
Tue Dec 17 12:55:24 UTC 2013


Federico Simoncelli has uploaded a new change for review.

Change subject: hsm: refresh pool connection on connectStoragePool
......................................................................

hsm: refresh pool connection on connectStoragePool

This patch ensures that connectStoragePool would trigger a refresh
when the host is already connected to the same pool.
Using connectStoragePool instead of refreshStoragePool is at the base
of the storage pool metadata removal but it also solves an existing
problem in the non-operational recovery flow where the engine sends
a connectStoragePool request.

Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1026697
Change-Id: I46d7c36b48f5d58edbc89947ccd2bcd60408a729
Signed-off-by: Federico Simoncelli <fsimonce at redhat.com>
---
M vdsm/storage/hsm.py
1 file changed, 13 insertions(+), 19 deletions(-)


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

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 622065e..7a66ab6 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -1013,6 +1013,14 @@
             return self._connectStoragePool(spUUID, hostID, scsiKey, msdUUID,
                                             masterVersion, options)
 
+    @staticmethod
+    def _updateStoragePool(pool, hostId, msdUUID, masterVersion):
+        if hostId != pool.id:
+            raise se.StoragePoolConnected(
+                "hostId=%s, newHostId=%s" % (pool.id, hostId))
+
+        pool.refresh(msdUUID, masterVersion)
+
     def _connectStoragePool(self, spUUID, hostID, scsiKey, msdUUID,
                             masterVersion, options=None):
         misc.validateUUID(spUUID, 'spUUID')
@@ -1028,17 +1036,9 @@
             pass  # pool not connected yet
         else:
             with rmanager.acquireResource(STORAGE, spUUID, rm.LockType.shared):
-                pool = self.getPool(spUUID)
-                if not msdUUID or not masterVersion:
-                    hostID, scsiKey, msdUUID, masterVersion = \
-                        pool.getPoolParams()
-                misc.validateN(hostID, 'hostID')
-                # getMasterDomain is called because produce is required here
-                # since the master domain can be changed by the SPM if it is
-                # the refreshPool flow.
-                pool.getMasterDomain(msdUUID=msdUUID,
-                                     masterVersion=masterVersion)
-                return
+                self._updateStoragePool(self.getPool(spUUID), msdUUID,
+                                        masterVersion)
+                return True
 
         with rmanager.acquireResource(STORAGE, spUUID, rm.LockType.exclusive):
             try:
@@ -1046,14 +1046,8 @@
             except se.StoragePoolUnknown:
                 pass  # pool not connected yet
             else:
-                if not msdUUID or not masterVersion:
-                    hostID, scsiKey, msdUUID, masterVersion = \
-                        pool.getPoolParams()
-                misc.validateN(hostID, 'hostID')
-                # Idem. See above.
-                pool.getMasterDomain(msdUUID=msdUUID,
-                                     masterVersion=masterVersion)
-                return
+                self._updateStoragePool(pool, msdUUID, masterVersion)
+                return True
 
             pool = sp.StoragePool(spUUID, self.domainMonitor, self.taskMng)
             if not hostID or not scsiKey or not msdUUID or not masterVersion:


-- 
To view, visit http://gerrit.ovirt.org/22467
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I46d7c36b48f5d58edbc89947ccd2bcd60408a729
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Federico Simoncelli <fsimonce at redhat.com>


More information about the vdsm-patches mailing list