Skip to content

Commit 3063603

Browse files
rootkawasaki
authored andcommitted
nvme: Add test for sending admin commands over disabled paths
ANA states only apply to commands to individual namespaces, not to commands for the controller. So add a testcase to check if we can send admin commands over inaccessible paths. Linke: linux-blktests#178 Signed-off-by: Hannes Reinecke <[email protected]> [Shin'ichiro: renumbered test case and aligned file mode] [Shin'ichiro: modified to check only exit codes of nvme commands] Signed-off-by: Shin'ichiro Kawasaki <[email protected]>
1 parent 7baa454 commit 3063603

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

tests/nvme/068

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/bin/bash
2+
# SPDX-License-Identifier: GPL-3.0+
3+
# Copyright (C) 2025 Hannes Reinecke (SUSE) <[email protected]>
4+
#
5+
# Test admin commands over ANA inaccessible paths.
6+
7+
. tests/nvme/rc
8+
9+
DESCRIPTION="test admin commands on disabled paths"
10+
11+
requires() {
12+
_nvme_requires
13+
_have_loop
14+
_require_nvme_trtype_is_fabrics
15+
}
16+
17+
set_conditions() {
18+
_set_nvme_trtype "$@"
19+
}
20+
21+
test() {
22+
local -a ports
23+
local port
24+
local ns
25+
26+
echo "Running ${TEST_NAME}"
27+
28+
_setup_nvmet
29+
30+
_nvmet_target_setup
31+
32+
_nvme_connect_subsys
33+
34+
ns=$(_find_nvme_ns "${def_subsys_uuid}")
35+
[ -z "${ns}" ] && return 1
36+
nvme nvm-id-ctrl "/dev/${ns}" >> "$FULL"
37+
nvme nvm-id-ns "/dev/${ns}" >> "$FULL"
38+
39+
# switch to ANA inaccessible
40+
_get_nvmet_ports "${def_subsysnqn}" ports
41+
for port in $ports; do
42+
_setup_nvmet_port_ana "${port}" 1 "inaccessible"
43+
done
44+
45+
if nvme nvm-id-ctrl "/dev/${ns}" >> "$FULL" 2>&1; then
46+
echo "unexpected 'nvme nvm-id-ctrl' succeess"
47+
else
48+
echo "expected 'nvme nvm-id-ctrl' failure"
49+
fi
50+
if nvme nvm-id-ns "/dev/${ns}" >> "$FULL" 2>&1; then
51+
echo "unexpected 'nvme nvm-id-ns' succeess"
52+
else
53+
echo "expected 'nvme nvm-id-ns' failure"
54+
fi
55+
56+
_nvme_disconnect_subsys
57+
_nvmet_target_cleanup
58+
59+
echo "Test complete"
60+
}

tests/nvme/068.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Running nvme/068
2+
expected 'nvme nvm-id-ctrl' failure
3+
expected 'nvme nvm-id-ns' failure
4+
disconnected 1 controller(s)
5+
Test complete

0 commit comments

Comments
 (0)