Skip to content

Detect iSCSI in the zpool cmd vdev media script #12206

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion cmd/zpool/zpool.d/media
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#

if [ "$1" = "-h" ] ; then
echo "Show whether a vdev is a file, hdd, or ssd."
echo "Show whether a vdev is a file, hdd, ssd, or iscsi."
exit
fi

Expand All @@ -18,6 +18,13 @@ if [ -b "$VDEV_UPATH" ]; then
if [ "$val" = "1" ]; then
MEDIA="hdd"
fi

vpd_pg83="/sys/block/$device/device/vpd_pg83"
if [ -f "$vpd_pg83" ]; then
if grep -q --binary "iqn." "$vpd_pg83"; then
MEDIA="iscsi"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since iscsi is the transport protocol, would it make sense to append iscsi to the disk type, like iscsi-hdd or iscsi-ssd? (I have not used iscsi so this may be a dumb question).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the iSCSI protocol exposes the backend device type. But I'll try an experiment with both backends to see if we can see it. If so then a hybrid might make sense.

fi
fi
else
if [ -f "$VDEV_UPATH" ]; then
MEDIA="file"
Expand Down