Skip to content

Skip hypervisors with no systemvm template when creating a shared filesystem - #14086

Closed
nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:pr/fix-sharedfs-template-npe
Closed

nagaboinaramgopal wants to merge 1 commit into
apache:mainfrom
nagaboinaramgopal:pr/fix-sharedfs-template-npe

Conversation

@nagaboinaramgopal

Copy link
Copy Markdown
Contributor

Description

Creating a shared filesystem fails with a NullPointerException in a zone that has more than one hypervisor type when one of those types has no systemvm template (for example an External or MaaS cluster next to a KVM cluster).

deploySharedFSVM walks the zone's supported hypervisors looking for one with a systemvm template, but it only threw when the template was missing on the last hypervisor. A missing template on any earlier one fell through to template.getId() and hit the NPE. Because the hypervisor list is shuffled, this failed at random.

Now a hypervisor with no template is skipped and the loop moves to the next one, and it only throws when none of them has a template. This mirrors the continue-on-hasNext handling already used for InsufficientCapacityException further down the same loop.

Fixes: #13825

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):

N/A

How Has This Been Tested?

Added a unit test with two supported hypervisors where neither has a systemvm template. Before this change the deploy throws a NullPointerException, after it throws the intended CloudRuntimeException that says the template was not found. The existing shared filesystem lifecycle tests still pass.

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

Checked the single hypervisor case still throws the same not-found error, so there is no regression when only one type is supported. The change only adds a skip to the next hypervisor when a template is missing and never touches the path where a template is found, so a normal deploy is unaffected.

deploySharedFSVM iterates the zone's supported hypervisors looking for one
with a systemvm template. It only threw when the template was missing on the
last hypervisor, so a missing template on any earlier one fell through to
template.getId() and hit a NullPointerException. In a zone with more than one
hypervisor type where one has no systemvm template this failed the shared
filesystem VM deployment at random depending on the shuffled order.

Skip a hypervisor that has no template and move to the next, and throw only
when none of them has one, mirroring the existing continue-on-hasNext handling
further down the same loop.

Fixes: apache#13825
@nagaboinaramgopal

Copy link
Copy Markdown
Contributor Author

Closing as a duplicate. I see #13830 already merged the same fix for #13825 (skip hypervisors without a system template, keep the final CloudRuntimeException). Thanks @Dogface2k, that covers it.

@nagaboinaramgopal
nagaboinaramgopal deleted the pr/fix-sharedfs-template-npe branch September 9, 2026 02:34
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.

CreateSharedFileSystem NPE ("template is null") when zone has mixed hypervisor types

1 participant