device-mapper-multipath-0.9.9-2
Improve multiple OSCI tests
This commit is contained in:
parent
457b1ac346
commit
73bc951c61
@ -1,6 +1,6 @@
|
|||||||
Name: device-mapper-multipath
|
Name: device-mapper-multipath
|
||||||
Version: 0.9.9
|
Version: 0.9.9
|
||||||
Release: 1%{?dist}
|
Release: 2%{?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/
|
||||||
@ -233,6 +233,9 @@ fi
|
|||||||
%{_pkgconfdir}/libdmmp.pc
|
%{_pkgconfdir}/libdmmp.pc
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Sep 12 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.9-2
|
||||||
|
- Improve multiple OSCI tests
|
||||||
|
|
||||||
* Fri Jul 26 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.9-1
|
* Fri Jul 26 2024 Benjamin Marzinski <bmarzins@redhat.com> - 0.9.9-1
|
||||||
- Update source to upstream version 0.9.9
|
- Update source to upstream version 0.9.9
|
||||||
* Previous patches 0014-0015 are included in the soruce tarball
|
* Previous patches 0014-0015 are included in the soruce tarball
|
||||||
|
@ -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
|
||||||
|
@ -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)
|
|
@ -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 "udevadm settle"
|
trun "systemctl stop multipathd.service || pkill multipathd"
|
||||||
trun "multipath -F"
|
sleep 1
|
||||||
sleep 5
|
fi
|
||||||
trun "modprobe -r scsi_debug"
|
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 "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 "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\
|
||||||
|
device {\
|
||||||
|
vendor ".*"\
|
||||||
|
product ".*"\
|
||||||
|
}
|
||||||
|
' /etc/multipath.conf
|
||||||
|
cat << _EOF_ >> /etc/multipath.conf
|
||||||
|
|
||||||
# test with find_multipath=y, will not multipath for the single device; reload/start the service to enable the config
|
|
||||||
cleanup
|
|
||||||
trun "rm -f /etc/multipath.conf"
|
|
||||||
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
|
|
||||||
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
|
|
||||||
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
|
||||||
|
@ -44,9 +44,12 @@ function _init (){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _destroy (){
|
function _destroy (){
|
||||||
sleep 10
|
Cmd "multipathd disablequeueing maps"
|
||||||
Cmd "multipath -F"
|
|
||||||
sleep 5
|
sleep 5
|
||||||
|
Cmd "multipath -DF -R2"
|
||||||
|
Cmd "service multipathd stop"
|
||||||
|
sleep 5
|
||||||
|
Cmd "udevadm settle"
|
||||||
Cmd "modprobe -r scsi_debug"
|
Cmd "modprobe -r scsi_debug"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,10 +177,7 @@ AA
|
|||||||
fi
|
fi
|
||||||
#setup scsi_debug
|
#setup scsi_debug
|
||||||
echo "INFO: Loading scsi_debug module for simulation of mpath"
|
echo "INFO: Loading scsi_debug module for simulation of mpath"
|
||||||
modprobe scsi_debug \
|
modprobe scsi_debug vpd_use_hostno=0 add_host=2
|
||||||
num_tgts=1 vpd_use_hostno=0 \
|
|
||||||
add_host=4 delay=20 \
|
|
||||||
max_luns=2 no_lun_0=1 2>&1 1>/dev/null
|
|
||||||
|
|
||||||
echo "INFO: Waiting for udev to create /dev/sdX"
|
echo "INFO: Waiting for udev to create /dev/sdX"
|
||||||
sleep 15s #wait for udev to create /dev/sdX
|
sleep 15s #wait for udev to create /dev/sdX
|
||||||
@ -190,7 +190,6 @@ AA
|
|||||||
cat << AA > /etc/multipath.conf
|
cat << AA > /etc/multipath.conf
|
||||||
defaults {
|
defaults {
|
||||||
#Enable multibus is for mutlbus testing
|
#Enable multibus is for mutlbus testing
|
||||||
path_grouping_policy multibus
|
|
||||||
user_friendly_names yes
|
user_friendly_names yes
|
||||||
}
|
}
|
||||||
blacklist {
|
blacklist {
|
||||||
|
@ -16,47 +16,51 @@
|
|||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
# Author: LiLin <lilin@redhat.com>
|
# Author: LiLin <lilin@redhat.com>
|
||||||
|
source ../include/tc.sh || exit 200
|
||||||
|
|
||||||
function cleanup()
|
cleanup()
|
||||||
{
|
{
|
||||||
sleep 5
|
sleep 5
|
||||||
udevadm settle
|
udevadm settle
|
||||||
multipath -F
|
trun "multipath -DF"
|
||||||
sleep 5
|
sleep 5
|
||||||
modprobe -r scsi_debug
|
trun "modprobe -r scsi_debug"
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
yum -y install device-mapper device-mapper-multipath
|
assert ()
|
||||||
mpathconf --enable
|
{
|
||||||
service multipathd stop
|
local cmd="$*"
|
||||||
modprobe scsi_debug num_tgts=1 vpd_use_hostno=0 add_host=2 delay=20 max_luns=2 no_lun_0=1 opts=2
|
_trun_ "$cmd" 0
|
||||||
|
if test $? -eq 0; then
|
||||||
|
tpass_ "$cmd" ;
|
||||||
|
else
|
||||||
|
tfail_ "$cmd" ;
|
||||||
|
cleanup ;
|
||||||
|
tend ;
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
tlog "running $0"
|
||||||
|
rpm -q device-mapper-multipath || dnf install -y device-mapper-multipath
|
||||||
|
trun "multipathd disablequeueing maps"
|
||||||
|
cleanup
|
||||||
|
trun "service multipathd stop"
|
||||||
|
trun "rm -f /etc/multipath.conf"
|
||||||
|
trun "mpathconf --enable"
|
||||||
|
trun "modprobe scsi_debug vpd_use_hostno=0 add_host=2 opts=2"
|
||||||
sleep 5
|
sleep 5
|
||||||
multipath > /dev/null
|
trun "multipath"
|
||||||
sleep 5
|
sleep 5
|
||||||
|
trun "multipath -l"
|
||||||
mpathdev=`multipath -l | grep scsi_debug | awk '{print $1}' | head -1`
|
mpathdev=`multipath -l | grep scsi_debug | awk '{print $1}' | head -1`
|
||||||
if [ -z "$mpathdev" ]; then
|
assert "[[ -n \"$mpathdev\" ]]"
|
||||||
echo "------- FAIL, no multipath device created -----"
|
|
||||||
cleanup
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
before_active=`multipath -l $mpathdev | grep "active undef" | wc -l`
|
before_active=`multipath -l $mpathdev | grep "active undef" | wc -l`
|
||||||
|
tlog "before active = ${before_active}"
|
||||||
|
|
||||||
IO_error=`dd if=/dev/zero of=/dev/mapper/$mpathdev bs=1024 seek=2330 count=10 2>&1 | grep -o "Input/output error" `
|
IO_error=`dd if=/dev/zero of=/dev/mapper/$mpathdev bs=1024 seek=2330 count=10 2>&1 | grep -o "Input/output error" `
|
||||||
if [ -n "$IO_error" ];then
|
assert "[[ -n \"$IO_error\" ]]"
|
||||||
after_active=`multipath -l $mpathdev | grep "active undef" | wc -l`
|
after_active=`multipath -l $mpathdev | grep "active undef" | wc -l`
|
||||||
if [ "$before_active" -eq "$after_active" ]; then
|
tlog "after active = ${after_active}"
|
||||||
echo "------- PASS, a medium error, correctly generated an I/O error and did not fail paths -----"
|
assert "[[ \"$before_active\" -eq \"$after_active\" ]]"
|
||||||
cleanup
|
cleanup
|
||||||
exit 0
|
tend
|
||||||
else
|
|
||||||
echo "------- FAIL, paths failed -----"
|
|
||||||
cleanup
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "------- FAIL, did not generate an I/O error -----"
|
|
||||||
cleanup
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
@ -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
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
defaults {
|
|
||||||
user_friendly_names no
|
|
||||||
}
|
|
@ -1,11 +0,0 @@
|
|||||||
defaults {
|
|
||||||
user_friendly_names yes
|
|
||||||
}
|
|
||||||
|
|
||||||
multipaths {
|
|
||||||
multipath {
|
|
||||||
wwid your_wwid
|
|
||||||
alias test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user