blob: 8de41736787ba0c3310b3ba28f35202c782caff2 (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
# $1 = "iso" - triggers isolation mode (setting up required environment).
# $2 = test type posix or vpp. defaults to posix.
iscsitestinit $1 $2
rpc_py="$rootdir/scripts/rpc.py"
node_base="iqn.2013-06.com.intel.ch.spdk"
timing_enter start_iscsi_tgt
"${ISCSI_APP[@]}" --wait-for-rpc &
pid=$!
echo "Process pid: $pid"
trap '$rpc_py bdev_split_delete Name0n1 || true; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py iscsi_set_options -o 30 -a 4 -b $node_base
$rpc_py framework_start_init
$rootdir/scripts/gen_nvme.sh --json | $rpc_py load_subsystem_config
$rpc_py bdev_malloc_create 512 4096 --name Malloc0
echo "iscsi_tgt is listening. Running tests..."
timing_exit start_iscsi_tgt
$rpc_py iscsi_create_portal_group $PORTAL_TAG $TARGET_IP:$ISCSI_PORT
$rpc_py iscsi_create_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
$rpc_py bdev_error_create 'Malloc0'
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
# "64" ==> iSCSI queue depth 64
# "-d" ==> disable CHAP authentication
$rpc_py iscsi_create_target_node Target0 Target0_alias EE_Malloc0:0 1:2 64 -d
sleep 1
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
waitforiscsidevices 1
trap 'for new_dir in $(dir -d /mnt/*dir); do umount $new_dir; rm -rf $new_dir; done;
iscsicleanup; killprocess $pid; iscsitestfini $1 $2; exit 1' SIGINT SIGTERM EXIT
echo "Test error injection"
$rpc_py bdev_error_inject_error EE_Malloc0 'all' 'failure' -n 1000
dev=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')
set +e
waitforfile /dev/${dev}
if make_filesystem ext4 /dev/${dev}; then
echo "mkfs successful - expected failure"
iscsicleanup
killprocess $pid
exit 1
else
echo "mkfs failed as expected"
fi
set -e
iscsicleanup
$rpc_py bdev_error_inject_error EE_Malloc0 'clear' 'failure'
$rpc_py iscsi_delete_target_node $node_base:Target0
echo "Error injection test done"
if [ -z "$NO_NVME" ]; then
bdev_size=$(get_bdev_size Nvme0n1)
split_size=$((bdev_size / 2))
if [ $split_size -gt 10000 ]; then
split_size=10000
fi
$rpc_py bdev_split_create Nvme0n1 2 -s $split_size
$rpc_py iscsi_create_target_node Target1 Target1_alias Nvme0n1p0:0 1:2 64 -d
fi
iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
waitforiscsidevices 1
devs=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')
for dev in $devs; do
make_filesystem ext4 /dev/${dev}
mkdir -p /mnt/${dev}dir
mount -o sync /dev/${dev} /mnt/${dev}dir
rsync -qav --exclude=".git" --exclude="*.o" $rootdir/ /mnt/${dev}dir/spdk
make -C /mnt/${dev}dir/spdk clean
(cd /mnt/${dev}dir/spdk && ./configure $(get_config_params))
make -C /mnt/${dev}dir/spdk -j16
# Print out space consumed on target device to help decide
# if/when we need to increase the size of the malloc LUN
df -h /dev/$dev
rm -rf /mnt/${dev}dir/spdk
done
for dev in $devs; do
umount /mnt/${dev}dir
rm -rf /mnt/${dev}dir
stats=($(cat /sys/block/$dev/stat))
echo ""
echo "$dev stats"
printf "READ IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \
${stats[0]} ${stats[1]} ${stats[2]} ${stats[3]}
printf "WRITE IO cnt: % 8u merges: % 8u sectors: % 8u ticks: % 8u\n" \
${stats[4]} ${stats[5]} ${stats[6]} ${stats[7]}
printf "in flight: % 8u io ticks: % 8u time in queue: % 8u\n" \
${stats[8]} ${stats[9]} ${stats[10]}
echo ""
done
trap - SIGINT SIGTERM EXIT
iscsicleanup
$rpc_py bdev_split_delete Nvme0n1
$rpc_py bdev_error_delete EE_Malloc0
if [ -z "$NO_NVME" ]; then
$rpc_py bdev_nvme_detach_controller Nvme0
fi
killprocess $pid
iscsitestfini $1 $2
|