server: fix resource count updated unmanage vm#8169
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 4.19 #8169 +/- ##
============================================
+ Coverage 14.96% 15.21% +0.24%
- Complexity 11002 11534 +532
============================================
Files 5373 5389 +16
Lines 469315 491097 +21782
Branches 59847 70632 +10785
============================================
+ Hits 70233 74697 +4464
- Misses 391309 408170 +16861
- Partials 7773 8230 +457
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
@shwstppr @vishesh92 , in view of other work on this topic, should we keep this open? |
Do not decrement resource count for a running VM twice while unmanaging. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
02d36fa to
f4776cc
Compare
|
This pull request has merge conflicts. Dear author, please fix the conflicts and sync your branch with the base branch. |
| UsageEventUtils.publishUsageEvent(EventTypes.EVENT_VM_STOP, vm.getAccountId(), vm.getDataCenterId(), | ||
| vm.getId(), vm.getHostName(), vm.getServiceOfferingId(), vm.getTemplateId(), | ||
| vm.getHypervisorType().toString(), VirtualMachine.class.getName(), vm.getUuid(), vm.isDisplayVm()); | ||
| resourceCountDecrement(vm.getAccountId(), vm.isDisplayVm(), cpu, ram); |
There was a problem hiding this comment.
Same method is called later at line 8502
|
@blueorangutan package |
|
@shwstppr 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 9886 |
|
Added steps to reproduce in the PR description. cc @DaanHoogland |
|
@blueorangutan package |
|
@rohityadavcloud 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]: ✔️ el7 ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 10115 |
vishesh92
left a comment
There was a problem hiding this comment.
clgtm. Tested.
Before patch. resource count got decremented by 2. After patch, it got decremented by 1.
Do not decrement resource count for a running VM twice while unmanaging a VM
Description
This PR ensures that the resource counts are not decremented twice for a running VM while unmanaging.
Currently, the code does the same operation for a non-stopped VM twice. This could lead to resource count discrepancy for an account or domain.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
Before fix:
How did you try to break this feature and the system with this change?