]> git.proxmox.com Git - mirror_zfs.git/blobdiff - cmd/vdev_id/vdev_id
vdev_id: new slot type ses
[mirror_zfs.git] / cmd / vdev_id / vdev_id
index 9fa2d672c03a8c1b4e8a8ba4e8c06b85029ba80a..4c7b270a85442ce23787d7359af2e1b81d7fa54f 100755 (executable)
@@ -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