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 <bass6@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1692
This commit is contained in:
Simon Guest 2013-12-09 17:20:20 +13:00 committed by Brian Behlendorf
parent b6e335bfc4
commit 383efa5743
1 changed files with 4 additions and 2 deletions

View File

@ -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