blob: d6afe52f81709f213caadddf3252587fbdfef475 (
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
|
#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
set -e
RDMA_IP_LIST=$(get_available_rdma_ips)
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
if [ -z $NVMF_FIRST_TARGET_IP ]; then
echo "no NIC for nvmf test"
exit 0
fi
timing_enter identify_kernel_nvmf_tgt
subsystemname=nqn.2016-06.io.spdk:testnqn
modprobe null_blk nr_devices=1
modprobe nvmet
modprobe nvmet-rdma
modprobe nvmet-fc
modprobe lpfc
if [ ! -d /sys/kernel/config/nvmet/subsystems/$subsystemname ]; then
mkdir /sys/kernel/config/nvmet/subsystems/$subsystemname
fi
echo 1 > /sys/kernel/config/nvmet/subsystems/$subsystemname/attr_allow_any_host
if [ ! -d /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1 ]; then
mkdir /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1
fi
echo -n /dev/nullb0 > /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1/device_path
echo 1 > /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1/enable
if [ ! -d /sys/kernel/config/nvmet/ports/1 ]; then
mkdir /sys/kernel/config/nvmet/ports/1
fi
echo -n rdma > /sys/kernel/config/nvmet/ports/1/addr_trtype
echo -n ipv4 > /sys/kernel/config/nvmet/ports/1/addr_adrfam
echo -n $NVMF_FIRST_TARGET_IP > /sys/kernel/config/nvmet/ports/1/addr_traddr
echo -n $NVMF_PORT > /sys/kernel/config/nvmet/ports/1/addr_trsvcid
ln -s /sys/kernel/config/nvmet/subsystems/$subsystemname /sys/kernel/config/nvmet/ports/1/subsystems/$subsystemname
sleep 4
$rootdir/examples/nvme/identify/identify -r "\
trtype:RDMA \
adrfam:IPv4 \
traddr:$NVMF_FIRST_TARGET_IP \
trsvcid:$NVMF_PORT \
subnqn:nqn.2014-08.org.nvmexpress.discovery" -t all
$rootdir/examples/nvme/identify/identify -r "\
trtype:RDMA \
adrfam:IPv4 \
traddr:$NVMF_FIRST_TARGET_IP \
trsvcid:$NVMF_PORT \
subnqn:$subsystemname"
rm -rf /sys/kernel/config/nvmet/ports/1/subsystems/$subsystemname
echo 0 > /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1/enable
echo -n 0 > /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1/device_path
rmdir --ignore-fail-on-non-empty /sys/kernel/config/nvmet/subsystems/$subsystemname/namespaces/1
rmdir --ignore-fail-on-non-empty /sys/kernel/config/nvmet/subsystems/$subsystemname
rmdir --ignore-fail-on-non-empty /sys/kernel/config/nvmet/ports/1
rmmod lpfc
rmmod nvmet_fc
rmmod nvmet-rdma
rmmod null_blk
rmmod nvmet
timing_exit identify_kernel_nvmf_tgt
|