You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2022/08/29 12:44:13 UTC

[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6681: change-diskoffer: iops settings from new disk-offer should always used

DaanHoogland commented on code in PR #6681:
URL: https://github.com/apache/cloudstack/pull/6681#discussion_r957277335


##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -1982,20 +1982,21 @@ private void validateVolumeResizeWithNewDiskOfferingAndLoad(VolumeVO volume, Dis
             } else {
                 newSize[0] = newDiskOffering.getDiskSize();
             }
-            if (newDiskOffering.isCustomizedIops() != null && newDiskOffering.isCustomizedIops()) {
-                newMinIops[0] = newMinIops[0] != null ? newMinIops[0] : volume.getMinIops();
-                newMaxIops[0] = newMaxIops[0] != null ? newMaxIops[0] : volume.getMaxIops();
-
-                validateIops(newMinIops[0], newMaxIops[0], volume.getPoolType());
-            } else {
-                newMinIops[0] = newDiskOffering.getMinIops();
-                newMaxIops[0] = newDiskOffering.getMaxIops();
-            }
 
             // if the hypervisor snapshot reserve value is null, it must remain null (currently only KVM uses null and null is all KVM uses for a value here)
             newHypervisorSnapshotReserve[0] = volume.getHypervisorSnapshotReserve() != null ? newDiskOffering.getHypervisorSnapshotReserve() : null;
         }
 
+        if (newDiskOffering.isCustomizedIops() != null && newDiskOffering.isCustomizedIops()) {
+            newMinIops[0] = newMinIops[0] != null ? newMinIops[0] : volume.getMinIops();
+            newMaxIops[0] = newMaxIops[0] != null ? newMaxIops[0] : volume.getMaxIops();
+
+            validateIops(newMinIops[0], newMaxIops[0], volume.getPoolType());
+        } else {
+            newMinIops[0] = newDiskOffering.getMinIops();
+            newMaxIops[0] = newDiskOffering.getMaxIops();
+        }
+

Review Comment:
   sugest making a 
   ```
       private void setNewIopsLimits(VolumeVO volume, DiskOfferingVO newDiskOffering, Long[] newMinIops, Long[] newMaxIops) {
           if (newDiskOffering.isCustomizedIops() != null && newDiskOffering.isCustomizedIops()) {
               newMinIops[0] = newMinIops[0] != null ? newMinIops[0] : volume.getMinIops();
               newMaxIops[0] = newMaxIops[0] != null ? newMaxIops[0] : volume.getMaxIops();
   
               validateIops(newMinIops[0], newMaxIops[0], volume.getPoolType());
           } else {
               newMinIops[0] = newDiskOffering.getMinIops();
               newMaxIops[0] = newDiskOffering.getMaxIops();
           }
       }
   ```
   and 
   ```suggestion
           setNewIopsLimits(volume, newDiskOffering, newMinIops, newMaxIops);
   ```



-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org