device-mapper-multipath-0.8.7-32

Modify bindings, find_multipaths, and user_friendly_names tests
  * Fixes RHEL-28068 & RHEL-4459
Resolves: RHEL-28068
Resolves: RHEL-44569
This commit is contained in:
Benjamin Marzinski 2024-08-05 16:58:42 -04:00
parent af6a90b92d
commit 119f215010
7 changed files with 355 additions and 201 deletions

View File

@ -1,6 +1,6 @@
Name: device-mapper-multipath Name: device-mapper-multipath
Version: 0.8.7 Version: 0.8.7
Release: 31%{?dist} Release: 32%{?dist}
Summary: Tools to manage multipath devices using device-mapper Summary: Tools to manage multipath devices using device-mapper
License: GPLv2 License: GPLv2
URL: http://christophe.varoqui.free.fr/ URL: http://christophe.varoqui.free.fr/
@ -334,7 +334,13 @@ fi
%{_pkgconfdir}/libdmmp.pc %{_pkgconfdir}/libdmmp.pc
%changelog %changelog
* Tue Jul 30 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-30 * Mon Aug 5 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-32
- Modify bindings, find_multipaths, and user_friendly_names tests
* Fixes RHEL-28068 & RHEL-4459
- Resolves: RHEL-28068
- Resolves: RHEL-44569
* Tue Jul 30 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.8.7-31
- Modify multiple tests especially medium_error_scsi_debug and squelch_scsi_id - Modify multiple tests especially medium_error_scsi_debug and squelch_scsi_id
* Fixes RHEL-28068 & RHEL-4459 * Fixes RHEL-28068 & RHEL-4459
- Resolves: RHEL-28068 - Resolves: RHEL-28068

View File

@ -18,40 +18,110 @@
# Author: Lin Li <lilin@redhat.com> # Author: Lin Li <lilin@redhat.com>
#set -x #set -x
source ../include/ec.sh || exit 200 source ../include/tc.sh || exit 200
tlog "running $0" tlog "running $0"
trun "service multipathd stop" cleanup ()
rpm -q device-mapper-multipath || yum install -y device-mapper-multipath {
trun "mpathconf --enable --with_multipathd y --user_friendly_names y" local retries
trun "service multipathd status" if pidof multipathd; then
sleep 5 tlog "stopping multipathd"
trun "systemctl stop multipathd.service || pkill multipathd"
sleep 1
fi
retries=10
while pidof multipathd; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to stop multipath"
tend
fi
tlog "waiting for multipathd to stop"
sleep 2
pidof multipathd && pkill multipathd
done
trun "multipath -l -v1"
retries=10
while [[ -n `multipath -l -v1` ]]; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to remove deviece"
tend
fi
tlog "removing multipath device"
trun "udevadm settle"
trun "multipath -DF"
sleep 2
done
if lsmod | grep -q "^scsi_debug"; then
tlog "removing scsi_debug module"
tok "rmmod scsi_debug"
fi
trun "rm -f /etc/multipath.conf"
}
trun "multipath -F" assert ()
sleep 5 {
terr "modprobe -r scsi_debug" local cmd="$*"
terr "modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 \ _trun_ "$cmd" 0
max_luns=2 no_lun_0=1" if test $? -eq 0; then
sleep 5 tpass_ "$cmd" ;
else
tfail_ "$cmd" ;
cleanup ;
tend ;
fi
}
disk_path=$(get_scsi_debug_devices) setup_config ()
disk=$(basename $disk_path) {
mpath_name=$(get_mpath_disk_by_scsi_device $disk) trun "mpathconf --enable --user_friendly_names y"
sed -i '/^blacklist[[:space:]]*{/ a\
device {\
vendor ".*"\
product ".*"\
}
' /etc/multipath.conf
cat << _EOF_ >> /etc/multipath.conf
blacklist_exceptions {
device {
vendor Linux
product scsi_debug
}
}
_EOF_
trun "cat /etc/multipath.conf"
}
do_reconfigure ()
{
tok "multipathd reconfigure"
sleep 5
}
rpm -q device-mapper-multipath || dnf install -y device-mapper-multipath
cleanup
setup_config
trun "rm -r /etc/multipath/bindings"
trun "modprobe scsi_debug vpd_use_hostno=0 add_host=2"
sleep 5
trun "systemctl start multipathd.service"
while multipathd show daemon | grep -qv idle; do
tlog "waiting for multipathd to start"
sleep 1
done
trun 'multipathd show maps raw format "%n"'
mpath_name=`multipathd show maps raw format "%n" | head -1`
assert "[[ -n $mpath_name ]] && [[ $mpath_name != ok ]]"
new_alias="mpath_test_$$" new_alias="mpath_test_$$"
trun "sed -i 's/$mpath_name/$new_alias/' /etc/multipath/bindings" trun "sed -i 's/$mpath_name/$new_alias/' /etc/multipath/bindings"
trun "multipath -r" do_reconfigure
sleep 5 trun 'multipathd show maps raw format "%n"'
tok "[[ -b /dev/mapper/$new_alias ]]" mpath_name=`multipathd show maps raw format "%n" | head -1`
tok is_mpath $new_alias assert "[[ $mpath_name = $new_alias ]]"
sleep 5
trun "multipath -F" cleanup
sleep 5
trun "modprobe -r scsi_debug"
trun "service multipathd stop"
sleep 3
trun "multipath -W"
trun "rm /etc/multipath/bindings"
tend tend

