cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject git commit: updated refs/heads/master to b7ab955
Date Tue, 16 Dec 2014 00:16:00 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 85bb68566 -> b7ab95561


When deleting primary storage that's based on the SolidFireShared plug-in (which uses a shared-IOPS
approach), remove the volume from the volume access group it's in


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b7ab9556
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b7ab9556
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b7ab9556

Branch: refs/heads/master
Commit: b7ab955610360b1cd5d490e79df4aca3d2293618
Parents: 85bb685
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Mon Dec 15 14:11:31 2014 -0700
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Mon Dec 15 17:15:40 2014 -0700

----------------------------------------------------------------------
 ...olidFireSharedPrimaryDataStoreLifeCycle.java | 33 ++++++++++++++++++++
 1 file changed, 33 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b7ab9556/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
index b70333d..4fa49ef 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/lifecycle/SolidFireSharedPrimaryDataStoreLifeCycle.java
@@ -52,6 +52,7 @@ import com.cloud.agent.api.CreateStoragePoolCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.StoragePoolInfo;
 import com.cloud.dc.ClusterDetailsDao;
+import com.cloud.dc.ClusterDetailsVO;
 import com.cloud.dc.ClusterVO;
 import com.cloud.dc.dao.ClusterDao;
 import com.cloud.dc.dao.DataCenterDao;
@@ -491,6 +492,8 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
             _tmpltMgr.evictTemplateFromStoragePool(templatePoolVO);
         }
 
+        Long clusterId = null;
+
         for (StoragePoolHostVO host : hostPoolRecords) {
             DeleteStoragePoolCommand deleteCmd = new DeleteStoragePoolCommand(storagePool);
 
@@ -523,6 +526,12 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
             if (answer != null && answer.getResult()) {
                 s_logger.info("Successfully deleted storage pool using Host ID " + host.getHostId());
 
+                HostVO hostVO = this._hostDao.findById(host.getHostId());
+
+                if (hostVO != null) {
+                    clusterId = hostVO.getClusterId();
+                }
+
                 break;
             }
             else {
@@ -530,11 +539,35 @@ public class SolidFireSharedPrimaryDataStoreLifeCycle implements PrimaryDataStor
             }
         }
 
+        if (clusterId != null) {
+            removeVolumeFromVag(storagePool.getId(), clusterId);
+        }
+
         deleteSolidFireVolume(storagePool.getId());
 
         return _primaryDataStoreHelper.deletePrimaryDataStore(dataStore);
     }
 
+    private void removeVolumeFromVag(long storagePoolId, long clusterId) {
+        long sfVolumeId = getVolumeId(storagePoolId);
+        ClusterDetailsVO clusterDetail = _clusterDetailsDao.findDetail(clusterId, SolidFireUtil.getVagKey(storagePoolId));
+
+        String vagId = clusterDetail != null ? clusterDetail.getValue() : null;
+
+        if (vagId != null) {
+            List<HostVO> hosts = _hostDao.findByClusterId(clusterId);
+
+            SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId,
_storagePoolDetailsDao);
+
+            SolidFireUtil.SolidFireVag sfVag = SolidFireUtil.getSolidFireVag(sfConnection,
Long.parseLong(vagId));
+
+            String[] hostIqns = SolidFireUtil.getNewHostIqns(sfVag.getInitiators(), SolidFireUtil.getIqnsFromHosts(hosts));
+            long[] volumeIds = SolidFireUtil.getNewVolumeIds(sfVag.getVolumeIds(), sfVolumeId,
false);
+
+            SolidFireUtil.modifySolidFireVag(sfConnection, sfVag.getId(), hostIqns, volumeIds);
+        }
+    }
+
     private void deleteSolidFireVolume(long storagePoolId) {
         SolidFireUtil.SolidFireConnection sfConnection = SolidFireUtil.getSolidFireConnection(storagePoolId,
_storagePoolDetailsDao);
 


Mime
View raw message