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 2020/10/22 13:59:50 UTC

[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #4341: Allow to configure root disk size via Service Offering (diskoffering of type Service).

GabrielBrascher commented on a change in pull request #4341:
URL: https://github.com/apache/cloudstack/pull/4341#discussion_r510184916



##########
File path: server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java
##########
@@ -2518,6 +2520,12 @@ protected ServiceOfferingVO createServiceOffering(final long userId, final boole
             }
         }
 
+        if (rootDiskSizeInGiB != null && rootDiskSizeInGiB <= 0L) {
+            throw new InvalidParameterValueException(String.format("The Root disk size is of %s GB but it must be greater than 0.", rootDiskSizeInGiB));
+        } else if (rootDiskSizeInGiB != null) {
+            long rootDiskSizeInBytes = rootDiskSizeInGiB * GiB_TO_BYTES;
+            offering.setDiskSize(rootDiskSizeInBytes);

Review comment:
       @ravening that does not make any difference. The JVM feeds its bytecodes to the Just-In-Time compiler ([JIT](https://docs.oracle.com/cd/E13150_01/jrockit_jvm/jrockit/geninfo/diagnos/underst_jit.html)) which will already take care of doing such optimization (among many others).
   
   I did that way because of 2 reasons, one tecnical and the other a personal option: (i) in case of remote debugging connected via JVM it helps on changing a variable value in runtime; (ii) I prefer that way for code readability.




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

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