diff options
author | Simon Guest <[email protected]> | 2017-12-21 06:42:07 +1300 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2019-02-22 09:47:34 -0800 |
commit | 41f7723e9cb260f313f99d667142e37617812fca (patch) | |
tree | 387dcd341b674c0f39f651429e6f6e23b7d1cbea /cmd | |
parent | 2b8c3cb0c83681d7425fa5bf567e726b7ba975e9 (diff) |
vdev_id: new slot type ses
This extends vdev_id to support a new slot type, ses, for SCSI Enclosure
Services. With slot type ses, the disk slot numbers are determined by
using the device slot number reported by sg_ses for the device with
matching SAS address, found by querying all available enclosures.
This is primarily of use on systems with a deficient driver omitting
support for bay_identifier in /sys/devices. In my testing, I found that
the existing slot types of port and id were not stable across disk
replacement, so an alternative was required.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Simon Guest <[email protected]>
Closes #6956
Diffstat (limited to 'cmd')
-rwxr-xr-x | cmd/vdev_id/vdev_id | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id index 9fa2d672c..4c7b270a8 100755 --- a/cmd/vdev_id/vdev_id +++ b/cmd/vdev_id/vdev_id @@ -276,6 +276,23 @@ sas_handler() { d=$(eval echo \${$i}) SLOT=`echo $d | sed -e 's/^.*://'` ;; + "ses") + # look for this SAS path in all SCSI Enclosure Services + # (SES) enclosures + sas_address=`cat $end_device_dir/sas_address 2>/dev/null` + enclosures=`lsscsi -g | \ + sed -n -e '/enclosu/s/^.* \([^ ][^ ]*\) *$/\1/p'` + for enclosure in $enclosures; do + set -- $(sg_ses -p aes $enclosure | \ + awk "/device slot number:/{slot=\$12} \ + /SAS address: $sas_address/\ + {print slot}") + SLOT=$1 + if [ -n "$SLOT" ] ; then + break + fi + done + ;; esac if [ -z "$SLOT" ] ; then return |