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/07/29 11:44:47 UTC

[GitHub] [cloudstack] sureshanaparti opened a new pull request, #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

sureshanaparti opened a new pull request, #6587:
URL: https://github.com/apache/cloudstack/pull/6587

   ### Description
   
   This PR updates primary_storage resource counter to include correct size after volume creation/resize and other improvements.
   
   - Recalculate resource counters for root domain in the periodic task
   - Update correct size in the primary_storage resource counter after volume creation/resize
   - Some code improvements
   
   <!--- Describe your changes in DETAIL - And how has behaviour functionally changed. -->
   
   <!-- For new features, provide link to FS, dev ML discussion etc. -->
   <!-- In case of bug fix, the expected and actual behaviours, steps to reproduce. -->
   
   <!-- When "Fixes: #<id>" is specified, the issue/PR will automatically be closed when this PR gets merged -->
   <!-- For addressing multiple issues/PRs, use multiple "Fixes: #<id>" -->
   <!-- Fixes: # -->
   
   <!--- ********************************************************************************* -->
   <!--- 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)
   - [x] 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
   - [x] Major
   - [ ] Minor
   - [ ] Trivial
   
   ### 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. -->
   
   Manually tested VM/Volume operations using ScaleIO pool and checked the primary_storage resource counters for different domains.
   
   Before fix (_primarystorageavailable_ counter is not shown appropriately for unlimited):
   
   ```
   (testenv) 🐱 > list domains filter=name,primarystoragetotal,primarystoragelimit,primarystorageavailable
   {
     "count": 3,
     "domain": [
       {
         "name": "ROOT",
         "primarystorageavailable": "Unlimited",
         "primarystoragelimit": "Unlimited",
         "primarystoragetotal": -5
       },
       {
         "name": "Domain01",
         "primarystorageavailable": "-1",
         "primarystoragelimit": "-1",
         "primarystoragetotal": 0
       },
       {
         "name": "Domain02",
         "primarystorageavailable": "-1",
         "primarystoragelimit": "-1",
         "primarystoragetotal": 0
       }
     ]
   }
   (testenv) 🐱 > list domains filter=name,primarystoragetotal,primarystoragelimit,primarystorageavailable
   {
     "count": 3,
     "domain": [
       {
         "name": "ROOT",
         "primarystorageavailable": "Unlimited",
         "primarystoragelimit": "Unlimited",
         "primarystoragetotal": 3
       },
       {
         "name": "Domain01",
         "primarystorageavailable": "-9",
         "primarystoragelimit": "-1",
         "primarystoragetotal": 8
       },
       {
         "name": "Domain02",
         "primarystorageavailable": "-1",
         "primarystoragelimit": "-1",
         "primarystoragetotal": 0
       }
     ]
   }
   (testenv) 🐱 > list domains filter=name,primarystoragetotal,primarystoragelimit,primarystorageavailable
   {
     "count": 3,
     "domain": [
       {
         "name": "ROOT",
         "primarystorageavailable": "Unlimited",
         "primarystoragelimit": "Unlimited",
         "primarystoragetotal": 6
       },
       {
         "name": "Domain01",
         "primarystorageavailable": "-25",
         "primarystoragelimit": "-1",
         "primarystoragetotal": 24
       },
       {
         "name": "Domain02",
         "primarystorageavailable": "-1",
         "primarystoragelimit": "-1",
         "primarystoragetotal": 0
       }
     ]
   }
   ```
   
   After fix =>
   
   ```
   (testenv) 🐱 > list domains filter=name,primarystoragetotal,primarystoragelimit,primarystorageavailable
   {
     "count": 3,
     "domain": [
       {
         "name": "ROOT",
         "primarystorageavailable": "Unlimited",
         "primarystoragelimit": "Unlimited",
         "primarystoragetotal": 88
       },
       {
         "name": "Domain01",
         "primarystorageavailable": "Unlimited",
         "primarystoragelimit": "Unlimited",
         "primarystoragetotal": 40
       },
       {
         "name": "Domain02",
         "primarystorageavailable": "Unlimited",
         "primarystoragelimit": "Unlimited",
         "primarystoragetotal": 24
       }
     ]
   }
   ```
   
   <!-- Please read the [CONTRIBUTING](https://github.com/apache/cloudstack/blob/main/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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_multiplication_x: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3944


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   @DaanHoogland a Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. 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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_multiplication_x: el7 :heavy_check_mark: el8 :heavy_multiplication_x: debian :heavy_multiplication_x: suse15. SL-JID 3913


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   @sureshanaparti a Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. 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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] rohityadavcloud commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
rohityadavcloud commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1216420733

   cc @harikrishna-patnala @shwstppr @DaanHoogland do we need this in 4.17 branch?


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


