Skip to content

Conversation

@Pearl1594
Copy link
Contributor

Description

This PR fixes: #12225

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

Screenshots (if appropriate):

How Has This Been Tested?

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

@codecov
Copy link

codecov bot commented Dec 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.24%. Comparing base (4348386) to head (42d94ee).
⚠️ Report is 19 commits behind head on 4.20.

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #12232      +/-   ##
============================================
+ Coverage     16.21%   16.24%   +0.02%     
- Complexity    13353    13476     +123     
============================================
  Files          5657     5657              
  Lines        498647   501942    +3295     
  Branches      60533    61754    +1221     
============================================
+ Hits          80863    81522     +659     
- Misses       408771   411364    +2593     
- Partials       9013     9056      +43     
Flag Coverage Δ
uitests 3.99% <ø> (-0.02%) ⬇️
unittests 17.09% <100.00%> (+0.02%) ⬆️

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.

Copy link
Contributor

Copilot AI left a comment

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 fixes a NullPointerException that occurs when removing a NIC from a stopped VM that uses a service offering with CPU cap set. The fix gracefully handles the scenario where the host is not available instead of throwing an exception.

Key Changes:

  • Modified error handling in setVmQuotaPercentage to log a warning and skip CPU quota calculation when host is unavailable
  • Updated corresponding test to verify the new graceful degradation behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
server/src/main/java/com/cloud/hypervisor/KVMGuru.java Changed from throwing CloudRuntimeException to logging warning and returning early when host is null, preventing NPE
server/src/test/java/com/cloud/hypervisor/KVMGuruTest.java Updated test to verify that CPU quota is not set when host is unavailable, rather than expecting an exception

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
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

@Pearl1594
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@Pearl1594 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

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

@Pearl1594 Pearl1594 linked an issue Dec 19, 2025 that may be closed by this pull request
@DaanHoogland DaanHoogland added this to the 4.20.3 milestone Dec 31, 2025
@DaanHoogland
Copy link
Contributor

@Pearl1594 , user/reporter has tested are you satisfied as is?

Copy link
Collaborator

@abh1sar abh1sar left a comment

Choose a reason for hiding this comment

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

Tested the fix:

  1. Create a compute offering with CPU cap
  2. Create an Instance and attach multiple isolated networks
  3. Stop the Instance
  4. Remove all non-default NICs.

Also performed some lifecycle operation on the above Instance: Start, Stop, Add-Delete more Nics, setup firewall rules and port forwarding.

LGTM.

@abh1sar
Copy link
Collaborator

abh1sar commented Jan 5, 2026

@Pearl1594 can this be merged?

Co-authored-by: Abhisar Sinha <63767682+abh1sar@users.noreply.github.com>
@Pearl1594 Pearl1594 marked this pull request as ready for review January 5, 2026 17:07
@Pearl1594
Copy link
Contributor Author

yes @abh1sar - ready for merging. Thanks for testing.

Copy link
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

@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 5, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove nic host with id: null

6 participants