amarao / sdled

Control fault/locate indicators in disk slots in enclosures (SES devices)
GNU General Public License v2.0
54 stars 21 forks source link

Added md-raid support #9

Open KJ7LNW opened 1 year ago

KJ7LNW commented 1 year ago

Turn LEDs on or off depending on their RAID membership

For example:

    ] grep md9 /proc/mdstat
    md9 : active raid5 sdg[0] sde[6] sdj[4] sdk[3] sdf[2] sdl[1]

    ] encled md9
    0:0:18:0/Slot11 sde fault_off   locate_off
    0:0:18:0/Slot08 sdf fault_off   locate_off
    0:0:18:0/Slot06 sdg fault_off   locate_off
    0:0:18:0/Slot10 sdj fault_off   locate_off
    0:0:18:0/Slot09 sdk fault_off   locate_off
    0:0:18:0/Slot07 sdl fault_off   locate_off

    ] encled md9 locate
    ] encled md9
    0:0:18:0/Slot11 sde fault_off    LOCATE_ON
    0:0:18:0/Slot08 sdf fault_off    LOCATE_ON
    0:0:18:0/Slot06 sdg fault_off    LOCATE_ON
    0:0:18:0/Slot10 sdj fault_off    LOCATE_ON
    0:0:18:0/Slot09 sdk fault_off    LOCATE_ON
    0:0:18:0/Slot07 sdl fault_off    LOCATE_ON
KJ7LNW commented 1 year ago

@amarao, are you open to importing re ?

I could make this PR a bit more robust and readable if re is acceptable.

Let me know...

amarao commented 1 year ago

Improvements are welcome, but, please, do not break existing scenarios.

amarao commented 1 year ago

And re is in standard, so, yep, it's fine as long as it readable

KJ7LNW commented 1 year ago

We cleaned up the commit, and now it will recurse arbitrary block device stacking hierarchies, such as RAID, LVM, etc. Please see the commit message and the diff for details. I believe that everything is compatible in the same way, now with an additional feature.

The second commit is a minor change that default sorting output by enclosure and slot.

Let me know if you have any questions or comments, and thank you for maintaining this!

-Eric