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 2021/06/08 05:51:43 UTC

[GitHub] [cloudstack] GabrielBrascher opened a new pull request #5085: Root disk size should be listed in GB at listServiceOffering

GabrielBrascher opened a new pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085


   ### Description
   
   When listing service offerings it is expected to list their Root disk size in GB (see documentation [[1]](http://cloudstack.apache.org/api/apidocs-4.15/apis/listServiceOfferings.html)); however, it is returned in Bytes.
   Additionally, during deployment of a VM or creation of a Service Offering the root disk size is always passed as a value in GB [[2]](https://cloudstack.apache.org/api/apidocs-4.15/apis/deployVirtualMachine.html).
   
   This PR aims to fix this by converting the root disk size at the ServiceOffering response to Bytes.
   
   [1] http://cloudstack.apache.org/api/apidocs-4.15/apis/listServiceOfferings.html
   [2] https://cloudstack.apache.org/api/apidocs-4.15/apis/deployVirtualMachine.html
   
   <!--- ********************************************************************************* -->
   <!--- NOTE: AUTOMATATION USES THE DESCRIPTIONS TO SET LABELS AND PRODUCE DOCUMENTATION. -->
   <!--- PLEASE PUT AN 'X' in only **ONE** box -->
   <!--- ********************************************************************************* -->
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [ ] Bug fix (non-breaking change which fixes an issue)
   - [X] Enhancement (improves an existing feature and functionality)
   - [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Feature/Enhancement Scale
   
   - [ ] Major
   - [X] Minor
   
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [X] Trivial
   
   
   ### Screenshots (if appropriate):
   N/A
   
   ### How Has This Been Tested?
   <!-- Please describe in detail how you tested your changes. -->
   <!-- Include details of your testing environment, and the tests you ran to -->
   <!-- see how your change affects other areas of the code, etc. -->
   List Service offerings via CloudMonkey (or any other way of calling API). Example: `list serviceofferings filter=rootdisksize`.
   
   #### 1. Currently
   ~~~
   list serviceofferings filter=rootdisksize
   rootdisksize
   3.221225472e+10
   3.221225472e+10
   3.221225472e+10
   3.221225472e+10
   1.073741824e+11
   ~~~
   
   #### 2. With the fix
   ~~~
   list serviceofferings filter=rootdisksize
   rootdisksize
   30
   30
   30
   30
   100
   ~~~
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md) document -->
   


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



[GitHub] [cloudstack] rhtyd commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856530666


   @blueorangutan package 


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



[GitHub] [cloudstack] shwstppr commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
shwstppr commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856525091


   @GabrielBrascher this will require change in UI as well. Somewhere here, https://github.com/apache/cloudstack/blob/4.15/ui/src/components/view/DetailsTab.vue#L36-L40


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



[GitHub] [cloudstack] blueorangutan commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856531368


   @rhtyd a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.


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



[GitHub] [cloudstack] rhtyd merged pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
rhtyd merged pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085


   


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



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on a change in pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#discussion_r647648448



##########
File path: ui/src/components/view/DetailsTab.vue
##########
@@ -35,7 +35,7 @@
         </div>
         <div v-else-if="$route.meta.name === 'computeoffering' && item === 'rootdisksize'">
           <div>
-            {{ parseFloat( resource.rootdisksize / (1024.0 * 1024.0 * 1024.0)).toFixed(1) }} GB
+            {{ resource.rootdisksize }} GB

Review comment:
       @shwstppr thanks for pointing out the change necessary to keep UI aligned with API.
   I believe this will fix it, please let me know if I am missing anything.




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



[GitHub] [cloudstack] blueorangutan commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-857046081


   <b>Trillian test result (tid-896)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 39529 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr5085-t896-kvm-centos7.zip
   Intermittent failure detected: /marvin/tests/smoke/test_routers_network_ops.py
   Intermittent failure detected: /marvin/tests/smoke/test_vpc_redundant.py
   Smoke tests completed. 85 look OK, 2 have error(s)
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_02_RVR_Network_FW_PF_SSH_default_routes_egress_false | `Failure` | 304.87 | test_routers_network_ops.py
   test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routers | `Failure` | 422.90 | test_vpc_redundant.py
   


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



[GitHub] [cloudstack] blueorangutan commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856548675


   Packaging result: :heavy_check_mark: centos7 :heavy_check_mark: centos8 :heavy_check_mark: debian. SL-JID 187


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



[GitHub] [cloudstack] blueorangutan commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856956843


   @GabrielBrascher a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.


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



[GitHub] [cloudstack] GabrielBrascher commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856956178


   @blueorangutan ui


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



[GitHub] [cloudstack] blueorangutan commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
blueorangutan commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856551816


   @rhtyd a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests


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



[GitHub] [cloudstack] GabrielBrascher commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856970480


   It looks like the UI change has been successfully applied.
   
   See http://qa.cloudstack.cloud:8080/client/pr/5085/#/computeoffering/7becb40b-315a-413f-a89a-5a8b8c6b01b0
   
   ![image](https://user-images.githubusercontent.com/5025148/121233097-a7a9a900-c868-11eb-9098-4d5b5ef70677.png)
   
   One can compare with how it was (e.g. at this PR http://qa.cloudstack.cloud:8080/client/pr/5080/#/computeoffering/7becb40b-315a-413f-a89a-5a8b8c6b01b0)
   
   ![image](https://user-images.githubusercontent.com/5025148/121232921-73ce8380-c868-11eb-80a7-0a248a3bdcd1.png)
   
   


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



[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on a change in pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#discussion_r647998852



##########
File path: server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
##########
@@ -45,6 +45,13 @@
 
     private SearchBuilder<ServiceOfferingJoinVO> sofIdSearch;
 
+    /**
+     * Constant used to convert GB into Bytes (or the other way around).
+     * GB   *  MB  *  KB  = Bytes //
+     * 1024 * 1024 * 1024 = 1073741824
+     */
+    private static final long GB_TO_BYTES = 1073741824;

Review comment:
       multiple constants are defined, in various classes, for the value "1024 * 1024 * 1024", and it is hardcoded in some cases. may be (later), a constant can be defined in common package( eg. cloud utils), and use it across. (Such common util functions has to be documented, so that the developers can use these)
   
   Also, some get disk size calls return size in Bytes, and others return in GB. I think, it is better to explicitly mention (in variables / methods) it indicating Bytes or GB for non-default unit (i.e. If Bytes is the default unit, then methods which return in 'GB' should have it mentioned). If there is no such default unit, then variables / methods should indicate the size units explicitly. This can be a huge refactoring work (so can be skipped for now) and at least, have to make sure new code indicates proper size unit.




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



[GitHub] [cloudstack] GabrielBrascher commented on a change in pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
GabrielBrascher commented on a change in pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#discussion_r648276765



##########
File path: server/src/main/java/com/cloud/api/query/dao/ServiceOfferingJoinDaoImpl.java
##########
@@ -45,6 +45,13 @@
 
     private SearchBuilder<ServiceOfferingJoinVO> sofIdSearch;
 
+    /**
+     * Constant used to convert GB into Bytes (or the other way around).
+     * GB   *  MB  *  KB  = Bytes //
+     * 1024 * 1024 * 1024 = 1073741824
+     */
+    private static final long GB_TO_BYTES = 1073741824;

Review comment:
       @sureshanaparti I totally agree with you. We had many issues in the past and it still haunts us. If we simply added a proper name and documentation it would help a lot many bugs that we face and also make new features and extensions easier on that matter.
   
   Regarding the constant. You have a good point; we could create constants/enums for such conversions as many times we store in Bytes but make it available to users in GB or MB.




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



[GitHub] [cloudstack] rhtyd commented on pull request #5085: Root disk size should be listed in GB at listServiceOffering

Posted by GitBox <gi...@apache.org>.
rhtyd commented on pull request #5085:
URL: https://github.com/apache/cloudstack/pull/5085#issuecomment-856551286


   @blueorangutan test 


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