-
Notifications
You must be signed in to change notification settings - Fork 0
CSTACKEX-234: Enabling storage pool resize (grow and shrink) #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
dd1844c
0ab1f68
b1f78c1
67913b0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -526,7 +526,26 @@ public boolean migrateToObjectStore(DataStore store) { | |
|
|
||
| @Override | ||
| public void updateStoragePool(StoragePool storagePool, Map<String, String> details) { | ||
| long currentCapacityBytes = storagePool.getCapacityBytes(); | ||
| long newCapacityBytes = Long.parseLong(details.get(PrimaryDataStoreLifeCycle.CAPACITY_BYTES)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
||
|
sathvikaragi marked this conversation as resolved.
|
||
| Volume volume = new Volume(); | ||
| volume.setUuid(details.get(OntapStorageConstants.VOLUME_UUID)); | ||
| volume.setName(details.get(OntapStorageConstants.VOLUME_NAME)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why volume name is required? |
||
| 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 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why to pass size as a new param? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
|
||
There was a problem hiding this comment.
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