summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorSimon Guest <Simon Guest [email protected]>2013-12-09 17:20:20 +1300
committerBrian Behlendorf <[email protected]>2013-12-10 09:58:35 -0800
commit383efa5743ecf05e11b859e2dcc0133ceab8b458 (patch)
tree9b23bc73bdb2c36b88d4fdfda8ad0946b0ab190c /cmd
parentb6e335bfc489c08bb92a8667e71fa7f69e87d960 (diff)
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 <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1692
Diffstat (limited to 'cmd')
-rwxr-xr-xcmd/vdev_id/vdev_id6
1 files changed, 4 insertions, 2 deletions
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