summaryrefslogtreecommitdiffstats
path: root/tests/user_friendly_names/main.sh
blob: b8d3a366f4aa77481d7351acaf8368c68516201e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/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>

source ../include/ec.sh || exit 200

tlog "running $0"

trun "rpm -q device-mapper-multipath || yum install -y device-mapper-multipath"
trun "mpathconf --enable --with_multipathd y --user_friendly_names y"

# backup the /etc/multipath.conf
trun "cp /etc/multipath.conf /etc/multipath.conf.$$"
trun "multipath -F"

trun "modprobe scsi_debug dev_size_mb=256 num_tgts=1 vpd_use_hostno=0 \
add_host=2 delay=20 max_luns=2 no_lun_0=1"
trun "multipath"
# wwid shown slowly on s390x by the script framework, but normally when run by multipath command directly
# so extend sleep time 
sleep 20

disk=$(get_scsi_debug_devices)
disk=$(basename $disk)
wwid=$(get_wwid_of_disk $disk)
mpath=$(get_mpath_disk_by_scsi_device $disk)

# user_friendly_names = yes and mpath=test
#cur_dir=/mnt/tests/kernel/storage/multipath/user_friendly_names/
#cur_dir=/home/test/scratch/device-mapper-multipath/user_friendly_names
trun "cat multipath.conf.yes | sed 's/your_wwid/$wwid/g' > /etc/multipath.conf"
trun "multipath -r"
tok "multipath -ll | grep -w '^test'"

# user_friendly_names = no
trun "cat multipath.conf.no > /etc/multipath.conf"
trun "multipath -r"
tok "multipath -ll | grep -w '^$wwid'"
sleep 10
tok "multipath -F $wwid"
sleep 10
trun "modprobe -r scsi_debug"

trun "cp /etc/multipath.conf.$$ /etc/multipath.conf"
trun "multipath -F; multipath"
tend