sandeeplocharla commented on code in PR #14523:
URL: https://github.com/apache/cloudstack/pull/14523#discussion_r4524973616
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/utils/OntapStorageConstants.java:
##########
@@ -127,6 +127,9 @@ public class OntapStorageConstants {
public static final int ONTAP_SFSR_JOB_POLL_INTERVAL_MS = 2000;
public static final int ONTAP_SNAPSHOT_DELETE_JOB_MAX_RETRIES = 30;
public static final int ONTAP_SNAPSHOT_DELETE_JOB_POLL_INTERVAL_MS = 2000;
+ /** Retry settings for FlexVolume create/resize/delete job polling. */
+ public static final int ONTAP_VOLUME_JOB_MAX_RETRIES = 10;
+ public static final int ONTAP_VOLUME_JOB_POLL_INTERVAL_MS = 1000;
Review Comment:
Yep makes sense, will reuse the existing constants. Thankyou!!!
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java:
##########
@@ -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());
+ String authHeader =
OntapStorageUtils.generateAuthHeader(storage.getUsername(),
storage.getPassword());
+ try {
+ Volume resizeRequest = new Volume();
Review Comment:
Yeah! makes sense but given that this method's sole purpose is to resize the
flexVol, I feel the name works along.
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java:
##########
@@ -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());
Review Comment:
This method gets called only to resize the flexVol. So, it should be alright
to call it out this way
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java:
##########
@@ -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());
+ String authHeader =
OntapStorageUtils.generateAuthHeader(storage.getUsername(),
storage.getPassword());
+ try {
+ Volume resizeRequest = new Volume();
+ resizeRequest.setSize(volume.getSize());
Review Comment:
`updateStoragePool(StoragePool storagePool, Map<String, String> details)`
already has a 'null' check on 'newCapacityStr', so, the call wouldn't even
reach here if 'volume.getSize() == null'
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/lifecycle/OntapPrimaryDatastoreLifecycle.java:
##########
@@ -551,7 +551,34 @@ public boolean migrateToObjectStore(DataStore store) {
@Override
public void updateStoragePool(StoragePool storagePool, Map<String, String>
details) {
+ String newCapacityStr =
details.get(PrimaryDataStoreLifeCycle.CAPACITY_BYTES);
+ if (newCapacityStr == null) {
Review Comment:
Yes, `updateStoragePool` gets called only to resize the capacity bytes.
##########
plugins/storage/volume/ontap/src/main/java/org/apache/cloudstack/storage/service/StorageStrategy.java:
##########
@@ -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());
+ String authHeader =
OntapStorageUtils.generateAuthHeader(storage.getUsername(),
storage.getPassword());
+ try {
+ Volume resizeRequest = new Volume();
+ resizeRequest.setSize(volume.getSize());
+ JobResponse jobResponse =
volumeFeignClient.updateVolume(authHeader, volume.getUuid(), resizeRequest);
+ pollJobIfPresent(jobResponse, "resize FlexVolume [" +
volume.getUuid() + "]",
+ OntapStorageConstants.ONTAP_VOLUME_JOB_MAX_RETRIES,
OntapStorageConstants.ONTAP_VOLUME_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());
Review Comment:
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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]