|
44 | 44 | import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; |
45 | 45 | import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao; |
46 | 46 | import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; |
47 | | -import org.apache.cloudstack.storage.feign.model.OntapStorage; |
48 | | -import org.apache.cloudstack.storage.provider.StorageProviderFactory; |
49 | 47 | import org.apache.cloudstack.storage.service.StorageStrategy; |
50 | 48 | import org.apache.cloudstack.storage.service.model.CloudStackVolume; |
51 | 49 | import org.apache.cloudstack.storage.service.model.ProtocolType; |
@@ -131,7 +129,7 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, VolumeIn |
131 | 129 | throw new CloudRuntimeException("createCloudStackVolume : Storage Pool not found for id: " + dataStore.getId()); |
132 | 130 | } |
133 | 131 | Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(dataStore.getId()); |
134 | | - StorageStrategy storageStrategy = getStrategyByStoragePoolDetails(details); |
| 132 | + StorageStrategy storageStrategy = Utility.getStrategyByStoragePoolDetails(details); |
135 | 133 | s_logger.info("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [{}] successful, preparing CloudStackVolumeRequest", details.get(Constants.SVM_NAME)); |
136 | 134 | CloudStackVolume cloudStackVolumeRequest = Utility.createCloudStackVolumeRequestByProtocol(storagePool, details, volumeObject); |
137 | 135 | CloudStackVolume cloudStackVolume = storageStrategy.createCloudStackVolume(cloudStackVolumeRequest); |
@@ -295,24 +293,4 @@ public boolean isStorageSupportHA(Storage.StoragePoolType type) { |
295 | 293 | public void detachVolumeFromAllStorageNodes(Volume volume) { |
296 | 294 |
|
297 | 295 | } |
298 | | - |
299 | | - private StorageStrategy getStrategyByStoragePoolDetails(Map<String, String> details) { |
300 | | - if (details == null || details.isEmpty()) { |
301 | | - s_logger.error("getStrategyByStoragePoolDetails: Storage pool details are null or empty"); |
302 | | - throw new CloudRuntimeException("getStrategyByStoragePoolDetails: Storage pool details are null or empty"); |
303 | | - } |
304 | | - String protocol = details.get(Constants.PROTOCOL); |
305 | | - OntapStorage ontapStorage = new OntapStorage(details.get(Constants.USERNAME), details.get(Constants.PASSWORD), |
306 | | - details.get(Constants.MANAGEMENT_LIF), details.get(Constants.SVM_NAME), Long.parseLong(details.get(Constants.SIZE)), ProtocolType.valueOf(protocol), |
307 | | - Boolean.parseBoolean(details.get(Constants.IS_DISAGGREGATED))); |
308 | | - StorageStrategy storageStrategy = StorageProviderFactory.getStrategy(ontapStorage); |
309 | | - boolean isValid = storageStrategy.connect(); |
310 | | - if (isValid) { |
311 | | - s_logger.info("Connection to Ontap SVM [{}] successful", details.get(Constants.SVM_NAME)); |
312 | | - return storageStrategy; |
313 | | - } else { |
314 | | - s_logger.error("getStrategyByStoragePoolDetails: Connection to Ontap SVM [" + details.get(Constants.SVM_NAME) + "] failed"); |
315 | | - throw new CloudRuntimeException("getStrategyByStoragePoolDetails: Connection to Ontap SVM [" + details.get(Constants.SVM_NAME) + "] failed"); |
316 | | - } |
317 | | - } |
318 | 296 | } |
0 commit comments