View File

@ -1,49 +0,0 @@
#!/bin/bash
# Copyright (c) 2016 Red Hat, Inc.
# #
# # This program is free software: you can redistribute it and/or modify
# # it under the terms of the GNU General Public License as published by
# # the Free Software Foundation, either version 3 of the License, or
# # (at your option) any later version.
# #
# # This program is distributed in the hope that it will be useful,
# # but WITHOUT ANY WARRANTY; without even the implied warranty of
# # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# # GNU General Public License for more details.
# #
# # You should have received a copy of the GNU General Public License
# # along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# # Author: Lin Li <lilin@redhat.com>
.PHONY: all install download clean
BUILT_FILES=
FILES=$(METADATA) Makefile PURPOSE main.sh
run: $(FILES) build
./main.sh
build: $(BUILT_FILES)
chmod a+x ./main.sh
clean:
rm -f *~ *.rpm $(BUILT_FILES)
include /usr/share/rhts/lib/rhts-make.include
$(METADATA): Makefile
@touch $(METADATA)
@echo "Owner: LiLin <lilin@redhat.com>" > $(METADATA)
@echo "Name: $(TEST)" >> $(METADATA)
@echo "Path: $(TEST_DIR)" >> $(METADATA)
@echo "License: GPLv3" >> $(METADATA)
@echo "TestVersion: $(TESTVERSION)" >> $(METADATA)
@echo "Description: find_multipaths" >> $(METADATA)
@echo "TestTime: 15m" >> $(METADATA)
@echo "RunFor: device-mapper-multipath" >> $(METADATA)
@echo "Requires: device-mapper-multipath" >> $(METADATA)
rhts-lint $(METADATA)

View File

