2020-10-14 21:36:17 +00:00
|
|
|
#!/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: LiLin <lilin@redhat.com>
|
2024-08-01 20:11:58 +00:00
|
|
|
source ../include/tc.sh || exit 200
|
2020-10-14 21:36:17 +00:00
|
|
|
|
2024-08-01 20:11:58 +00:00
|
|
|
cleanup()
|
2020-10-14 21:36:17 +00:00
|
|
|
{
|
|
|
|
sleep 5
|
|
|
|
udevadm settle
|
2024-08-01 20:11:58 +00:00
|
|
|
trun "multipath -DF"
|
2020-10-14 21:36:17 +00:00
|
|
|
sleep 5
|
2024-08-01 20:11:58 +00:00
|
|
|
trun "modprobe -r scsi_debug"
|
|
|
|
}
|
2020-10-14 21:36:17 +00:00
|
|
|
|
2024-08-01 20:11:58 +00:00
|
|
|
assert ()
|
|
|
|
{
|
|
|
|
local cmd="$*"
|
|
|
|
_trun_ "$cmd" 0
|
|
|
|
if test $? -eq 0; then
|
|
|
|
tpass_ "$cmd" ;
|
|
|
|
else
|
|
|
|
tfail_ "$cmd" ;
|
|
|
|
cleanup ;
|
|
|
|
tend ;
|
|
|
|
fi
|
2020-10-14 21:36:17 +00:00
|
|
|
}
|
|
|
|
|
2024-08-01 20:11:58 +00:00
|
|
|
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"
|
2020-10-14 21:36:17 +00:00
|
|
|
sleep 5
|
2024-08-01 20:11:58 +00:00
|
|
|
trun "multipath"
|
2020-10-14 21:36:17 +00:00
|
|
|
sleep 5
|
2024-08-01 20:11:58 +00:00
|
|
|
trun "multipath -l"
|
2020-10-14 21:36:17 +00:00
|
|
|
mpathdev=`multipath -l | grep scsi_debug | awk '{print $1}' | head -1`
|
2024-08-01 20:11:58 +00:00
|
|
|
assert "[[ -n \"$mpathdev\" ]]"
|
2020-10-14 21:36:17 +00:00
|
|
|
before_active=`multipath -l $mpathdev | grep "active undef" | wc -l`
|
2024-08-01 20:11:58 +00:00
|
|
|
tlog "before active = ${before_active}"
|
2020-10-14 21:36:17 +00:00
|
|
|
|
|
|
|
IO_error=`dd if=/dev/zero of=/dev/mapper/$mpathdev bs=1024 seek=2330 count=10 2>&1 | grep -o "Input/output error" `
|
2024-08-01 20:11:58 +00:00
|
|
|
assert "[[ -n \"$IO_error\" ]]"
|
|
|
|
after_active=`multipath -l $mpathdev | grep "active undef" | wc -l`
|
|
|
|
tlog "after active = ${after_active}"
|
|
|
|
assert "[[ \"$before_active\" -eq \"$after_active\" ]]"
|
|
|
|
cleanup
|
|
|
|
tend
|