Repository navigation
NetApp ONTAP Storage Pool resize #14523
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
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 |
|---|---|---|
|
|
@@ -387,7 +387,25 @@ public Volume createStorageVolume(String volumeName, Long size) { | |
| * @return the updated Volume object | ||
| */ | ||
| public Volume updateStorageVolume(Volume volume) { | ||
| return null; | ||
| logger.info("Resizing ONTAP FlexVolume '{}' (UUID: {}) to {} bytes", volume.getName(), volume.getUuid(), volume.getSize()); | ||
|
Contributor
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. remove keyword like resize for method to be generic update and also volume.getSize().
Contributor
Author
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 gets called only to resize the flexVol. So, it should be alright to call it out this way |
||
| String authHeader = OntapStorageUtils.generateAuthHeader(storage.getUsername(), storage.getPassword()); | ||
| try { | ||
| Volume resizeRequest = new Volume(); | ||
|
Contributor
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. rename variable to be generic update request
Contributor
Author
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. Yeah! makes sense but given that this method's sole purpose is to resize the flexVol, I feel the name works along. |
||
| resizeRequest.setSize(volume.getSize()); | ||
|
Contributor
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. have null check and set only if it not null for it be to generic update method
Contributor
Author
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 jobResponse = volumeFeignClient.updateVolume(authHeader, volume.getUuid(), resizeRequest); | ||
| pollJobIfPresent(jobResponse, "resize FlexVolume [" + volume.getUuid() + "]", | ||
| OntapStorageConstants.ONTAP_FLEXVOL_RESOLVE_MAX_RETRIES, OntapStorageConstants.ONTAP_FLEXVOL_JOB_POLL_INTERVAL_MS); | ||
| logger.info("FlexVolume '{}' (UUID: {}) resized successfully to {} bytes", volume.getName(), volume.getUuid(), volume.getSize()); | ||
| } catch (FeignException e) { | ||
| if (OntapStorageUtils.isOntapObjectNotFoundError(e)) { | ||
| String msg = String.format("Cannot resize FlexVolume '%s' (UUID: %s): volume not found on ONTAP (404). ", volume.getName(), volume.getUuid()); | ||
|
Contributor
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. same as above, remove all occurence of resize keyword.
Contributor
Author
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. Same as replied before, this method is currently used only for resizing the flexVol, so, until we come across an alternate usecase that uses this method, let's keep it the same. |
||
| logger.error(msg); | ||
| throw new CloudRuntimeException(msg, e); | ||
| } | ||
| logger.error("Exception while resizing FlexVolume '{}' (UUID: {}): {}", volume.getName(), volume.getUuid(), e.getMessage(), e); | ||
| throw new CloudRuntimeException("Failed to resize ONTAP FlexVolume: " + e.getMessage(), e); | ||
| } | ||
| return volume; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
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.
is update storage pool only called for capacity bytes, if not we should skip throwing this error.
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.
Yes,
updateStoragePoolgets called only to resize the capacity bytes.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.
It can also be called for iops change also. Since this method is generic update, instead of having null check , have not null check for changes fields.
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.
We don't apply iops on flexVol, so resize is the only usecase