@ -18,39 +18,92 @@
# Author: Lin Li <lilin@redhat.com> # Author: Lin Li <lilin@redhat.com>
#set -x #set -x
source ../include/ec.sh || exit 200 source ../include/tc.sh || exit 200
tlog "running $0"
remove_devices ()
{
local retries
retries=10
while [[ -n `multipath -l -v1` ]]; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to remove devices"
cleanup
tend
fi
tlog "removing multipath devices"
trun "udevadm settle"
trun "multipath -F"
sleep 2
done
}
cleanup () cleanup ()
{ {
trun "multipathd disablequeueing maps" local retries
trun "service multipathd stop" if pidof multipathd; then
sleep 5 tlog "stopping multipathd"
trun "systemctl stop multipathd.service || pkill multipathd"
sleep 1
fi
retries=10
while pidof multipathd; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to stop multipath"
tend
fi
tlog "waiting for multipathd to stop"
sleep 2
pidof multipathd && pkill multipathd
done
trun "multipath -l -v1"
retries=10
while [[ -n `multipath -l -v1` ]]; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to remove devices"
tend
fi
tlog "removing multipath devices"
trun "udevadm settle" trun "udevadm settle"
trun "multipath -F" trun "multipath -DF"
sleep 5 sleep 2
trun "modprobe -r scsi_debug" done
if lsmod | grep -q "^scsi_debug"; then
tlog "removing scsi_debug module"
tok "rmmod scsi_debug"
fi
trun "rm -f /etc/multipath.conf"
trun "rm -f /etc/multipath/wwids"
trun "rm -r /etc/multipath/bindings"
} }
tlog "running $0" assert ()
{
local cmd="$*"
_trun_ "$cmd" 0
if test $? -eq 0; then
tpass_ "$cmd" ;
else
tfail_ "$cmd" ;
cleanup ;
tend ;
fi
}
# which not set find_multipaths yes, so multipath always create a multipath device for single device setup_config ()
# so stop service and reconfig with --find_multipaths y, and reload/start the service again. {
rpm -q device-mapper-multipath || yum install -y device-mapper-multipath trun "mpathconf --enable --user_friendly_names y --find_multipaths y"
sed -i '/^blacklist[[:space:]]*{/ a\
# test with find_multipath=y, will not multipath for the single device; reload/start the service to enable the config device {\
cleanup vendor ".*"\
trun "rm -f /etc/multipath.conf" product ".*"\
trun "rm -f /etc/multipath/wwids" }
trun "mpathconf --enable --user_friendly_names y --find_multipaths y --with_multipathd n"
sed -i '/^blacklist[[:space:]]*{/ a\
device {\n vendor ".*"\n product ".*"\n }
' /etc/multipath.conf ' /etc/multipath.conf
if grep -qw blacklist_exceptions /etc/multipath.conf ; then
sed -i '/^blacklist_exceptions[[:space:]]*{/ a\
device {\n vendor Linux\n product scsi_debug\n }
' /etc/multipath.conf
else
cat << _EOF_ >> /etc/multipath.conf cat << _EOF_ >> /etc/multipath.conf
blacklist_exceptions { blacklist_exceptions {
device { device {
vendor Linux vendor Linux
@ -58,56 +111,69 @@ blacklist_exceptions {
} }
} }
_EOF_ _EOF_
fi trun "cat /etc/multipath.conf"
trun "service multipathd start" }
do_reconfigure ()
{
trun "cat /etc/multipath.conf"
tok "multipathd reconfigure"
sleep 5
}
trun "rpm -q device-mapper-multipath || dnf install -y device-mapper-multipath"
cleanup
setup_config
# test with find_multipath=y, will not multipath the single device
trun "modprobe scsi_debug" trun "modprobe scsi_debug"
sleep 5 sleep 5
trun "systemctl start multipathd.service"
while multipathd show daemon | grep -qv idle; do
tlog "waiting for multipathd to start"
sleep 1
done
trun 'multipathd show paths raw format "%d %m"'
trun 'cat /etc/multipath/wwids'
mpath_name=`multipathd show paths raw format "%m" | head -1`
tok "[[ $mpath_name = '[orphan]' ]]"
remove_devices
# test with find_multipath=n, will multipath the single device
trun 'mpathconf --find_multipaths n'
do_reconfigure
trun 'multipathd show paths raw format "%d %m"'
trun 'cat /etc/multipath/wwids'
mpath_name=`multipathd show paths raw format "%m" | head -1`
tok "[[ -n $mpath_name ]] && [[ $mpath_name != '[orphan]' ]]"
remove_devices
# test with find_multipath=y, with multipath single device with known WWID
trun 'mpathconf --find_multipaths y'
do_reconfigure
trun 'multipathd show paths raw format "%d %m"'
trun 'cat /etc/multipath/wwids'
mpath_name=`multipathd show paths raw format "%m" | head -1`
tok "[[ -n $mpath_name ]] && [[ $mpath_name != '[orphan]' ]]"
remove_devices
# Clear WWID, test with find_multipath=y, will not multipath single device
trun "multipath -W" trun "multipath -W"
cat /etc/multipath/wwids do_reconfigure
trun "multipath" trun 'multipathd show paths raw format "%d %m"'
disk_path=$(get_scsi_debug_devices) trun 'cat /etc/multipath/wwids'
disk_node=$(basename $disk_path) mpath_name=`multipathd show paths raw format "%m" | head -1`
mpath_name=$(get_mpath_disk_by_scsi_device $disk_node) tok "[[ $mpath_name = '[orphan]' ]]"
tok '[[ $mpath_name = "[orphan]" ]]' remove_devices
assert 'rmmod scsi_debug'
# test with find_multipath=n, will multipath for the single device
trun "mpathconf --user_friendly_names y --find_multipaths n --with_multipathd y"
sleep 5
mpath_name=$(get_mpath_disk_by_scsi_device $disk_node)
tok "is_mpath $mpath_name"
# flush new created path
trun "multipath -F"
sleep 1
# test with find_multipath=y, A path has the same WWID as a multipath device that was previously created
trun "mpathconf --user_friendly_names y --find_multipaths y --with_multipathd y"
sleep 5
mpath_name=$(get_mpath_disk_by_scsi_device $disk_node)
tok "is_mpath $mpath_name"
trun "multipath -F"
sleep 1
# Clear wwid, test with find_multipath=y, will not multipath for the single device
trun "multipath -W"
trun "service multipathd reload"
sleep 5
mpath_name=$(get_mpath_disk_by_scsi_device $disk_node)
tok '[[ $mpath_name = "[orphan]" ]]'
trun "multipath -F"
sleep 5
trun "modprobe -r scsi_debug"
# test find_multipaths=y create device for paths have same wwid # test find_multipaths=y create device for paths have same wwid
tok "modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1" trun "modprobe scsi_debug vpd_use_hostno=0 add_host=2"
sleep 5 sleep 5
disk_paths=$(get_scsi_debug_devices) trun 'multipathd show paths raw format "%d %m"'
disk_node=$(basename $disk_paths) trun 'cat /etc/multipath/wwids'
mpath_name=$(get_mpath_disk_by_scsi_device $disk_node) mpath_name=`multipathd show paths raw format "%m" | head -1`
tok "is_mpath $mpath_name" tok "[[ -n $mpath_name ]] && [[ $mpath_name != '[orphan]' ]]"
cleanup cleanup
trun "multipath -W"
cat /etc/multipath/wwids
tend tend

