-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Prevent NPE when removing NIC from a stopped VM using service offering with CPU cap set #12232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 4.20
Are you sure you want to change the base?
Conversation
…g with CPU cap set
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #12232 +/- ##
=========================================
Coverage 16.21% 16.21%
- Complexity 13353 13355 +2
=========================================
Files 5657 5657
Lines 498647 498648 +1
Branches 60533 60533
=========================================
+ Hits 80863 80875 +12
+ Misses 408771 408755 -16
- Partials 9013 9018 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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
setVmQuotaPercentageto 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.
weizhouapache
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm
|
|
@blueorangutan package |
|
@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. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✖️ debian ✔️ suse15. SL-JID 16007 |



Description
This PR fixes: #12225
Types of changes
Feature/Enhancement Scale or Bug Severity
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?