Skip to content

Report a failed automigrate on volume resize instead of throwing NPE - #14752

Open
bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:volume-resize-automigrate-npe
Open

bhouse-nexthop wants to merge 1 commit into
apache:4.22from
bhouse-nexthop:volume-resize-automigrate-npe

Conversation

@bhouse-nexthop

Copy link
Copy Markdown
Contributor

Description

Fixes #14751

path before after
resizeVolume, migration returns null NullPointerException "... the migration did not return the migrated volume"
resizeVolume, migration throws generic error, cause dropped error includes the cause message and keeps it as cause
changeOfferingForVolume, migration returns null message said "volume: null" names the volume
changeOfferingForVolume, either case named the first suitable pool, not the one tried names the pool actually tried
  • One helper does the migrate-and-check for both paths.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Bug Severity

  • Minor

How Has This Been Tested?

test result
VolumeApiServiceImplTest (148 tests, 3 new) pass
the 3 new tests against the unfixed code fail as expected (1 NPE, 2 wrong messages)

@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 18.35%. Comparing base (b56bbc2) to head (77ee0de).
⚠️ Report is 11 commits behind head on 4.22.

Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #14752      +/-   ##
============================================
+ Coverage     18.32%   18.35%   +0.02%     
- Complexity    16644    16677      +33     
============================================
  Files          5939     5939              
  Lines        537787   537814      +27     
  Branches      65932    65935       +3     
============================================
+ Hits          98544    98701     +157     
+ Misses       428033   427882     -151     
- Partials      11210    11231      +21     
Flag Coverage Δ
uitests 4.08% <ø> (ø)
unittests 19.44% <100.00%> (+0.03%) ⬆️

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.

When resizeVolume needs to move the volume to another pool and
migrateVolume returns null, the code set `volume` to null and then
called `volume.getUuid()` to build the error, both in the try and in
the catch. The caller got a NullPointerException.

| path | before | after |
|---|---|---|
| resizeVolume, migration returns null | NullPointerException | "... the migration did not return the migrated volume" |
| resizeVolume, migration throws | generic error, cause dropped | error includes the cause message and keeps it as cause |
| changeOfferingForVolume, migration returns null | message said "volume: null" | names the volume |
| changeOfferingForVolume, either case | named the first suitable pool, not the one tried | names the pool actually tried |

- Move the migrate-and-check into one helper used by both paths.
- Add unit tests for the null and exception cases of resizeVolume and
  the null case of changeOfferingForVolume.

Signed-off-by: Brad House <bhouse@nexthop.ai>
@bhouse-nexthop
bhouse-nexthop force-pushed the volume-resize-automigrate-npe branch from 7b28ff5 to 77ee0de Compare December 1, 2026 13:10
bhouse-nexthop added a commit to bhouse-nexthop/cloudstack that referenced this pull request Dec 1, 2026
Review follow-up for apache#14752: use StringUtils.defaultIfBlank
so a blank exception message falls back to the exception's class name, and
test it.

Signed-off-by: Brad House <bhouse@nexthop.ai>
(cherry picked from commit 2ca4f611a587c496988232a2f40e1d7ba2795b0d)
bhouse-nexthop added a commit to bhouse-nexthop/cloudstack that referenced this pull request Dec 1, 2026
Review follow-up for apache#14752: use StringUtils.defaultIfBlank
so a blank exception message falls back to the exception's class name, and
test it.

Signed-off-by: Brad House <bhouse@nexthop.ai>
(cherry picked from commit 8ee20bf3eaab8fee83e5f1890ade953bd302e4a4)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants