Skip to content

Commit ec8f147

Browse files
igawkawasaki
authored andcommitted
nvme/061: add test teardown and setup fabrics target during I/O
Add a new test case which forcefully removes the target and setup it again. Reviewed-by: Chaitanya Kulkarni <[email protected]> Signed-off-by: Daniel Wagner <[email protected]> [Shin'ichiro: added a local value declaration] Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 93b766f commit ec8f147

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

tests/nvme/061

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0+
3+
# Copyright (C) 2025 Daniel Wagner, SUSE Labs
4+
#
5+
# Test if the host keeps running IO when the target is forcefully removed and
6+
# added back.
7+
8+
. tests/nvme/rc
9+
10+
DESCRIPTION="test fabric target teardown and setup during I/O"
11+
TIMED=1
12+
13+
requires() {
14+
_nvme_requires
15+
_have_loop
16+
_have_fio
17+
_require_nvme_trtype tcp rdma fc
18+
}
19+
20+
set_conditions() {
21+
_set_nvme_trtype "$@"
22+
}
23+
24+
test() {
25+
echo "Running ${TEST_NAME}"
26+
27+
_setup_nvmet
28+
29+
local ns fio_pid
30+
31+
_nvmet_target_setup
32+
33+
_nvme_connect_subsys --keep-alive-tmo 1 --reconnect-delay 1
34+
35+
ns=$(_find_nvme_ns "${def_subsys_uuid}")
36+
37+
_run_fio_rand_io --filename="/dev/${ns}" \
38+
--group_reporting \
39+
--time_based --runtime=1d &> /dev/null &
40+
fio_pid=$!
41+
sleep 1
42+
43+
nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
44+
state_file="/sys/class/nvme-fabrics/ctl/${nvmedev}/state"
45+
for ((i = 0; i <= 5; i++)); do
46+
echo "iteration $i"
47+
48+
_nvmet_target_cleanup
49+
50+
_nvmf_wait_for_state "${def_subsysnqn}" "connecting" || return 1
51+
echo "state: $(cat "${state_file}")"
52+
53+
_nvmet_target_setup
54+
55+
_nvmf_wait_for_state "${def_subsysnqn}" "live" || return 1
56+
echo "state: $(cat "${state_file}")"
57+
done
58+
59+
{ kill "${fio_pid}"; wait; } &> /dev/null
60+
61+
_nvme_disconnect_subsys
62+
63+
_nvmet_target_cleanup
64+
65+
echo "Test complete"
66+
}

tests/nvme/061.out

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Running nvme/061
2+
iteration 0
3+
state: connecting
4+
state: live
5+
iteration 1
6+
state: connecting
7+
state: live
8+
iteration 2
9+
state: connecting
10+
state: live
11+
iteration 3
12+
state: connecting
13+
state: live
14+
iteration 4
15+
state: connecting
16+
state: live
17+
iteration 5
18+
state: connecting
19+
state: live
20+
disconnected 1 controller(s)
21+
Test complete

0 commit comments

Comments
 (0)