Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ public void createAsync(DataStore dataStore, DataObject dataObject, AsyncComplet
if (dataObject.getType() == DataObjectType.VOLUME) {
VolumeInfo volInfo = (VolumeInfo) dataObject;

// Create the backend storage object (LUN for iSCSI, no-op for NFS)
CloudStackVolume created = createCloudStackVolume(storagePool, volInfo, details);

// Update CloudStack volume record with storage pool association and protocol-specific details
VolumeVO volumeVO = volumeDao.findById(volInfo.getId());
if (volumeVO != null) {
// Create the backend storage object (LUN for iSCSI, no-op for NFS)
CloudStackVolume created = createCloudStackVolume(storagePool, volInfo, details);

volumeVO.setPoolType(storagePool.getPoolType());
volumeVO.setPoolId(storagePool.getId());

Expand Down Expand Up @@ -723,12 +723,15 @@ private String resolveVolumePathOnOntap(VolumeVO volumeVO, String protocol, Map<
return volumeVO.getPath();
} else if (ProtocolType.ISCSI.name().equalsIgnoreCase(protocol)) {
// For iSCSI, retrieve the LUN name from volume details
String lunName = volumeDetailsDao.findDetail(volumeVO.getId(), OntapStorageConstants.LUN_DOT_NAME) != null ?
volumeDetailsDao.findDetail(volumeVO.getId(), OntapStorageConstants.LUN_DOT_NAME).getValue() : null;
if (lunName == null) {
throw new CloudRuntimeException("No LUN name found for volume " + volumeVO.getId());
}
return lunName;
VolumeDetailVO volumeDetails = volumeDetailsDao.findDetail(volumeVO.getId(), OntapStorageConstants.LUN_DOT_NAME);

if(volumeDetails != null) {
String lunName = volumeDetails.getValue();
if (lunName == null) {
throw new CloudRuntimeException("No LUN name found for volume " + volumeVO.getId());
}
return lunName;
}
}
throw new CloudRuntimeException("Unsupported protocol " + protocol);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ public void deleteStorageVolume(Volume volume) {
logger.info("Deleting ONTAP volume by name: " + volume.getName() + " and uuid: " + volume.getUuid());
String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
try {
// TODO: Implement lun and file deletion, if any, before deleting the volume
JobResponse jobResponse = volumeFeignClient.deleteVolume(authHeader, volume.getUuid());
Boolean jobSucceeded = jobPollForSuccess(jobResponse.getJob().getUuid(), 10, 1000);
if (!jobSucceeded) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public CloudStackVolume getCloudStackVolume(Map<String, String> cloudStackVolume
CloudStackVolume cloudStackVolume = null;
FileInfo fileInfo = getFile(cloudStackVolumeMap.get(OntapStorageConstants.VOLUME_UUID),cloudStackVolumeMap.get(OntapStorageConstants.FILE_PATH));

if (fileInfo != null){
if (fileInfo != null) {
cloudStackVolume = new CloudStackVolume();
cloudStackVolume.setFlexVolumeUuid(cloudStackVolumeMap.get(OntapStorageConstants.VOLUME_UUID));
cloudStackVolume.setFile(fileInfo);
Expand Down Expand Up @@ -298,59 +298,6 @@ private void assignExportPolicyToVolume(String volumeUuid, String policyName) {
}
}

private boolean deleteFile(String volumeUuid, String filePath) {
logger.info("deleteFile: Deleting file: {} from volume: {}", filePath, volumeUuid);
try {
String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
nasFeignClient.deleteFile(authHeader, volumeUuid, filePath);
logger.info("deleteFile: File deleted successfully: {} from volume: {}", filePath, volumeUuid);
return true;
} catch (FeignException e) {
logger.error("deleteFile: Failed to delete file: {} from volume: {}", filePath, volumeUuid, e);
return false;
} catch (Exception e) {
logger.error("deleteFile: Exception while deleting file: {} from volume: {}", filePath, volumeUuid, e);
return false;
}
}

private OntapResponse<FileInfo> getFileInfo(String volumeUuid, String filePath) {
logger.debug("getFileInfo: Getting file info for: {} in volume: {}", filePath, volumeUuid);
try {
String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
OntapResponse<FileInfo> response = nasFeignClient.getFileResponse(authHeader, volumeUuid, filePath);
logger.debug("getFileInfo: Retrieved file info for: {} in volume: {}", filePath, volumeUuid);
return response;
} catch (FeignException e){
if (e.status() == 404) {
logger.debug("getFileInfo: File not found: {} in volume: {}", filePath, volumeUuid);
return null;
}
logger.error("getFileInfo: Failed to get file info: {} in volume: {}", filePath, volumeUuid, e);
throw new CloudRuntimeException("Failed to get file info: " + e.getMessage());
} catch (Exception e){
logger.error("getFileInfo: Exception while getting file info: {} in volume: {}", filePath, volumeUuid, e);
throw new CloudRuntimeException("Failed to get file info: " + e.getMessage());
}
}

private boolean updateFile(String volumeUuid, String filePath, FileInfo fileInfo) {
logger.info("updateFile: Updating file: {} in volume: {}", filePath, volumeUuid);
try {
String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
nasFeignClient.updateFile( authHeader, volumeUuid, filePath, fileInfo);
logger.info("updateFile: File updated successfully: {} in volume: {}", filePath, volumeUuid);
return true;
} catch (FeignException e) {
logger.error("updateFile: Failed to update file: {} in volume: {}", filePath, volumeUuid, e);
return false;
} catch (Exception e){
logger.error("updateFile: Exception while updating file: {} in volume: {}", filePath, volumeUuid, e);
return false;
}
}


private ExportPolicy createExportPolicyRequest(AccessGroup accessGroup,String svmName , String volumeName){

String exportPolicyName = OntapStorageUtils.generateExportPolicyName(svmName,volumeName);
Expand Down
Loading