Skip to content
Open
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 @@ -526,7 +526,26 @@ public boolean migrateToObjectStore(DataStore store) {

@Override
public void updateStoragePool(StoragePool storagePool, Map<String, String> details) {
long currentCapacityBytes = storagePool.getCapacityBytes();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add sufficient unit test cases for this functionality

long newCapacityBytes = Long.parseLong(details.get(PrimaryDataStoreLifeCycle.CAPACITY_BYTES));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the below comment is valid, include null check

StorageStrategy storageStrategy = OntapStorageUtils.getStrategyByStoragePoolDetails(details);

Comment thread
sathvikaragi marked this conversation as resolved.
Volume volume = new Volume();
volume.setUuid(details.get(OntapStorageConstants.VOLUME_UUID));
volume.setName(details.get(OntapStorageConstants.VOLUME_NAME));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why volume name is required?
we can just use UUID

try {
if (volume.getUuid() == null || volume.getUuid().isEmpty() || volume.getName() == null || volume.getName().isEmpty()) {
logger.error("Volume UUID/Name not found in details for pool: {}, cannot resize", storagePool.getName());
throw new CloudRuntimeException("Volume UUID/Name not found in details, cannot resize ONTAP FlexVolume");
}
storageStrategy.updateStorageVolume(volume, newCapacityBytes);
logger.info("Successfully resized ONTAP FlexVolume '{}' (UUID: {}) for pool '{}' from {} bytes to {} bytes",
volume.getName(), volume.getUuid(), storagePool.getName(), currentCapacityBytes, newCapacityBytes);
} catch (Exception e) {
logger.error(" Exception while resizing FlexVolume for pool: {}. Error: {}",
storagePool.getName(), e.getMessage(), e);
throw new CloudRuntimeException("Failed to resize ONTAP FlexVolume for pool: " + storagePool.getName() + ". " + e.getMessage(), e);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,25 @@ public Volume createStorageVolume(String volumeName, Long size) {
* @param volume the volume to update
* @return the updated Volume object
*/
public Volume updateStorageVolume(Volume volume) {
return null;
public Volume updateStorageVolume(Volume volume, Long newSizeBytes) {

@suryag1201 suryag1201 Aug 11, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why to pass size as a new param?
We can use the volume object also

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add logger

String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword());
Volume resizeRequest = new Volume();
resizeRequest.setSize(newSizeBytes);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to set this value if use volume object directly

try {
JobResponse jobResponse = volumeFeignClient.updateVolumeRebalancing(authHeader, volume.getUuid(), resizeRequest);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i understand this method already exists but the method naming is not proper and used only one place during export policy attach. Please check and rename this method.

Boolean jobSucceeded = jobPollForSuccess(jobResponse.getJob().getUuid(), 10, 1000);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jobResponse.getJob().getUuid() this can throw NPE, if jobResponse.getJob() is null, handle this case

if (!jobSucceeded) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this condition will never come, it is dead code

logger.error("resize job failed for FlexVolume: " + volume.getName());
throw new CloudRuntimeException("resize job failed for FlexVolume: " + volume.getName());
}
logger.info("Volume is resized successfully for : " + volume.getName());
} catch (FeignException e) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method should handle other exception also, bcz job polling can get time out and throw cloudRuntime Exception

logger.error("Exception while resizing FlexVolume: " + volume.getName(), e);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if requested volume for resize does not found on ontap, handle this case also

throw new CloudRuntimeException("Failed to resize ONTAP FlexVolume: " + e.getMessage(), e);
}
return volume;
}

/**
/**
* Delete ONTAP Flex-Volume
* Eligible only for Unified ONTAP storage
* throw exception in case of disaggregated ONTAP storage
Expand Down
Loading