Repository navigation
kvm: collect the disk stats of volumes on local storage - #14454
weizhouapache wants to merge 1 commit into
Conversation
The disk stats of a volume are matched on the last part of the path of its disk. For local storage, whose disks are in /var/lib/libvirt/images, the agent reported 'libvirt' instead of the path of the volume. The stats of the volume were never found, so its read and write counters stayed at 0. Use the last element of the path of the disk, which is the same as before for the other storage types. Also skip, instead of stopping at, a disk which does not match a volume, so the stats of the other disks of the Instance are still collected. Likewise, keep checking the other volumes of a storage pool after one with a format for which the volume stats are not implemented, instead of stopping at the first one.
|
I tested this on KVM with the agent patched on one host, using a VM that has data disks on every storage type I could set up. This was on a 4.23.0 build with the same change; I have not run it on a 4.22 build. CauseThe disk stats of a volume are matched on Now the last element of the path is used (same value as before for the other pool types), and an unmatched disk is skipped ( Test: before and after the fixOne VM on one KVM host, a root disk plus these data disks, 600 s of a fixed-rate fio load (about 140 read + 60 write requests/s) on each data disk,
(The local volume was collected after the fix, so its totals include the second run of the same load. Before the fix, it stayed at 0 with libvirt showing the same load on it as on the NFS and RBD disks.) Test: different amounts on each disk, 5 data disksThen I wrote a different number of 4 KiB writes to each disk (fio, direct I/O) and compared the values 5 minutes later:
Unit tests
Not tested
Related to #14302 (separate from the "Disk IOPS" display issue discussed there). |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 4.22 #14454 +/- ##
=========================================
Coverage 18.06% 18.07%
- Complexity 16356 16361 +5
=========================================
Files 5937 5937
Lines 537015 537015
Branches 65830 65830
=========================================
+ Hits 97026 97053 +27
+ Misses 428913 428879 -34
- Partials 11076 11083 +7
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:
|
Description
The disk stats of a volume are matched on the last part of the path of its disk. For local storage, whose disks are in /var/lib/libvirt/images, the agent reported 'libvirt' instead of the path of the volume. The stats of the volume were never found, so its read and write counters stayed at 0.
Use the last element of the path of the disk, which is the same as before for the other storage types. Also skip, instead of stopping at, a disk which does not match a volume, so the stats of the other disks of the Instance are still collected.
Likewise, keep checking the other volumes of a storage pool after one with a format for which the volume stats are not implemented, instead of stopping at the first one.
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Bug Severity
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?