blockdevice: add DMMultipathDevices for DM-multipath sysfs parsing#796
Open
sradco wants to merge 1 commit intoprometheus:masterfrom
Open
blockdevice: add DMMultipathDevices for DM-multipath sysfs parsing#796sradco wants to merge 1 commit intoprometheus:masterfrom
sradco wants to merge 1 commit intoprometheus:masterfrom
Conversation
jsafrane
reviewed
Mar 16, 2026
blockdevice/dm_multipath.go
Outdated
| } | ||
|
|
||
| suspended := false | ||
| if val, err := util.ReadUintFromFile(fs.sys.Path(sysBlockPath, entry.Name(), sysBlockDM, "suspended")); err == nil { |
There was a problem hiding this comment.
The code looks good overall - it reads the right values from the right sysfs files.
The only thing I noticed is that stats.go returns error on any Read / parse errors, while this file ignores them. I let Prometheus folks judge what's right here.
Member
There was a problem hiding this comment.
Typically we don't ignore errors and try and pass them back so the user of the library can decide what to do about errors.
Author
There was a problem hiding this comment.
+1. Thanks.
I updated the PR now with the fix.
Add DMMultipathDevices() method to blockdevice.FS that discovers Device Mapper multipath devices by scanning /sys/block/dm-* and filtering on dm/uuid prefix "mpath-". For each multipath device it reads the device name, UUID, suspended state, size, and enumerates underlying path devices with their raw state from /sys/block/<path>/device/state. This provides the sysfs parsing layer that node_exporter's dmmultipath collector will import, following the established pattern where collectors delegate filesystem parsing to procfs. Signed-off-by: Shirly Radco <sradco@redhat.com> Co-authored-by: AI Assistant <noreply@cursor.com>
7e7c41d to
a8a28fe
Compare
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add DMMultipathDevices() method to blockdevice.FS that discovers Device Mapper multipath devices by scanning /sys/block/dm-* and filtering on dm/uuid prefix "mpath-". For each multipath device it reads the device name, UUID, suspended state, size, and enumerates underlying path devices with their raw state from
/sys/block//device/state.
This provides the sysfs parsing layer that node_exporter's dmmultipath collector will import, following the established pattern where collectors delegate filesystem parsing to procfs.
This is the parsing layer for prometheus/node_exporter#3581