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 <behlendorf1@llnl.gov> Signed-off-by: Simon Guest <simon.guest@tesujimath.org> Closes #6956
This commit is contained in:
parent
89a66a0457
commit
993669a7bf
|
@ -276,6 +276,23 @@ sas_handler() {
|
||||||
d=$(eval echo \${$i})
|
d=$(eval echo \${$i})
|
||||||
SLOT=`echo $d | sed -e 's/^.*://'`
|
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
|
esac
|
||||||
if [ -z "$SLOT" ] ; then
|
if [ -z "$SLOT" ] ; then
|
||||||
return
|
return
|
||||||
|
|
|
@ -90,7 +90,7 @@ internally uses this value to determine which HBA or switch port a
|
||||||
device is connected to. The default is 4.
|
device is connected to. The default is 4.
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
\fIslot\fR <bay|phy|port|id|lun>
|
\fIslot\fR <bay|phy|port|id|lun|ses>
|
||||||
Specifies from which element of a SAS identifier the slot number is
|
Specifies from which element of a SAS identifier the slot number is
|
||||||
taken. The default is bay.
|
taken. The default is bay.
|
||||||
|
|
||||||
|
@ -103,6 +103,12 @@ taken. The default is bay.
|
||||||
\fIid\fR - use the scsi id as the slot number.
|
\fIid\fR - use the scsi id as the slot number.
|
||||||
|
|
||||||
\fIlun\fR - use the scsi lun as the slot number.
|
\fIlun\fR - use the scsi lun as the slot number.
|
||||||
|
|
||||||
|
\fIses\fR - use the SCSI Enclosure Services (SES) enclosure device slot number,
|
||||||
|
as reported by
|
||||||
|
.BR sg_ses (8).
|
||||||
|
This is intended for use only on systems where \fIbay\fR is unsupported,
|
||||||
|
noting that \fIport\fR and \fIid\fR may be unstable across disk replacement.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
A non-multipath configuration with direct-attached SAS enclosures and an
|
A non-multipath configuration with direct-attached SAS enclosures and an
|
||||||
arbitrary slot re-mapping.
|
arbitrary slot re-mapping.
|
||||||
|
|
Loading…
Reference in New Issue