Skip to content

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

Merged
weizhouapache merged 1 commit into
apache:mainfrom
winterhazel:findhostsformigration-npe
May 12, 2026
Merged

Fix NPE on findHostsForMigration when no suitable hosts are found#13138
weizhouapache merged 1 commit into
apache:mainfrom
winterhazel:findhostsformigration-npe

Conversation

@winterhazel

@winterhazelwinterhazel commented May 8, 2026

Copy link
Copy Markdown
Member

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
MemberAuthor

@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

codecovBot commented May 8, 2026

Copy link
Copy Markdown

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).
⚠️ Report is 9 commits behind head on main.

Files with missing linesPatch %Lines
...in/java/com/cloud/server/ManagementServerImpl.java20.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 
FlagCoverage Δ
uitests3.51% <ø> (ø)
unittests19.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.

@winterhazelwinterhazel changed the title Fix NPE when on findHostsForMigration when no suitable hosts are foundFix NPE on findHostsForMigration when no suitable hosts are foundMay 8, 2026

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

clgtm

@blueorangutan

Copy link
Copy Markdown

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

@weizhouapacheweizhouapache left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

code lgtm

@weizhouapache

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@weizhouapache

Copy link
Copy Markdown
Member

verified OK

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-16067)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 75744 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr13138-t16067-kvm-ol8.zip
Smoke tests completed. 146 look OK, 5 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_vm_backup_create_vm_from_backupFailure607.85test_backup_recovery_nas.py
test_vm_backup_lifecycleError1.13test_backup_recovery_nas.py
ContextSuite context=TestSharedFSLifecycle>:setupError0.00test_sharedfs_lifecycle.py
test_10_attachAndDetach_isoFailure607.23test_vm_life_cycle.py
test_01_create_vm_snapshotsFailure606.81test_vm_snapshots.py
test_02_revert_vm_snapshotsFailure600.75test_vm_snapshots.py
test_03_delete_vm_snapshotsFailure0.03test_vm_snapshots.py
test_01_create_volumeFailure612.42test_volumes.py
test_01_root_volume_encryptionFailure686.71test_volumes.py
test_02_data_volume_encryptionFailure639.83test_volumes.py
test_03_root_and_data_volume_encryptionFailure658.89test_volumes.py
test_02_attach_volumeFailure1266.26test_volumes.py
test_02_attach_volumeFailure1266.28test_volumes.py
test_03_download_attached_volumeFailure665.82test_volumes.py
test_04_delete_attached_volumeFailure663.70test_volumes.py
test_05_detach_volumeFailure751.70test_volumes.py
test_06_download_detached_volumeFailure845.17test_volumes.py
test_07_resize_failFailure657.54test_volumes.py
test_08_resize_volumeFailure660.99test_volumes.py
test_09_delete_detached_volumeFailure659.75test_volumes.py
test_10_list_volumesFailure658.46test_volumes.py
test_11_attach_volume_with_unstarted_vmFailure756.44test_volumes.py
test_12_resize_volume_with_only_size_parameterFailure663.92test_volumes.py
test_13_migrate_volume_and_change_offeringFailure793.60test_volumes.py
test_14_delete_volume_delete_protectionFailure663.91test_volumes.py

@weizhouapache
weizhouapache merged commit 5893ba5 into apache:mainMay 12, 2026
28 checks passed
@weizhouapache

Copy link
Copy Markdown
Member

merging, the test failures are unrelated

Sign up for freeto 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

@winterhazel@blueorangutan@weizhouapache@sureshanaparti