piyush5netapp commented on code in PR #14523:
URL: https://github.com/apache/cloudstack/pull/14523#discussion_r4521653022


##########
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:
   How is this constant different from below constant 
ONTAP_FLEXVOL_JOB_POLL_INTERVAL_MS ? Check if it can be re-used.



##########
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:
   remove keyword like resize for method to be generic update and also 
volume.getSize().



##########
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:
   have null check and set only if it not null for it be to generic update 
method



##########
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 above, remove all occurence of resize keyword.



##########
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:
   rename variable to be generic update request



##########
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:
   is update storage pool only called for capacity bytes, if not we should skip 
throwing this error.



-- 
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]

Reply via email to