Eduardo has uploaded a new change for review.

Change subject: Adding monitorPoolDomains replacing connectStoragePool.
......................................................................

Adding monitorPoolDomains replacing connectStoragePool.

Spliting the share storage and host views of the pool in order
to remove the pool concept.

Change-Id: I1db3aeb5d2c3ab5a4ad90c175bc3e576726f0336
Signed-off-by: Eduardo <[email protected]>
---
M vdsm/storage/hsm.py
M vdsm/storage/sp.py
M vdsm_cli/vdsClient.py
3 files changed, 58 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/37/11937/1

diff --git a/vdsm/storage/hsm.py b/vdsm/storage/hsm.py
index 29980f3..3b0d4e3 100644
--- a/vdsm/storage/hsm.py
+++ b/vdsm/storage/hsm.py
@@ -932,6 +932,30 @@
         return self._connectStoragePool(spUUID, hostID, scsiKey, msdUUID,
                                         masterVersion, options)
 
+    @public
+    def monitorPoolDomains(self, spUUID, hostID, scsiKey, msdUUID,
+                           masterVersion, domains):
+        with rmanager.acquireResource(STORAGE, spUUID, rm.LockType.exclusive):
+            try:
+                pool = self.getPool(spUUID)
+            except se.StoragePoolUnknown:
+                pass  # pool not connected yet
+            else:
+                return True
+
+            pool = sp.StoragePool(spUUID, self.taskMng)
+            pool.id = hostID
+            pool.scsiKey = scsiKey
+            # In memory list of domains
+            pool.domains = domains
+
+            pool.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+
+            pool.createMailboxMonitor()
+
+            self.pools[spUUID] = pool
+            return True
+
     def _connectStoragePool(self, spUUID, hostID, scsiKey, msdUUID,
                             masterVersion, options=None):
         misc.validateUUID(spUUID, 'spUUID')
diff --git a/vdsm/storage/sp.py b/vdsm/storage/sp.py
index fb352e2..4897be8 100644
--- a/vdsm/storage/sp.py
+++ b/vdsm/storage/sp.py
@@ -463,7 +463,7 @@
                                  kwargs={"__securityOverride": True}).start()
 
     @unsecured
-    def __createMailboxMonitor(self):
+    def createMailboxMonitor(self):
         if self.hsmMailer:
             return
 
@@ -613,7 +613,7 @@
             # During 'master' marking we create pool metadata and each attached
             # domain should register there
             self.createMaster(poolName, msd, masterVersion, leaseParams)
-            self.__rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+            self.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
             # Attach storage domains to the storage pool
             # Since we are creating the pool then attach is done from the hsm
             # and not the spm therefore we must manually take the master domain
@@ -685,8 +685,8 @@
         sdCache.invalidateStorage()
         sdCache.refresh()
         # Rebuild whole Pool
-        self.__rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
-        self.__createMailboxMonitor()
+        self.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+        self.createMailboxMonitor()
 
         return True
 
@@ -1212,7 +1212,7 @@
                 domPoolMD[PMDK_MASTER_VER] = 0
 
     @unsecured
-    def __rebuild(self, msdUUID, masterVersion):
+    def rebuild(self, msdUUID, masterVersion):
         """
         Rebuild storage pool.
         """
@@ -1291,7 +1291,7 @@
         """
         sdCache.invalidateStorage()
         sdCache.refresh()
-        self.__rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
+        self.rebuild(msdUUID=msdUUID, masterVersion=masterVersion)
 
     def updateVM(self, vmList, sdUUID=None):
         """
@@ -1631,10 +1631,14 @@
 
     @unsecured
     def getDomains(self, activeOnly=False):
-        return dict(
-            (sdUUID, status) for sdUUID, status in
-            self.getMetaParam(PMDK_DOMAINS).iteritems()
-            if not activeOnly or status == sd.DOM_ACTIVE_STATUS)
+        if hasattr(self, "domains"):
+            domains = dict.fromkeys(self.domains, sd.DOM_ACTIVE_STATUS)
+        else:
+            domains = dict(
+                (sdUUID, status) for sdUUID, status in
+                self.getMetaParam(PMDK_DOMAINS).iteritems()
+                if not activeOnly or status == sd.DOM_ACTIVE_STATUS)
+        return domains
 
     def checkBackupDomain(self):
         domDict = self.getDomains(activeOnly=True)
diff --git a/vdsm_cli/vdsClient.py b/vdsm_cli/vdsClient.py
index fefc209..7cad88e 100644
--- a/vdsm_cli/vdsClient.py
+++ b/vdsm_cli/vdsClient.py
@@ -846,6 +846,19 @@
             return pool['status']['code'], pool['status']['message']
         return 0, ''
 
+    def monitorPoolDomains(self, args):
+        spUUID = args[0]
+        hostID = int(args[1])
+        scsiKey = args[2]
+        msdUUID = args[3]
+        masterVersion = args[4]
+        domains = args[5]
+        res = self.s.monitorPoolDomains(spUUID, hostID, scsiKey, msdUUID,
+                                        masterVersion, domains)
+        if res['status']['code']:
+            return res['status']['code'], res['status']['message']
+        return 0, ''
+
     def connectStoragePool(self, args):
         spUUID = args[0]
         ID = int(args[1])
@@ -2047,6 +2060,13 @@
                                ('<spUUID> <id> <scsi-key>',
                                 'Destroy storage pool'
                                 )),
+        'monitorPoolDomains': (serv.monitorPoolDomains,
+                               ('<spUUID> <id> <scsi-key> <masterUUID> '
+                                '<masterVer> <domainsList>',
+                                'Connect a Host to specific storage pool'
+                                'starting domain monitoring. All the SDs'
+                                'in domains list are monitored.'
+                                )),
         'connectStoragePool': (serv.connectStoragePool,
                                ('<spUUID> <id> <scsi-key> [masterUUID] '
                                 '[masterVer]',


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1db3aeb5d2c3ab5a4ad90c175bc3e576726f0336
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Eduardo <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to