Skip to content

kvm: look up the storage pool once in GetVolumeStatsCommand and keep stats of resolvable volumes - #14889

Open
stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:fix-kvm-volume-stats-pool-lookup
Open

stag7824 wants to merge 1 commit into
apache:4.22from
stag7824:fix-kvm-volume-stats-pool-lookup

Conversation

@stag7824

Copy link
Copy Markdown
Contributor

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)
  • 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
  • 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.

…stats of resolvable volumes

The wrapper looked up the storage pool once per volume, and returned no stats
at all when a single volume could not be resolved. Look the pool up once, skip
volumes that can't be resolved (logged as warnings), and only return no stats
when the pool or every volume is unavailable. Fixes apache#14874.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant