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 2023/01/16 08:59:16 UTC

[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #7073: storage: validate disk size range of custom disk offering when resize volume

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


##########
server/src/main/java/com/cloud/storage/VolumeApiServiceImpl.java:
##########
@@ -872,6 +867,16 @@ public VolumeVO allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationExcept
                 _uuidMgr.generateUuid(Volume.class, cmd.getCustomId()), details);
     }
 
+    @Override
+    public void validateCustomDiskOfferingSizeRange(Long sizeInGB) {
+        Long customDiskOfferingMaxSize = VolumeOrchestrationService.CustomDiskOfferingMaxSize.value();
+        Long customDiskOfferingMinSize = VolumeOrchestrationService.CustomDiskOfferingMinSize.value();
+
+        if ((sizeInGB < customDiskOfferingMinSize) || (sizeInGB > customDiskOfferingMaxSize)) {
+            throw new InvalidParameterValueException("Volume size: " + sizeInGB + "GB is out of allowed range. Max: " + customDiskOfferingMaxSize + " Min:" + customDiskOfferingMinSize);

Review Comment:
   @weizhouapache , will you apply this suggestion?



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