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

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

Copy link
Copy Markdown
Member

@weizhouapache weizhouapache left a comment

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:

Test Result Time (s) Test File
test_vm_backup_create_vm_from_backup Failure 607.85 test_backup_recovery_nas.py
test_vm_backup_lifecycle Error 1.13 test_backup_recovery_nas.py
ContextSuite context=TestSharedFSLifecycle>:setup Error 0.00 test_sharedfs_lifecycle.py
test_10_attachAndDetach_iso Failure 607.23 test_vm_life_cycle.py
test_01_create_vm_snapshots Failure 606.81 test_vm_snapshots.py
test_02_revert_vm_snapshots Failure 600.75 test_vm_snapshots.py
test_03_delete_vm_snapshots Failure 0.03 test_vm_snapshots.py
test_01_create_volume Failure 612.42 test_volumes.py
test_01_root_volume_encryption Failure 686.71 test_volumes.py
test_02_data_volume_encryption Failure 639.83 test_volumes.py
test_03_root_and_data_volume_encryption Failure 658.89 test_volumes.py
test_02_attach_volume Failure 1266.26 test_volumes.py
test_02_attach_volume Failure 1266.28 test_volumes.py
test_03_download_attached_volume Failure 665.82 test_volumes.py
test_04_delete_attached_volume Failure 663.70 test_volumes.py
test_05_detach_volume Failure 751.70 test_volumes.py
test_06_download_detached_volume Failure 845.17 test_volumes.py
test_07_resize_fail Failure 657.54 test_volumes.py
test_08_resize_volume Failure 660.99 test_volumes.py
test_09_delete_detached_volume Failure 659.75 test_volumes.py
test_10_list_volumes Failure 658.46 test_volumes.py
test_11_attach_volume_with_unstarted_vm Failure 756.44 test_volumes.py
test_12_resize_volume_with_only_size_parameter Failure 663.92 test_volumes.py
test_13_migrate_volume_and_change_offering Failure 793.60 test_volumes.py
test_14_delete_volume_delete_protection Failure 663.91 test_volumes.py

@weizhouapache weizhouapache merged commit 5893ba5 into apache:main May 12, 2026
28 checks passed
@weizhouapache
Copy link
Copy Markdown
Member

merging, the test failures are unrelated

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