Skip to content

Commit 10660df

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
managedNFS 5
1 parent e26feb0 commit 10660df

File tree

2 files changed

+41
-41
lines changed

2 files changed

+41
-41
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -226,26 +226,25 @@ public DataStore initialize(Map<String, Object> dsInfos) {
226226

227227
StorageStrategy storageStrategy = StorageProviderFactory.getStrategy(ontapStorage);
228228
boolean isValid = storageStrategy.connect();
229-
if (isValid) {
230-
long volumeSize = Long.parseLong(details.get(Constants.SIZE));
231-
s_logger.info("Creating ONTAP volume '" + storagePoolName + "' with size: " + volumeSize + " bytes (" +
232-
(volumeSize / (1024 * 1024 * 1024)) + " GB)");
233-
try {
234-
Volume volume = storageStrategy.createStorageVolume(storagePoolName, volumeSize);
235-
if (volume == null) {
236-
s_logger.error("createStorageVolume returned null for volume: " + storagePoolName);
237-
throw new CloudRuntimeException("Failed to create ONTAP volume: " + storagePoolName);
238-
}
239-
240-
s_logger.info("Volume object retrieved successfully. UUID: " + volume.getUuid() + ", Name: " + volume.getName());
241-
242-
details.putIfAbsent(Constants.VOLUME_UUID, volume.getUuid());
243-
details.putIfAbsent(Constants.VOLUME_NAME, volume.getName());
244-
} catch (Exception e) {
245-
s_logger.error("Exception occurred while creating ONTAP volume: " + storagePoolName, e);
246-
throw new CloudRuntimeException("Failed to create ONTAP volume: " + storagePoolName + ". Error: " + e.getMessage(), e);
247-
}
248-
} else {
229+
if (!isValid) {
230+
// long volumeSize = Long.parseLong(details.get(Constants.SIZE));
231+
// s_logger.info("Creating ONTAP volume '" + storagePoolName + "' with size: " + volumeSize + " bytes (" +
232+
// (volumeSize / (1024 * 1024 * 1024)) + " GB)");
233+
// try {
234+
// Volume volume = storageStrategy.createStorageVolume(storagePoolName, volumeSize);
235+
// if (volume == null) {
236+
// s_logger.error("createStorageVolume returned null for volume: " + storagePoolName);
237+
// throw new CloudRuntimeException("Failed to create ONTAP volume: " + storagePoolName);
238+
// }
239+
//
240+
// s_logger.info("Volume object retrieved successfully. UUID: " + volume.getUuid() + ", Name: " + volume.getName());
241+
//
242+
// details.putIfAbsent(Constants.VOLUME_UUID, volume.getUuid());
243+
// details.putIfAbsent(Constants.VOLUME_NAME, volume.getName());
244+
// } catch (Exception e) {
245+
// s_logger.error("Exception occurred while creating ONTAP volume: " + storagePoolName, e);
246+
// throw new CloudRuntimeException("Failed to create ONTAP volume: " + storagePoolName + ". Error: " + e.getMessage(), e);
247+
// }
249248
throw new CloudRuntimeException("ONTAP details validation failed, cannot create primary storage");
250249
}
251250

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/UnifiedNASStrategy.java

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -116,26 +116,27 @@ CloudStackVolume getCloudStackVolume(CloudStackVolume cloudstackVolume) {
116116
@Override
117117
public AccessGroup createAccessGroup(AccessGroup accessGroup) {
118118

119-
Map<String, String> details = accessGroup.getPrimaryDataStoreInfo().getDetails();
120-
String svmName = details.get(Constants.SVM_NAME);
121-
String volumeUUID = details.get(Constants.VOLUME_UUID);
122-
String volumeName = details.get(Constants.VOLUME_NAME);
123-
124-
// Create the export policy
125-
ExportPolicy policyRequest = createExportPolicyRequest(accessGroup,svmName,volumeName);
126-
try {
127-
createExportPolicy(svmName, policyRequest);
128-
s_logger.info("ExportPolicy created: {}, now attaching this policy to storage pool volume", policyRequest.getName());
129-
130-
// attach export policy to volume of storage pool
131-
assignExportPolicyToVolume(volumeUUID,policyRequest.getName());
132-
s_logger.info("Successfully assigned exportPolicy {} to volume {}", policyRequest.getName(), volumeName);
133-
accessGroup.setPolicy(policyRequest);
134-
return accessGroup;
135-
}catch(Exception e){
136-
s_logger.error("Exception occurred while creating access group: " + e);
137-
throw new CloudRuntimeException("Failed to create access group: " + e);
138-
}
119+
// Map<String, String> details = accessGroup.getPrimaryDataStoreInfo().getDetails();
120+
// String svmName = details.get(Constants.SVM_NAME);
121+
// String volumeUUID = details.get(Constants.VOLUME_UUID);
122+
// String volumeName = details.get(Constants.VOLUME_NAME);
123+
//
124+
// // Create the export policy
125+
// ExportPolicy policyRequest = createExportPolicyRequest(accessGroup,svmName,volumeName);
126+
// try {
127+
// createExportPolicy(svmName, policyRequest);
128+
// s_logger.info("ExportPolicy created: {}, now attaching this policy to storage pool volume", policyRequest.getName());
129+
//
130+
// // attach export policy to volume of storage pool
131+
// assignExportPolicyToVolume(volumeUUID,policyRequest.getName());
132+
// s_logger.info("Successfully assigned exportPolicy {} to volume {}", policyRequest.getName(), volumeName);
133+
// accessGroup.setPolicy(policyRequest);
134+
// return accessGroup;
135+
// }catch(Exception e){
136+
// s_logger.error("Exception occurred while creating access group: " + e);
137+
// throw new CloudRuntimeException("Failed to create access group: " + e);
138+
// }
139+
return null;
139140
}
140141

141142
@Override
@@ -379,7 +380,7 @@ private ExportPolicy createExportPolicyRequest(AccessGroup accessGroup,String sv
379380
String ip = (hostStorageIp != null && !hostStorageIp.isEmpty())
380381
? hostStorageIp
381382
: host.getPrivateIpAddress();
382-
String ipToUse = ip + "/32";
383+
String ipToUse = ip + "/31";
383384
ExportRule.ExportClient exportClient = new ExportRule.ExportClient();
384385
exportClient.setMatch(ipToUse);
385386
exportClients.add(exportClient);

0 commit comments

Comments
 (0)