[GitHub] [cloudstack] sonarcloud[bot] commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1199231228

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_cloudstack&pullRequest=6587)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=BUG) [![C](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/C-16px.png 'C')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=BUG) [5 Bugs](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6587&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6587&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6587&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=CODE_SMELL) [1 Code Smell](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=CODE_SMELL)
   
   [![15.3%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0-16px.png '15.3%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_coverage&view=list) [15.3% Coverage](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_duplicated_lines_density&view=list)
   
   


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3856


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


[GitHub] [cloudstack] acs-robot commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
acs-robot commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1204101001

   Found UI changes, kicking a new UI QA build
   @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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   @sureshanaparti a Jenkins job has been kicked to build packages. It will be bundled with  KVM, XenServer and VMware SystemVM templates. 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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] sureshanaparti commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1199222693

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#discussion_r936755553


##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java:
##########
@@ -678,6 +682,32 @@ protected void updateVolumeInfo(VolumeObjectTO newVolume, VolumeVO volumeVo, boo
         s_logger.debug(String.format("Updated %s from %s to %s ", volumeVo.getVolumeDescription(), previousValues, newValues));
     }
 
+    protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO volumeVo) {
+        if (newVolume == null || newVolume.getSize() == null || volumeVo == null || volumeVo.getSize() == null) {

Review Comment:
   ```suggestion
           if (newVolume == null || newVolume.getSize() == null || oldVolume == null || oldVolume.getSize() == null) {
   ```



##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java:
##########
@@ -678,6 +682,32 @@ protected void updateVolumeInfo(VolumeObjectTO newVolume, VolumeVO volumeVo, boo
         s_logger.debug(String.format("Updated %s from %s to %s ", volumeVo.getVolumeDescription(), previousValues, newValues));
     }
 
+    protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO volumeVo) {

Review Comment:
   ```suggestion
       protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO oldVolume) {
   ```



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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_multiplication_x: el7 :heavy_multiplication_x: el8 :heavy_multiplication_x: debian :heavy_check_mark: suse15. SL-JID 3902


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] DaanHoogland commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1204944683

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] sureshanaparti commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1207450676

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] sonarcloud[bot] commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1204195079

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_cloudstack&pullRequest=6587)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6587&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6587&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_cloudstack&pullRequest=6587&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=apache_cloudstack&pullRequest=6587&resolved=false&types=CODE_SMELL)
   
   [![15.5%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/0-16px.png '15.5%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_coverage&view=list) [15.5% Coverage](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_cloudstack&pullRequest=6587&metric=new_duplicated_lines_density&view=list)
   
   


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


[GitHub] [cloudstack] borisstoyanov commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
borisstoyanov commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1211610113

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#discussion_r936754491


##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java:
##########
@@ -678,6 +682,32 @@ protected void updateVolumeInfo(VolumeObjectTO newVolume, VolumeVO volumeVo, boo
         s_logger.debug(String.format("Updated %s from %s to %s ", volumeVo.getVolumeDescription(), previousValues, newValues));
     }
 
+    protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO volumeVo) {
+        if (newVolume == null || newVolume.getSize() == null || volumeVo == null || volumeVo.getSize() == null) {
+            return;
+        }
+
+        Long newVolumeSize = newVolume.getSize();
+        if (newVolumeSize == volumeVo.getSize()) {
+            // Volume size already updated, check with earlier vo in the object
+            if (volumeVO.getSize() != null && volumeVO.getSize() != newVolumeSize) {
+                Long oldVolumeSize = volumeVO.getSize();
+                if (oldVolumeSize < newVolumeSize) {
+                    resourceLimitMgr.incrementResourceCount(volumeVo.getAccountId(), ResourceType.primary_storage, volumeVo.isDisplayVolume(), newVolumeSize - oldVolumeSize);
+                } else {
+                    resourceLimitMgr.decrementResourceCount(volumeVo.getAccountId(), ResourceType.primary_storage, volumeVo.isDisplayVolume(), oldVolumeSize - newVolumeSize);
+                }
+            }
+        } else {
+            Long oldVolumeSize = volumeVo.getSize();
+            if (oldVolumeSize < newVolumeSize) {
+                resourceLimitMgr.incrementResourceCount(volumeVo.getAccountId(), ResourceType.primary_storage, volumeVo.isDisplayVolume(), newVolumeSize - oldVolumeSize);
+            } else {
+                resourceLimitMgr.decrementResourceCount(volumeVo.getAccountId(), ResourceType.primary_storage, volumeVo.isDisplayVolume(), oldVolumeSize - newVolumeSize);
+            }
+        }

Review Comment:
   ```suggestion
           long newVolumeSize = newVolume.getSize();
           long oldVolumeSize = oldVolume.getSize();
           if (newVolumeSize != oldVolumeSize) {
               if (oldVolumeSize < newVolumeSize) {
                   resourceLimitMgr.incrementResourceCount(oldVolume.getAccountId(), ResourceType.primary_storage, oldVolume.isDisplayVolume(), newVolumeSize - oldVolumeSize);
               } else {
                   resourceLimitMgr.decrementResourceCount(oldVolume.getAccountId(), ResourceType.primary_storage, oldVolume.isDisplayVolume(), oldVolumeSize - newVolumeSize);
               }
           }
   ```



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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   @acs-robot 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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] DaanHoogland merged pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
DaanHoogland merged PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587


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


[GitHub] [cloudstack] sureshanaparti commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
sureshanaparti commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1199186828

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_multiplication_x: el7 :heavy_check_mark: el8 :heavy_multiplication_x: debian :heavy_multiplication_x: suse15. SL-JID 3926


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   @borisstoyanov a Jenkins job has been kicked to build packages. It will be bundled with
    SystemVM template(s). 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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_multiplication_x: el7 :heavy_check_mark: el8 :heavy_multiplication_x: debian :heavy_multiplication_x: suse15. SL-JID 3907


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


[GitHub] [cloudstack] borisstoyanov commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
borisstoyanov commented on PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#issuecomment-1208978889

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

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   <b>Trillian test result (tid-4672)</b>
   Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
   Total time taken: 39739 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr6587-t4672-kvm-centos7.zip
   Smoke tests completed. 100 look OK, 1 have errors
   Only failed tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_08_upgrade_kubernetes_ha_cluster | `Failure` | 621.02 | test_kubernetes_clusters.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.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_check_mark: el7 :heavy_check_mark: el8 :heavy_check_mark: debian :heavy_check_mark: suse15. SL-JID 3945


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   UI build: :heavy_check_mark:
   Live QA URL: http://qa.cloudstack.cloud:8080/client/pr/6587 (SL-JID-2073)


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


[GitHub] [cloudstack] GutoVeronezi commented on a diff in pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
GutoVeronezi commented on code in PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#discussion_r936657651


##########
server/src/main/java/com/cloud/resourcelimit/ResourceLimitManagerImpl.java:
##########
@@ -1112,22 +1114,21 @@ public ResourceCountCheckTask() {
         protected void runInContext() {
             s_logger.info("Started resource counters recalculation periodic task.");
             List<DomainVO> domains = _domainDao.findImmediateChildrenForParent(Domain.ROOT_DOMAIN);
+            List<AccountVO> accounts = _accountDao.findActiveAccountsForDomain(Domain.ROOT_DOMAIN);
 
-            // recalculateDomainResourceCount will take care of re-calculation of resource counts for sub-domains
-            // and accounts of the sub-domains also. so just loop through immediate children of root domain
-            for (Domain domain : domains) {
-                for (ResourceType type : ResourceCount.ResourceType.values()) {
-                    if (type.supportsOwner(ResourceOwnerType.Domain)) {
+            for (ResourceType type : ResourceCount.ResourceType.values()) {
+                if (type.supportsOwner(ResourceOwnerType.Domain)) {
+                    // recalculateDomainResourceCount will take care of re-calculation of resource counts for root and sub-domains
+                    // and accounts of the sub-domains also. so just loop through immediate children of root domain

Review Comment:
   This comment could be the javadoc of the method.



##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java:
##########
@@ -678,6 +682,32 @@ protected void updateVolumeInfo(VolumeObjectTO newVolume, VolumeVO volumeVo, boo
         s_logger.debug(String.format("Updated %s from %s to %s ", volumeVo.getVolumeDescription(), previousValues, newValues));
     }
 
+    protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO volumeVo) {

Review Comment:
   @sureshanaparti, we should rename `volumeVo` to avoid misleading with the class property `volumeVO`.



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


[GitHub] [cloudstack] DaanHoogland commented on a diff in pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

Posted by GitBox <gi...@apache.org>.
DaanHoogland commented on code in PR #6587:
URL: https://github.com/apache/cloudstack/pull/6587#discussion_r936754936


##########
engine/storage/volume/src/main/java/org/apache/cloudstack/storage/volume/VolumeObject.java:
##########
@@ -678,6 +682,32 @@ protected void updateVolumeInfo(VolumeObjectTO newVolume, VolumeVO volumeVo, boo
         s_logger.debug(String.format("Updated %s from %s to %s ", volumeVo.getVolumeDescription(), previousValues, newValues));
     }
 
+    protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO volumeVo) {

Review Comment:
   ```suggestion
       protected void updateResourceCount(VolumeObjectTO newVolume, VolumeVO newVolume) {
   ```



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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   <b>Trillian Build Failed (tid-4572)<b/>


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


[GitHub] [cloudstack] blueorangutan commented on pull request #6587: Updated resource counter to include correct size after volume creation/resize and other improvements

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

   Packaging result: :heavy_multiplication_x: el7 :heavy_multiplication_x: el8 :heavy_multiplication_x: debian :heavy_multiplication_x: suse15. SL-JID 3917


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