Skip to content

Commit 953c552

Browse files
Srivastava, PiyushSrivastava, Piyush
authored andcommitted
vm instance creation test1
1 parent 8ebc1e1 commit 953c552

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/driver/OntapPrimaryDatastoreDriver.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -128,22 +128,19 @@ private String createCloudStackVolumeForTypeVolume(DataStore dataStore, DataObje
128128
throw new CloudRuntimeException("createCloudStackVolume : Storage Pool not found for id: " + dataStore.getId());
129129
}
130130
Map<String, String> details = storagePoolDetailsDao.listDetailsKeyPairs(dataStore.getId());
131+
// For NFS, skip ONTAP REST API operations - CloudStack manages files natively
132+
if (ProtocolType.NFS.name().equalsIgnoreCase(details.get(Constants.PROTOCOL))) {
133+
String volumeUuid = ((VolumeInfo) dataObject).getUuid();
134+
s_logger.info("createCloudStackVolumeForTypeVolume: NFS protocol detected - returning volume UUID for native file management: {}", volumeUuid);
135+
return volumeUuid;
136+
}
137+
// For iSCSI and other protocols, use ONTAP REST API
131138
StorageStrategy storageStrategy = getStrategyByStoragePoolDetails(details);
132139
s_logger.info("createCloudStackVolumeForTypeVolume: Connection to Ontap SVM [{}] successful, preparing CloudStackVolumeRequest", details.get(Constants.SVM_NAME));
133140
CloudStackVolume cloudStackVolumeRequest = Utility.createCloudStackVolumeRequestByProtocol(storagePool, details, (VolumeInfo) dataObject);
134141
CloudStackVolume cloudStackVolume = storageStrategy.createCloudStackVolume(cloudStackVolumeRequest);
135142
if (ProtocolType.ISCSI.name().equalsIgnoreCase(details.get(Constants.PROTOCOL)) && cloudStackVolume.getLun() != null && cloudStackVolume.getLun().getName() != null) {
136143
return cloudStackVolume.getLun().getName();
137-
} else if (ProtocolType.NFS.name().equalsIgnoreCase(details.get(Constants.PROTOCOL))) {
138-
// For NFS, ONTAP creates a directory for organization
139-
// CloudStack will create the actual .qcow2 file inside this directory
140-
String directoryName = cloudStackVolume.getCloudstackVolName();
141-
String volumeUuid = ((VolumeInfo) dataObject).getUuid();
142-
// Return path: "directory-name/volume-uuid"
143-
// CloudStack will append .qcow2 extension when creating the actual disk file
144-
String volumePath = directoryName + "/" + volumeUuid;
145-
s_logger.info("createCloudStackVolumeForTypeVolume: NFS volume directory [{}] created, returning path: {}", directoryName, volumePath);
146-
return volumePath;
147144
} else {
148145
String errMsg = "createCloudStackVolumeForTypeVolume: Volume creation failed. Lun or Lun Path is null for dataObject: " + dataObject;
149146
s_logger.error(errMsg);

plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/Utility.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public static CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePo
8181
cloudStackVolumeRequest.setVolume(poolVolume);
8282
cloudStackVolumeRequest.setFile(file);
8383
cloudStackVolumeRequest.setCloudstackVolName(volumeObject.getName());
84-
cloudStackVolumeRequest.setCloudstackVolName(volumeObject.getUuid());
84+
cloudStackVolumeRequest.setCloudstackVolUUID(volumeObject.getUuid());
8585
break;
8686
case ISCSI:
8787
cloudStackVolumeRequest = new CloudStackVolume();

0 commit comments

Comments
 (0)