From 383efa5743ecf05e11b859e2dcc0133ceab8b458 Mon Sep 17 00:00:00 2001 From: Simon Guest Date: Mon, 9 Dec 2013 17:20:20 +1300 Subject: Fix multipath bug in vdev_id caused by inconsistent field numbering The bug is caused by multipath output like this: 35000c50056bd77a7 dm-15 HP,MB3000FCWDH size=2.7T features='0' hwhandler='0' wp=rw |-+- policy='round-robin 0' prio=0 status=active | `- 2:0:16:0 sdq 65:0 active undef running `-+- policy='round-robin 0' prio=0 status=enabled `- 4:0:52:0 sdfp 130:176 active undef running Note that the pipe symbols mean that the field numbering is different between the sdq and sdfp lines. The fix edits out the pipe symbols. Signed-off-by: Ned Bass Signed-off-by: Brian Behlendorf Closes #1692 --- cmd/vdev_id/vdev_id | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd') diff --git a/cmd/vdev_id/vdev_id b/cmd/vdev_id/vdev_id index 3cf1b5828..713ff9865 100755 --- a/cmd/vdev_id/vdev_id +++ b/cmd/vdev_id/vdev_id @@ -179,8 +179,10 @@ sas_handler() { return fi - # Get the raw scsi device name from multipath -l. - DEV=`multipath -l $DM_NAME |awk '/running/{print $3 ; exit}'` + # Get the raw scsi device name from multipath -l. Strip off + # leading pipe symbols to make field numbering consistent. + DEV=`multipath -l $DM_NAME | + awk '/running/{gsub("^[|]"," "); print $3 ; exit}'` if [ -z "$DEV" ] ; then return fi -- cgit v1.2.3