block[disk_iostats]: add persistent device name and partition support #2206
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow specifying a symlink from /dev/ to select the device, so it can be a persistent block device name from /dev/disk/by-*/ directories or /dev/gpt-auto-root
Allow selecting a partition as device, which allows disk/by-partlabel device naming to work
This allows users to fix the issue where block device naming could change on every boot, and so configured device would sometimes be different from the expected device
As the added example shows, use the same semantics as existing block device naming:
If the config device is a valid symlink in /dev/ it replaces the device with the symlink target, so %device in format will show the name of the symlink target, not the symlink name
For partitions /sys/class/block/partition_name/ doesn't contain queue/hw_sector_size, so instead uses the /sys/class/block/disk_name/queue/hw_sector_size of the disk that contains the partition (/sys/class/block/disk_name/partition_name/)