3 testdir
=$
(readlink
-f $
(dirname $0))
4 rootdir
=$
(readlink
-f $testdir/..
/..
/..
)
5 source $rootdir/test
/common
/autotest_common.sh
6 source $rootdir/test
/nvmf
/common.sh
8 rpc_py
="$rootdir/scripts/rpc.py"
17 jq
"$filter" |
awk '{s+=$1}END{print s}'
23 stats
=$
($rpc_py nvmf_get_stats
)
24 # Expect 4 poll groups (from CPU mask) and no transports yet
25 [ "4" -eq $
(jcount .poll_groups
[].name
<<< "$stats") ]
26 [ "null" == $
(jq .poll_groups
[0].transports
[0] <<< "$stats") ]
28 $rpc_py nvmf_create_transport
$NVMF_TRANSPORT_OPTS -u 8192
30 stats
=$
($rpc_py nvmf_get_stats
)
32 [ "0" -eq $
(jsum .poll_groups
[].admin_qpairs
<<< "$stats") ]
33 [ "0" -eq $
(jsum .poll_groups
[].io_qpairs
<<< "$stats") ]
34 # Transport statistics is currently implemented for RDMA only
35 if [ 'rdma' == $TEST_TRANSPORT ]; then
36 # Expect RDMA transport and some devices
37 [ "1" -eq $
(jcount .poll_groups
[0].transports
[].trtype
<<< "$stats") ]
38 transport_type
=$
(jq
-r .poll_groups
[0].transports
[0].trtype
<<< "$stats")
39 [ "${transport_type,,}" == "${TEST_TRANSPORT,,}" ]
40 [ "0" -lt $
(jcount .poll_groups
[0].transports
[0].devices
[].name
<<< "$stats") ]
43 # set times for subsystem construct/delete
44 if [ $RUN_NIGHTLY -eq 1 ]; then
53 $rpc_py bdev_malloc_create
$MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc1
55 # Disallow host NQN and make sure connect fails
56 $rpc_py nvmf_create_subsystem nqn
.2016-06.io.spdk
:cnode1
-a -s $NVMF_SERIAL
57 $rpc_py nvmf_subsystem_add_ns nqn
.2016-06.io.spdk
:cnode1 Malloc1
58 $rpc_py nvmf_subsystem_allow_any_host
-d nqn
.2016-06.io.spdk
:cnode1
59 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode1
-t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
61 # This connect should fail - the host NQN is not allowed
62 ! nvme connect
-t $TEST_TRANSPORT -n nqn
.2016-06.io.spdk
:cnode1
-q nqn
.2016-06.io.spdk
:host1
-a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
64 # Add the host NQN and verify that the connect succeeds
65 $rpc_py nvmf_subsystem_add_host nqn
.2016-06.io.spdk
:cnode1 nqn
.2016-06.io.spdk
:host1
66 nvme connect
-t $TEST_TRANSPORT -n nqn
.2016-06.io.spdk
:cnode1
-q nqn
.2016-06.io.spdk
:host1
-a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
67 waitforserial
"$NVMF_SERIAL"
68 nvme disconnect
-n nqn
.2016-06.io.spdk
:cnode1
70 # Remove the host and verify that the connect fails
71 $rpc_py nvmf_subsystem_remove_host nqn
.2016-06.io.spdk
:cnode1 nqn
.2016-06.io.spdk
:host1
72 ! nvme connect
-t $TEST_TRANSPORT -n nqn
.2016-06.io.spdk
:cnode1
-q nqn
.2016-06.io.spdk
:host1
-a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
74 # Allow any host and verify that the connect succeeds
75 $rpc_py nvmf_subsystem_allow_any_host
-e nqn
.2016-06.io.spdk
:cnode1
76 nvme connect
-t $TEST_TRANSPORT -n nqn
.2016-06.io.spdk
:cnode1
-q nqn
.2016-06.io.spdk
:host1
-a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
77 waitforserial
"$NVMF_SERIAL"
78 nvme disconnect
-n nqn
.2016-06.io.spdk
:cnode1
80 $rpc_py nvmf_delete_subsystem nqn
.2016-06.io.spdk
:cnode1
82 # do frequent add delete of namespaces with different nsid.
83 for i
in $
(seq 1 $times); do
84 $rpc_py nvmf_create_subsystem nqn
.2016-06.io.spdk
:cnode1
-s $NVMF_SERIAL
85 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode1
-t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
86 $rpc_py nvmf_subsystem_add_ns nqn
.2016-06.io.spdk
:cnode1 Malloc1
-n 5
87 $rpc_py nvmf_subsystem_allow_any_host nqn
.2016-06.io.spdk
:cnode1
88 nvme connect
-t $TEST_TRANSPORT -n nqn
.2016-06.io.spdk
:cnode1
-a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
90 waitforserial
"$NVMF_SERIAL"
92 nvme disconnect
-n nqn
.2016-06.io.spdk
:cnode1
94 $rpc_py nvmf_subsystem_remove_ns nqn
.2016-06.io.spdk
:cnode1
5
95 $rpc_py nvmf_delete_subsystem nqn
.2016-06.io.spdk
:cnode1
99 # do frequent add delete.
100 for i
in $
(seq 1 $times); do
101 $rpc_py nvmf_create_subsystem nqn
.2016-06.io.spdk
:cnode1
-s $NVMF_SERIAL
102 $rpc_py nvmf_subsystem_add_listener nqn
.2016-06.io.spdk
:cnode1
-t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
103 $rpc_py nvmf_subsystem_add_ns nqn
.2016-06.io.spdk
:cnode1 Malloc1
104 $rpc_py nvmf_subsystem_allow_any_host nqn
.2016-06.io.spdk
:cnode1
106 $rpc_py nvmf_subsystem_remove_ns nqn
.2016-06.io.spdk
:cnode1
1
108 $rpc_py nvmf_delete_subsystem nqn
.2016-06.io.spdk
:cnode1
111 stats
=$
($rpc_py nvmf_get_stats
)
112 # Expect some admin and IO qpairs
113 [ "0" -lt $
(jsum .poll_groups
[].admin_qpairs
<<< "$stats") ]
114 [ "0" -lt $
(jsum .poll_groups
[].io_qpairs
<<< "$stats") ]
115 # Transport statistics is currently implemented for RDMA only
116 if [ 'rdma' == $TEST_TRANSPORT ]; then
117 # Expect non-zero completions and request latencies accumulated
118 [ "0" -lt $
(jsum .poll_groups
[].transports
[].devices
[].completions
<<< "$stats") ]
119 [ "0" -lt $
(jsum .poll_groups
[].transports
[].devices
[].request_latency
<<< "$stats") ]
122 trap - SIGINT SIGTERM EXIT