Skip to content

Fix NPE on findHostsForMigration when no suitable hosts are found#13138

Open
winterhazel wants to merge 1 commit intoapache:mainfrom
winterhazel:findhostsformigration-npe
Open

Fix NPE on findHostsForMigration when no suitable hosts are found#13138
winterhazel wants to merge 1 commit intoapache:mainfrom
winterhazel:findhostsformigration-npe

Conversation

@winterhazel
Copy link
Copy Markdown
Member

@winterhazel winterhazel commented May 8, 2026

Description

This patch fixes a NPE findHostsForMigration introduced in #9074 that occurs when no suitable hosts are found (suitableHosts is null) due to a missing return statement.

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

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

In a test environment with two hosts, host-1 and host-2:

  1. I deployed a VM in host-1.
  2. I disabled host-2.
  3. I attempted to open the VM migration wizard.

Before the patch, I would get a NPE in step 3. Now, I do not receive the NPE anymore.

@winterhazel
Copy link
Copy Markdown
Member Author

@blueorangutan package

@blueorangutan
Copy link
Copy Markdown

@winterhazel a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 18.09%. Comparing base (72b99a3) to head (bf3addd).

Files with missing lines Patch % Lines
...in/java/com/cloud/server/ManagementServerImpl.java 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main   #13138   +/-   ##
=========================================
  Coverage     18.08%   18.09%           
- Complexity    16718    16722    +4     
=========================================
  Files          6037     6037           
  Lines        542546   542546           
  Branches      66432    66431    -1     
=========================================
+ Hits          98146    98165   +19     
+ Misses       433378   433358   -20     
- Partials      11022    11023    +1     
Flag Coverage Δ
uitests 3.51% <ø> (ø)
unittests 19.25% <20.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

@winterhazel winterhazel changed the title Fix NPE when on findHostsForMigration when no suitable hosts are found Fix NPE on findHostsForMigration when no suitable hosts are found May 8, 2026
Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

@blueorangutan
Copy link
Copy Markdown

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

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.

3 participants