Skip to content

SharedFS: fix NPE when accessing systemvm templates for unsupported hypervisors - #13930

Merged
RosiKyu merged 5 commits into
apache:4.22from
shapeblue:sharedfs-template-npe
Sep 11, 2026
Merged

RosiKyu merged 5 commits into
apache:4.22from
shapeblue:sharedfs-template-npe

Conversation

@abh1sar

@abh1sar abh1sar commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

This PR fixes #13837

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)
  • 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
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

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

Copilot AI 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.

Pull request overview

This PR addresses an intermittent NullPointerException during SharedFS VM deployment by ensuring unsupported hypervisors (or hypervisors without a downloaded SystemVM template) don’t cause template dereferences, and by tightening the hypervisor list used for SystemVM-based deployments.

Changes:

  • Treat the getSupportedHypervisorTypes boolean flag as “for SystemVM” and use it from the SharedFS deployment path.
  • Fix SharedFS deployment to continue iterating hypervisors when a SystemVM template is missing, instead of dereferencing a null template.
  • Update the SharedFS unit test stubbing and related method signatures to match the new boolean flag name.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
server/src/test/java/com/cloud/resource/MockResourceManagerImpl.java Updates mock method signature to match the renamed boolean parameter.
server/src/main/java/com/cloud/resource/ResourceManagerImpl.java Renames the boolean parameter and keeps filtering logic for SystemVM-oriented hypervisor selection.
plugins/storage/sharedfs/storagevm/src/test/java/org/apache/cloudstack/storage/sharedfs/lifecycle/StorageVmSharedFSLifeCycleTest.java Updates stubs to call getSupportedHypervisorTypes(..., true, ...) for SharedFS deployment tests.
plugins/storage/sharedfs/storagevm/src/main/java/org/apache/cloudstack/storage/sharedfs/lifecycle/StorageVmSharedFSLifeCycle.java Uses SystemVM-filtered hypervisors and prevents NPE by continuing when templates are missing.
api/src/main/java/com/cloud/resource/ResourceService.java Renames the boolean parameter in the API interface to reflect SystemVM intent.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@codecov

codecov Bot commented Aug 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.92%. Comparing base (a9b2f33) to head (52210d1).
⚠️ Report is 21 commits behind head on 4.22.

Files with missing lines Patch % Lines
...n/java/com/cloud/resource/ResourceManagerImpl.java 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13930      +/-   ##
============================================
+ Coverage     17.86%   17.92%   +0.06%     
- Complexity    16037    16113      +76     
============================================
  Files          5928     5928              
  Lines        534479   534964     +485     
  Branches      65410    65463      +53     
============================================
+ Hits          95468    95876     +408     
- Misses       428173   428180       +7     
- Partials      10838    10908      +70     
Flag Coverage Δ
uitests 4.02% <ø> (ø)
unittests 18.99% <50.00%> (+0.06%) ⬆️

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 commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

@DaanHoogland DaanHoogland linked an issue Aug 25, 2026 that may be closed by this pull request
@DaanHoogland

Copy link
Copy Markdown
Contributor

@GaOrtiga , did you happen to test?

@GaOrtiga

Copy link
Copy Markdown
Collaborator

No @DaanHoogland , only code review.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch.

@DaanHoogland DaanHoogland moved this from Ready to conflict/waiting in CloudStack Testing Sep 8, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor

ping @abh1sar

@abh1sar

abh1sar commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

Although the main issue was already fixed by #13830, this PR offers a more complete fix.

@abh1sar

abh1sar commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

@abh1sar
abh1sar force-pushed the sharedfs-template-npe branch from b343252 to 52210d1 Compare September 9, 2026 14:45
@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 19181

@abh1sar

abh1sar commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

@RosiKyu RosiKyu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Tested on a zone with an External (Proxmox) cluster next to KVM and VMware, which is the setup from #13837. SystemVM templates were present for KVM and VMware only and none for External, so the conditions for the NPE were in place.

Created Shared FileSystems repeatedly, 12 in total, since the original failure was intermittent and depended on where External landed in the shuffled list. No NPE on any of them and nothing in the management server log. Every deploy that had capacity landed on KVM and never on External.

The only failures I saw were InsufficientServerCapacityException, from the VMware hosts in this zone being down and from my own testing filling the environment up. Neither is related to this change.

Great work @abh1sar !

@RosiKyu
RosiKyu merged commit 9030443 into apache:4.22 Sep 11, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from conflict/waiting to Done in CloudStack Testing Sep 11, 2026
@abh1sar
abh1sar deleted the sharedfs-template-npe branch September 14, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

Shared FileSystem deploy fails with NPE

7 participants