nagaboinaramgopal opened a new pull request, #14142:
URL: https://github.com/apache/cloudstack/pull/14142
### 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 changes `break` to `continue`.
The same code is on 4.20, 4.22 and main, so this targets 4.20.
### Types of changes
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [ ] New feature (non-breaking change which adds functionality)
- [x] 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
#### Feature/Enhancement Scale
- [ ] Major
- [ ] Minor
#### Bug Severity
- [ ] BLOCKER
- [ ] Critical
- [ ] Major
- [x] Minor
- [ ] Trivial
### 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 (172.16.98.4),
running a few minutes and then stopped.
Before, the stop runs the collection but writes nothing for the shared NIC:
Collect vm network statistics from host before stopping Vm
user_statistics for the VM: (no rows)
After, the shared NIC's usage is recorded on stop:
Collect vm network statistics from host before stopping Vm
user_statistics for the VM: network 231 (shared), 172.16.98.4, bytes
received 320
#### 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]