Skip to content

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

Open
abh1sar wants to merge 3 commits into
apache:4.22from
shapeblue:sharedfs-template-npe
Open

SharedFS: fix NPE when accessing systemvm templates for unsupported hypervisors#13930
abh1sar wants to merge 3 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 83.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 17.77%. Comparing base (5dcb8ab) to head (ac688c7).
⚠️ Report is 50 commits behind head on 4.22.

Files with missing lines Patch % Lines
...n/java/com/cloud/resource/ResourceManagerImpl.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               4.22   #13930      +/-   ##
============================================
+ Coverage     17.71%   17.77%   +0.06%     
- Complexity    15858    15984     +126     
============================================
  Files          5926     5928       +2     
  Lines        533613   534303     +690     
  Branches      65285    65383      +98     
============================================
+ Hits          94517    94988     +471     
- Misses       428415   428569     +154     
- Partials      10681    10746      +65     
Flag Coverage Δ
uitests 3.69% <ø> (-0.01%) ⬇️
unittests 18.86% <83.33%> (+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

@vladimirpetrov vladimirpetrov added this to the 4.22.2 milestone Aug 20, 2026
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.

4 participants