cloudstack icon indicating copy to clipboard operation
cloudstack copied to clipboard

List capacity double counts allocated storage pool capacity for datastore clusters

Open abh1sar opened this issue 3 weeks ago • 13 comments

Description

This PR fixes #11937

When a primary storage is added to a Datastore cluster, the op_host_capacity table contains entries for both the Primary storage and the Datastore cluster. ListCapacity counts the allocated capacity twice because of this. Fix is to skip any storage pool that has children from capacity calculation.

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)
  • [ ] Enhancement (improves an existing feature and functionality)
  • [ ] Cleanup (Code refactoring and cleanup, that may add test cases)
  • [ ] Build/CI
  • [ ] Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • [ ] Major
  • [ ] Minor

Bug Severity

  • [ ] BLOCKER
  • [ ] Critical
  • [ ] Major
  • [x] Minor
  • [ ] Trivial

Screenshots (if appropriate):

How Has This Been Tested?

Primary storage ...pri2 is added to Datastore Cluster DC1.

Screenshot 2025-12-03 at 5 44 15 PM Screenshot 2025-12-03 at 5 59 15 PM

Before Fix : Screenshot 2025-12-03 at 2 44 01 PM

After Fix : Screenshot 2025-12-03 at 6 05 02 PM

How did you try to break this feature and the system with this change?

abh1sar avatar Dec 03 '25 12:12 abh1sar

Codecov Report

:x: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 16.17%. Comparing base (028dd86) to head (a3daddb). :warning: Report is 4 commits behind head on 4.20.

Files with missing lines Patch % Lines
...n/java/com/cloud/capacity/dao/CapacityDaoImpl.java 0.00% 4 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #12181      +/-   ##
============================================
- Coverage     16.18%   16.17%   -0.01%     
  Complexity    13298    13298              
============================================
  Files          5657     5657              
  Lines        498470   498482      +12     
  Branches      60493    60501       +8     
============================================
- Hits          80660    80652       -8     
- Misses       408830   408852      +22     
+ Partials       8980     8978       -2     
Flag Coverage Δ
uitests 4.00% <ø> (-0.01%) :arrow_down:
unittests 17.03% <0.00%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 03 '25 12:12 codecov[bot]

@blueorangutan package

DaanHoogland avatar Dec 03 '25 14:12 DaanHoogland

@DaanHoogland a [SL] 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.

blueorangutan avatar Dec 03 '25 14:12 blueorangutan

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15909

blueorangutan avatar Dec 03 '25 15:12 blueorangutan

@blueorangutan test ol9 vmware-80u3e

DaanHoogland avatar Dec 03 '25 16:12 DaanHoogland

@DaanHoogland a [SL] Trillian-Jenkins test job (ol9 mgmt + vmware-80u3e) has been kicked to run smoke tests

blueorangutan avatar Dec 03 '25 16:12 blueorangutan

[SF] Trillian Build Failed (tid-14907)

blueorangutan avatar Dec 03 '25 17:12 blueorangutan

@blueorangutan test ol9 vmware-80u3e

harikrishna-patnala avatar Dec 04 '25 09:12 harikrishna-patnala

@harikrishna-patnala a [SL] Trillian-Jenkins test job (ol9 mgmt + vmware-80u3e) has been kicked to run smoke tests

blueorangutan avatar Dec 04 '25 09:12 blueorangutan

[SF] Trillian Build Failed (tid-14909)

blueorangutan avatar Dec 04 '25 11:12 blueorangutan

@blueorangutan test ol9 vmware-80u3e

abh1sar avatar Dec 09 '25 10:12 abh1sar

@abh1sar a [SL] Trillian-Jenkins test job (ol9 mgmt + vmware-80u3e) has been kicked to run smoke tests

blueorangutan avatar Dec 09 '25 10:12 blueorangutan

[SF] Trillian Build Failed (tid-14935)

blueorangutan avatar Dec 09 '25 10:12 blueorangutan