server: keep collecting VM network stats after a non DirectAttached NIC - #14142
nagaboinaramgopal wants to merge 1 commit into
Conversation
collectVmNetworkStatistics used break when a NIC was not on a DirectAttached network, which ended the whole loop. A DirectAttached (shared network) NIC ordered after an isolated one therefore never had its statistics recorded when the VM was stopped. Skip only that NIC.
|
@blueorangutan package |
|
@weizhouapache 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 19223 |
|
@blueorangutan test |
|
@weizhouapache a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 4.20 #14142 +/- ##
============================================
+ Coverage 4.14% 16.38% +12.24%
- Complexity 0 13604 +13604
============================================
Files 405 5669 +5264
Lines 33073 501475 +468402
Branches 5903 60913 +55010
============================================
+ Hits 1370 82172 +80802
- Misses 31527 410082 +378555
- Partials 176 9221 +9045
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
[SF] Trillian test result (tid-16977)
|
|
Thanks @weizhouapache for the review and the smoke run. This needs a second review; could someone take a look? |
Description
When a KVM VM is stopped, collectVmNetworkStatistics records usage for its NICs on DirectAttached (shared) networks. For a NIC on any other network it ran
break, which ends the whole loop, so a shared network NIC ordered after an isolated one never gets its statistics recorded. The comment says the intent is to skip only that NIC, so this changesbreaktocontinue.The same code is on 4.20, 4.22 and main, so this targets 4.20.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
N/A
How Has This Been Tested?
Added a test to UserVmManagerImplTest that feeds collectVmNetworkStatistics stats for an isolated NIC followed by a shared network NIC and checks the shared NIC's user_statistics row is updated. It fails against the current code and passes with the fix. The class passes (182 tests).
Also verified on a live 4.23 KVM environment with the same change: a VM with NIC 0 on an isolated network and NIC 1 on a shared network (192.16.98.4), running a few minutes and then stopped.
Before, the stop runs the collection but writes nothing for the shared NIC:
After, the shared NIC's usage is recorded on stop:
How did you try to break this feature and the system with this change?
NICs on networks that are not DirectAttached are still skipped, and a VM whose NICs are all on shared networks behaves as before. Only the NICs after the first skipped one are affected, which now get their statistics recorded.