View File

@ -17,50 +17,125 @@
# Author: Lin Li <lilin@redhat.com> # Author: Lin Li <lilin@redhat.com>
source ../include/ec.sh || exit 200 source ../include/tc.sh || exit 200
tlog "running $0" tlog "running $0"
trun "rpm -q device-mapper-multipath || yum install -y device-mapper-multipath" cleanup ()
trun "mpathconf --enable --with_multipathd y --user_friendly_names y" {
local retries
if pidof multipathd; then
tlog "stopping multipathd"
trun "systemctl stop multipathd.service || pkill multipathd"
sleep 1
fi
retries=10
while pidof multipathd; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to stop multipath"
tend
fi
tlog "waiting for multipathd to stop"
sleep 2
pidof multipathd && pkill multipathd
done
trun "multipath -l -v1"
retries=10
while [[ -n `multipath -l -v1` ]]; do
((retries--))
if [[ $retries -le 0 ]]; then
tfail_ "failed to remove deviece"
tend
fi
tlog "removing multipath device"
trun "udevadm settle"
trun "multipath -DF"
sleep 2
done
if lsmod | grep -q "^scsi_debug"; then
tlog "removing scsi_debug module"
tok "rmmod scsi_debug"
fi
trun "rm -f /etc/multipath.conf"
}
# backup the /etc/multipath.conf assert ()
trun "cp /etc/multipath.conf /etc/multipath.conf.$$" {
trun "multipath -F" local cmd="$*"
_trun_ "$cmd" 0
if test $? -eq 0; then
tpass_ "$cmd" ;
else
tfail_ "$cmd" ;
cleanup ;
tend ;
fi
}
trun "modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 \ setup_config ()
max_luns=2 no_lun_0=1" {
trun "multipath" trun "mpathconf --enable --user_friendly_names y"
# wwid shown slowly on s390x by the script framework, but normally when run by multipath command directly sed -i '/^blacklist[[:space:]]*{/ a\
# so extend sleep time device {\
sleep 20 vendor ".*"\
product ".*"\
}
' /etc/multipath.conf
cat << _EOF_ >> /etc/multipath.conf
disk=$(get_scsi_debug_devices) blacklist_exceptions {
disk=$(basename $disk) device {
wwid=$(get_wwid_of_disk $disk) vendor Linux
mpath=$(get_mpath_disk_by_scsi_device $disk) product scsi_debug
}
}
# user_friendly_names = yes and mpath=test multipaths {
#cur_dir=/mnt/tests/kernel/storage/multipath/user_friendly_names/ multipath {
#cur_dir=/home/test/scratch/device-mapper-multipath/user_friendly_names wwid TEST_WWID
trun "cat multipath.conf.yes | sed "s/your_wwid/$wwid/g" > /etc/multipath.conf" alias test
trun "cat -n /etc/multipath.conf" }
trun "multipath -r" }
echo ">>> Verify 'test ($wwid)' is present ..." _EOF_
trun "multipath -ll" trun "cat /etc/multipath.conf"
tok "multipath -ll | egrep \"^test\"" }
# user_friendly_names = no do_reconfigure ()
trun "cat multipath.conf.no > /etc/multipath.conf" {
trun "multipath -r" trun "cat /etc/multipath.conf"
echo ">>> Verify 'test' is gone but '$wwid' present ..." tok "multipathd reconfigure"
trun "multipath -ll" sleep 5
tok "multipath -ll | egrep \"^$wwid\"" }
sleep 10
tok "multipath -F $wwid"
sleep 10
trun "modprobe -r scsi_debug"
trun "cp /etc/multipath.conf.$$ /etc/multipath.conf" trun "rpm -q device-mapper-multipath || dnf install -y device-mapper-multipath"
trun "multipath -F; multipath" cleanup
setup_config
trun "rm -r /etc/multipath/bindings"
trun "modprobe scsi_debug vpd_use_hostno=0 add_host=2"
sleep 5
trun "systemctl start multipathd.service"
while multipathd show daemon | grep -qv idle; do
tlog "waiting for multipathd to start"
sleep 1
done
trun 'multipathd show maps raw format "%n %w"'
# verify user_friendly_name
tok 'multipathd show maps raw format "%n" | head -1 | grep -q mpath'
wwid=`multipathd show maps raw format "%w" | head -1`
assert "[[ -n $wwid ]] && [[ $wwid != ok ]]"
sed -i 's/TEST_WWID/'"$wwid"'/' /etc/multipath.conf
do_reconfigure
trun 'multipathd show maps raw format "%n %w"'
# verify configured alias takes precedence over user_friendly_name
tok 'multipathd show maps raw format "%n" | head -1 | grep -q test'
trun "mpathconf --user_friendly_names n"
do_reconfigure
trun 'multipathd show maps raw format "%n %w"'
# verify configured alias takes precedence over wwid name
tok 'multipathd show maps raw format "%n" | head -1 | grep -q test'
sed -i 's/'"$wwid"'/TEST_WWID/' /etc/multipath.conf
do_reconfigure
trun 'multipathd show maps raw format "%n %w"'
tok 'multipathd show maps raw format "%n" | head -1 | grep -q '"$wwid"
cleanup
tend tend

View File

@ -1,3 +0,0 @@
defaults {
user_friendly_names no
}

View File

@ -1,11 +0,0 @@
defaults {
user_friendly_names yes
}
multipaths {
multipath {
wwid your_wwid
alias test
}
}