Skip to content

server: treat a zero-capacity storage pool as full - #14052

Open
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:fix/storagepool-zero-capacity-nan
Open

server: treat a zero-capacity storage pool as full#14052
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:fix/storagepool-zero-capacity-nan

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown

checkUsagedSpace divided used by total capacity without guarding a zero total. A pool reporting capacityBytes == 0 with zero used produced NaN, and NaN >= threshold is false, so the method returned true and reported that a pool with no capacity had space, letting allocation or resize proceed onto it. Return false when the pool reports no capacity.

Tested: new unit test checkUsagedSpaceReturnsFalseForZeroCapacityPool (fails before, passes after); StorageManagerImplTest green.

checkUsagedSpace divided used by total capacity without guarding a zero total.
A pool reporting capacityBytes == 0 (freshly added, stats not yet populated)
with zero used produced NaN, and NaN >= threshold is false, so the method
returned true and reported that a pool with no capacity had space, letting
allocation or resize proceed onto it. Return false when the pool reports no
capacity.

@DaanHoogland DaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is a long shot but a negative value may have been entered in the DB and coming back through a VO, so clgtm.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 19.78%. Comparing base (b7a834b) to head (7114e88).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ain/java/com/cloud/storage/StorageManagerImpl.java 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main   #14052      +/-   ##
============================================
- Coverage     19.78%   19.78%   -0.01%     
+ Complexity    19998    19996       -2     
============================================
  Files          6371     6371              
  Lines        575899   575901       +2     
  Branches      70495    70496       +1     
============================================
- Hits         113967   113959       -8     
- Misses       449501   449512      +11     
+ Partials      12431    12430       -1     
Flag Coverage Δ
uitests 3.53% <ø> (ø)
unittests 21.06% <50.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

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

@abh1sar abh1sar self-assigned this Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants