stag7824 opened a new pull request, #14889: URL: https://github.com/apache/cloudstack/pull/14889
### Description This PR fixes #14874. `LibvirtGetVolumeStatsCommandWrapper` looked up the storage pool inside its per-volume loop, so a `GetVolumeStatsCommand` with N volumes did N full pool lookups (each one `storagePoolLookupByUUIDString`, pool XML parsing and `getInfo()`), and each could wait on the `KVMStoragePoolManager` monitor while a `GetStorageStatsCommand` refreshes the pool. It also returned no stats at all as soon as one volume could not be resolved, so the stats of every other volume in the command were lost. Changes, all in the wrapper: - The pool is looked up once per command; all volumes of a `GetVolumeStatsCommand` are on the same pool. - A volume that can't be resolved (`getPhysicalDisk` returns null or throws `CloudRuntimeException`) is logged as a warning and skipped, and the stats of the other volumes are returned. - The answer still has no stats when the pool is unavailable, or when none of the volumes can be resolved, as before. - The libvirt `Connect` the wrapper fetched was never used, so it is no longer fetched. On the management server, `UserVmManagerImpl.getVolumeStatistics()` already merges whatever entries an answer contains (`putAll`), so a partial map needs no change there. This does not touch the separate points in the issue about every management server running `VolumeStatsTask`, or the `synchronized` pool lookup itself. ### 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) #### Bug Severity - [ ] BLOCKER - [ ] Critical - [x] Major - [ ] Minor - [ ] Trivial ### How Has This Been Tested? New `LibvirtGetVolumeStatsCommandWrapperTest` (5 tests): - the pool is looked up once for three volumes - with one volume missing and one throwing, the resolvable volume's stats are still returned - an unavailable pool, a pool lookup error, and no resolvable volume all return no stats Against the current 4.22 code, the first two fail as expected (`Wanted 1 time: But was 3 times` for the pool lookup; no stats for the partial case). With the change, all 5 pass. Checkstyle passes for the module. I have not run it on a KVM host with RBD storage. -- 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]
