multipath: fix majmin_to_mpath_dev()
* Multipath device names only start with the mpath-prefix if the option
use_userfriendly_names is set true in /etc/multipath.conf and if user
has not set any aliases in the said file. Thus the for-loop should go
through all files in /dev/mapper/, not just ones starting with 'mpath'
* Bash is perfectly capable to extend `/dev/mapper/*` notation without a
need to pass it to an external ls
* Changed the function to use a local variable $_dev instead of the
global $dev, which seemed to be the original intention as the local
_dev was defined but not used
(cherry picked from commit 28058a2e37
)
parent
28665b4fa5
commit
851946468a
|
@ -11,9 +11,10 @@ is_mpath() {
|
||||||
|
|
||||||
majmin_to_mpath_dev() {
|
majmin_to_mpath_dev() {
|
||||||
local _dev
|
local _dev
|
||||||
for i in `ls -1 /dev/mapper/mpath*`; do
|
for i in /dev/mapper/*; do
|
||||||
dev=$(get_maj_min $i)
|
[[ $i == /dev/mapper/control ]] && continue
|
||||||
if [ "$dev" = "$1" ]; then
|
_dev=$(get_maj_min $i)
|
||||||
|
if [ "$_dev" = "$1" ]; then
|
||||||
echo $i
|
echo $i
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue