File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -485,19 +485,22 @@ info::__find_iscsi() {
485485 [ " ${_lun} " = " ${_target} " ] && _lun=0
486486 _target=${_target%/* }
487487
488- _found=$( iscsictl -L -w 10 | grep ${_target} | wc -l)
489- if [ " ${_found} " -ne 1 ]; then
488+ # Set _col to be the column of iscsictl -L we want
489+ _col=$(( _lun + 4 ))
490+
491+ # Check first with trailing space for a unique case; if this returns no results,
492+ # recheck (backward compat) without trailing space.
493+ _found=$( iscsictl -L -w 10 | awk " /${_target} /{print \$ ${_col} }" )
494+ [ -z " _found" ] && _found=$( iscsictl -L | awk " /${_target} /{print \$ ${_col} }" )
495+
496+ if [ $( echo " ${_found} " | wc -w) -ne 1 ]; then
490497 setvar " ${_var} " " "
491- util::err " Unable to locate unique iSCSI device ${_target} "
498+ util::err " Unable to locate unique iSCSI device [ ${_target} ] "
492499 fi
493500
494- # _col to be the column of iscsictl -L we want
495- _col=$(( _lun + 4 ))
496- _found=$( iscsictl -L | awk " /${_target} /{print \$ ${_col} }" )
497501 if echo " ${_found} " | egrep -q ' ^da[0-9]+$' ; then
498502 setvar " ${_var} " /dev/" ${_found} "
499503 return 0
500504 fi
501-
502505 util::err " Unable to locate iSCSI device ${_target} /${_lun} "
503506}
You can’t perform that action at this time.
0 commit comments