* [PATCH blktests 0/7] nvme: add test cases for ANA support
@ 2024-11-29 13:26 Shin'ichiro Kawasaki
2024-11-29 13:26 ` [PATCH blktests 1/7] nvme/031: open-code helper functions Shin'ichiro Kawasaki
` (7 more replies)
0 siblings, 8 replies; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
Hannes reworked the nvme test group scripts to support ANA, or Asymmetric
Namespace Access. This work is tracked with GitHub PR 146 [1]. The amount of
change is large, then I split them into a few series for easier review. This is
the last series, which follows the second series [2] and a follow-up fix [3].
The first 6 patches in this series prepare for the new test case addition. The
7th patch add the test case for basic ANA support. The last patch add the other
test case for rapid namespace remapping.
[1] https://github.com/osandov/blktests/pull/146
[2] https://lore.kernel.org/linux-nvme/20241107111354.80606-1-shinichiro.kawasaki@wdc.com/
[3] https://lore.kernel.org/linux-nvme/20241120102051.247995-1-shinichiro.kawasaki@wdc.com/
Hannes Reinecke (7):
nvme/031: open-code helper functions
nvme: add _setup_nvmet_port_ana()
nvme: add _setup_nvmet_ns_ana()
nvme/rc: add argument '--ports' to _nvmet_target_setup()
nvme: delete all ana_groups when removing a port
test/nvme: add test for basic ANA support
test/nvme: add test for rapid namespace remapping
common/nvme | 55 ++++++++++++++++++++++--
tests/nvme/031 | 14 +++---
tests/nvme/055 | 97 +++++++++++++++++++++++++++++++++++++++++
tests/nvme/055.out | 5 +++
tests/nvme/056 | 105 +++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/056.out | 14 ++++++
tests/nvme/rc | 31 +++++++++++++
7 files changed, 312 insertions(+), 9 deletions(-)
create mode 100755 tests/nvme/055
create mode 100644 tests/nvme/055.out
create mode 100755 tests/nvme/056
create mode 100644 tests/nvme/056.out
--
2.47.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH blktests 1/7] nvme/031: open-code helper functions
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 4:55 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 2/7] nvme: add _setup_nvmet_port_ana() Shin'ichiro Kawasaki
` (6 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
The default helper functions are doing quite some things which are unneccesary for
this test, so open-code them to call just the required functions.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/nvme/031 | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tests/nvme/031 b/tests/nvme/031
index cd69e8e..3333338 100755
--- a/tests/nvme/031
+++ b/tests/nvme/031
@@ -44,14 +44,18 @@ test() {
port="$(_create_nvmet_port)"
for ((i = 0; i < iterations; i++)); do
- _nvmet_target_setup --subsysnqn "${subsys}$i" \
+ subsysnqn=$(printf "blktests-subsystem-%d" "$i")
+ _create_nvmet_subsystem --subsysnqn "${subsysnqn}" \
--blkdev "${loop_dev}"
+ _add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
+ _create_nvmet_host "${subsysnqn}" "${def_hostnqn}"
- _nvme_connect_subsys --subsysnqn "${subsys}$i"
- _nvme_disconnect_subsys --subsysnqn "${subsys}$i" >> "${FULL}" 2>&1
+ _nvme_connect_subsys --subsysnqn "${subsysnqn}"
+ _nvme_disconnect_subsys --subsysnqn "${subsysnqn}" >> "${FULL}" 2>&1
- _nvmet_target_cleanup --subsysnqn "${subsys}$i" \
- --blkdev "${loop_dev}"
+ _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}"
+ _remove_nvmet_subsystem "${subsysnqn}"
+ _remove_nvmet_host "${def_hostnqn}"
done
_remove_nvmet_port "${port}"
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH blktests 2/7] nvme: add _setup_nvmet_port_ana()
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
2024-11-29 13:26 ` [PATCH blktests 1/7] nvme/031: open-code helper functions Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 4:56 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 3/7] nvme: add _setup_nvmet_ns_ana() Shin'ichiro Kawasaki
` (5 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
Add a function to set the ANA state and group id for a port.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/nvme | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/common/nvme b/common/nvme
index fd472fe..e11776b 100644
--- a/common/nvme
+++ b/common/nvme
@@ -8,6 +8,8 @@
def_traddr="127.0.0.1"
def_adrfam="ipv4"
def_trsvcid="4420"
+def_anagrpid="1"
+def_anastate="optimized"
def_remote_wwnn="0x10001100ab000001"
def_remote_wwpn="0x20001100ab000001"
def_local_wwnn="0x10001100aa000001"
@@ -470,6 +472,23 @@ _create_nvmet_port() {
echo "${port}"
}
+_setup_nvmet_port_ana() {
+ local port="$1"
+ local anagrpid="${2:-$def_anagrpid}"
+ local anastate="${3:-$def_anastate}"
+ local cfsport="${NVMET_CFS}/ports/${port}"
+ local anaport="${cfsport}/ana_groups/${anagrpid}"
+
+ if [[ ! -d "${anaport}" ]] ; then
+ if [[ "${anagrpid}" -eq 1 ]]; then
+ echo "FAIL target setup failed, ANA not supported"
+ exit 1
+ fi
+ mkdir "${anaport}"
+ fi
+ echo "${anastate}" > "${anaport}/ana_state"
+}
+
_remove_nvmet_port() {
local port="$1"
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH blktests 3/7] nvme: add _setup_nvmet_ns_ana()
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
2024-11-29 13:26 ` [PATCH blktests 1/7] nvme/031: open-code helper functions Shin'ichiro Kawasaki
2024-11-29 13:26 ` [PATCH blktests 2/7] nvme: add _setup_nvmet_port_ana() Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 4:56 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 4/7] nvme/rc: add argument '--ports' to _nvmet_target_setup() Shin'ichiro Kawasaki
` (4 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
Add a function to set the ANA groupid for a namespace.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/nvme | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/common/nvme b/common/nvme
index e11776b..9786e4e 100644
--- a/common/nvme
+++ b/common/nvme
@@ -564,6 +564,19 @@ _create_nvmet_ns() {
echo "${uuid}"
}
+_setup_nvmet_ns_ana() {
+ local nvmet_subsystem="$1"
+ local nsid="$2"
+ local anagrpid="${3:-def_anagrpid}"
+ local subsys_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
+ local ns_path="${subsys_path}/namespaces/${nsid}"
+
+ if [[ ! -d "${ns_path}" ]]; then
+ return
+ fi
+ echo "${anagrpid}" > "${ns_path}/anagrpid"
+}
+
_create_nvmet_subsystem() {
local subsystem="${def_subsysnqn}"
local blkdev
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH blktests 4/7] nvme/rc: add argument '--ports' to _nvmet_target_setup()
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
` (2 preceding siblings ...)
2024-11-29 13:26 ` [PATCH blktests 3/7] nvme: add _setup_nvmet_ns_ana() Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 4:57 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 5/7] nvme: delete all ana_groups when removing a port Shin'ichiro Kawasaki
` (3 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
Add an argument '--ports' to _nvmet_target_setup() to specify the
number of ports to create.
Signed-off-by: Hannes Reinecke <hare@suse.de>
[Shin'ichiro: rebased on the commit e3fe06e and resolved conflicts]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/nvme | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/common/nvme b/common/nvme
index 9786e4e..dfd9876 100644
--- a/common/nvme
+++ b/common/nvme
@@ -798,7 +798,8 @@ _nvmet_target_setup() {
local hostkey=""
local subsysnqn="${def_subsysnqn}"
local subsys_uuid
- local port
+ local port p
+ local num_ports=1
local -a ARGS
while [[ $# -gt 0 ]]; do
@@ -827,6 +828,10 @@ _nvmet_target_setup() {
resv_enable="--resv_enable"
shift 1
;;
+ --ports)
+ num_ports="$2"
+ shift 2
+ ;;
*)
echo "WARNING: unknown argument: $1"
shift
@@ -855,8 +860,12 @@ _nvmet_target_setup() {
fi
_create_nvmet_subsystem "${ARGS[@]}"
- port="$(_create_nvmet_port)"
- _add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
+ p=0
+ while (( p < num_ports )); do
+ port="$(_create_nvmet_port)"
+ _add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
+ p=$(( p + 1 ))
+ done
_create_nvmet_host "${subsysnqn}" "${def_hostnqn}" \
"${hostkey}" "${ctrlkey}"
}
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH blktests 5/7] nvme: delete all ana_groups when removing a port
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
` (3 preceding siblings ...)
2024-11-29 13:26 ` [PATCH blktests 4/7] nvme/rc: add argument '--ports' to _nvmet_target_setup() Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 4:58 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 6/7] test/nvme: add test for basic ANA support Shin'ichiro Kawasaki
` (2 subsequent siblings)
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
A port might have several ANA groups, and we have to remove all
ANA groups with a group id other than 1, otherwise we cannot
remove the port itself.
Signed-off-by: Hannes Reinecke <hare@suse.de>
[Shin'ichiro: fixed shellcheck warning]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
common/nvme | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/common/nvme b/common/nvme
index dfd9876..8bce403 100644
--- a/common/nvme
+++ b/common/nvme
@@ -491,6 +491,8 @@ _setup_nvmet_port_ana() {
_remove_nvmet_port() {
local port="$1"
+ local cfsport="${NVMET_CFS}/ports/${port}"
+ local a
if [[ "${nvme_trtype}" == "fc" ]]; then
_nvme_fcloop_del_tport "$(_remote_wwnn "$port")" \
@@ -499,7 +501,11 @@ _remove_nvmet_port() {
"$(_remote_wwnn "$port")" \
"$(_remote_wwpn "$port")"
fi
- rmdir "${NVMET_CFS}/ports/${port}"
+ for a in "${cfsport}/ana_groups/"*; do
+ [[ "${a##*/}" == "1" ]] && continue
+ rmdir "${a}"
+ done
+ rmdir "${cfsport}"
}
_create_nvmet_ns() {
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH blktests 6/7] test/nvme: add test for basic ANA support
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
` (4 preceding siblings ...)
2024-11-29 13:26 ` [PATCH blktests 5/7] nvme: delete all ana_groups when removing a port Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 4:59 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 7/7] test/nvme: add test for rapid namespace remapping Shin'ichiro Kawasaki
2024-12-11 8:35 ` [PATCH blktests 0/7] nvme: add test cases for ANA support Shinichiro Kawasaki
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
Add a test for basic ANA support by creating 4 paths, run a fio
process to generate load, and then switch port states to check
if I/O continues uninterrupted.
Signed-off-by: Hannes Reinecke <hare@suse.de>
[Shin'ichiro: renumbered the test case from 054 to 055]
[Shin'ichiro: fixed a fio option typo]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/nvme/055 | 97 ++++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/055.out | 5 +++
2 files changed, 102 insertions(+)
create mode 100755 tests/nvme/055
create mode 100644 tests/nvme/055.out
diff --git a/tests/nvme/055 b/tests/nvme/055
new file mode 100755
index 0000000..525193c
--- /dev/null
+++ b/tests/nvme/055
@@ -0,0 +1,97 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Hannes Reinecke (SUSE) <hare@suse.de>
+#
+# Test nvme fabrics controller ANA failover during I/O
+
+. tests/nvme/rc
+
+DESCRIPTION="test nvme fabrics controller ANA failover during I/O"
+
+requires() {
+ _nvme_requires
+ _have_loop
+ _have_fio
+ _require_nvme_trtype_is_fabrics
+}
+
+set_conditions() {
+ _set_nvme_trtype "$@"
+}
+
+failback() {
+ local portno=0
+
+ for port in "$@"; do
+ if (( portno == 0 )); then
+ _setup_nvmet_port_ana "${port}" 1 "optimized"
+ elif (( portno == 1 )); then
+ _setup_nvmet_port_ana "${port}" 1 "non-optimized"
+ else
+ _setup_nvmet_port_ana "${port}" 1 "inaccessible"
+ fi
+ portno=$(( portno + 1 ))
+ done
+}
+
+failover() {
+ local portno=0
+
+ for port in "$@"; do
+ if (( portno == 2 )); then
+ _setup_nvmet_port_ana "${port}" 1 "optimized"
+ elif (( portno == 3 )); then
+ _setup_nvmet_port_ana "${port}" 1 "non-optimized"
+ else
+ _setup_nvmet_port_ana "${port}" 1 "inaccessible"
+ fi
+ portno=$(( portno + 1))
+ done
+}
+
+test() {
+ local fio_pid
+ local -a ports
+ local port
+ local ns
+
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
+ _nvmet_target_setup --ports 4
+
+ _get_nvmet_ports "${def_subsysnqn}" ports
+ failback "${ports[@]}"
+
+ for port in "${ports[@]}"; do
+ _nvme_connect_subsys --port "${port}"
+ done
+
+ # start fio job
+ ns=$(_find_nvme_ns "$def_subsys_uuid")
+ _run_fio_verify_io --filename="/dev/${ns}" \
+ --group_reporting --ramp_time=5 \
+ --time_based --runtime=1m &> "$FULL" &
+ fio_pid=$!
+ sleep 5
+
+ # switch port status
+ echo "ANA failover"
+ failover "${ports[@]}"
+
+ sleep 10
+
+ # switch back to original state
+ echo "ANA failback"
+ failback "${ports[@]}"
+
+ sleep 10
+
+ { kill "${fio_pid}"; wait; } &> /dev/null
+
+ _nvme_disconnect_subsys
+ _nvmet_target_cleanup
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/055.out b/tests/nvme/055.out
new file mode 100644
index 0000000..9937d40
--- /dev/null
+++ b/tests/nvme/055.out
@@ -0,0 +1,5 @@
+Running nvme/055
+ANA failover
+ANA failback
+disconnected 4 controller(s)
+Test complete
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH blktests 7/7] test/nvme: add test for rapid namespace remapping
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
` (5 preceding siblings ...)
2024-11-29 13:26 ` [PATCH blktests 6/7] test/nvme: add test for basic ANA support Shin'ichiro Kawasaki
@ 2024-11-29 13:26 ` Shin'ichiro Kawasaki
2024-12-03 5:00 ` Chaitanya Kulkarni
2024-12-11 8:35 ` [PATCH blktests 0/7] nvme: add test cases for ANA support Shinichiro Kawasaki
7 siblings, 1 reply; 16+ messages in thread
From: Shin'ichiro Kawasaki @ 2024-11-29 13:26 UTC (permalink / raw)
To: linux-nvme; +Cc: Hannes Reinecke, Shin'ichiro Kawasaki
From: Hannes Reinecke <hare@suse.de>
Add a test for rapid namespace remapping to simulate short-lived
namespaces being created and deleted in rapid succession with a
cluster.
Signed-off-by: Hannes Reinecke <hare@suse.de>
[Shin'ichiro: renumbered the test case from 055 to 056]
[Shin'ichiro: use for loop instead of seq per style guideline]
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
---
tests/nvme/056 | 105 +++++++++++++++++++++++++++++++++++++++++++++
tests/nvme/056.out | 14 ++++++
tests/nvme/rc | 31 +++++++++++++
3 files changed, 150 insertions(+)
create mode 100755 tests/nvme/056
create mode 100644 tests/nvme/056.out
diff --git a/tests/nvme/056 b/tests/nvme/056
new file mode 100755
index 0000000..d230a21
--- /dev/null
+++ b/tests/nvme/056
@@ -0,0 +1,105 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Hannes Reinecke (SUSE) <hare@suse.de>
+#
+# Test rapid remapping of namespaces
+
+. tests/nvme/rc
+
+DESCRIPTION="test rapid namespace remapping"
+
+requires() {
+ _nvme_requires
+ _have_loop
+ _require_nvme_trtype_is_fabrics
+}
+
+set_conditions() {
+ _set_nvme_trtype "$@"
+}
+
+_setup_ana() {
+ local portno=0
+
+ for port in "$@"; do
+ if (( portno == 0 )); then
+ _setup_nvmet_port_ana "${port}" 1 "optimized"
+ _setup_nvmet_port_ana "${port}" 2 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 3 "inaccessible"
+ elif (( portno == 1 )); then
+ _setup_nvmet_port_ana "${port}" 1 "non-optimized"
+ _setup_nvmet_port_ana "${port}" 2 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 3 "inaccessible"
+ elif (( portno == 2 )); then
+ _setup_nvmet_port_ana "${port}" 1 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 2 "optimized"
+ _setup_nvmet_port_ana "${port}" 3 "inaccessible"
+ elif (( portno == 3 )); then
+ _setup_nvmet_port_ana "${port}" 1 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 2 "non-optimized"
+ _setup_nvmet_port_ana "${port}" 3 "inaccessible"
+ elif (( portno == 4 )); then
+ _setup_nvmet_port_ana "${port}" 1 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 2 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 3 "optimized"
+ else
+ _setup_nvmet_port_ana "${port}" 1 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 2 "inaccessible"
+ _setup_nvmet_port_ana "${port}" 3 "non-optimized"
+ fi
+ portno=$(( portno + 1 ))
+ done
+}
+
+test() {
+ echo "Running ${TEST_NAME}"
+
+ _setup_nvmet
+
+ local d i n port
+ local -a ports
+ local num_namespaces=3
+
+ _nvmet_target_setup --ports 6 --blkdev none
+
+ for ((d = 1; d <= num_namespaces; d++)); do
+ local file_path
+ local blkdev
+ local uuid
+
+ file_path="${TMPDIR}/img${d}"
+ truncate -s "${NVME_IMG_SIZE}" "${file_path}"
+ blkdev="$(losetup -f --show "${file_path}")"
+ uuid="$(uuidgen)"
+ _create_nvmet_ns --nsid "${d}" --blkdev "${blkdev}" \
+ --uuid "${uuid}" --grpid "${d}" > /dev/null
+ done
+
+ _get_nvmet_ports "${def_subsysnqn}" ports
+ _setup_ana "${ports[@]}"
+
+ for port in "${ports[@]}"; do
+ _nvme_connect_subsys --port "${port}"
+ done
+
+ # Simulate unmap on one cluster node and remap to anther one
+ for ((i = 0; i <= 10; i++)); do
+ echo "Remap namespace #${i}"
+ grpid=$(( (i % 3) + 1 ))
+ for n in $(seq 1 "${num_namespaces}" | shuf); do
+ _disable_nvmet_ns "${n}"
+ done
+ for n in $(seq 1 "${num_namespaces}" | shuf); do
+ local uuid
+
+ uuid=$(uuidgen)
+ _set_nvmet_ns_uuid "${n}" "${uuid}"
+ _enable_nvmet_ns "${n}"
+ done
+ done
+
+ _nvme_disconnect_subsys
+ _nvmet_target_cleanup
+
+ echo "Test complete"
+}
diff --git a/tests/nvme/056.out b/tests/nvme/056.out
new file mode 100644
index 0000000..cdc3e55
--- /dev/null
+++ b/tests/nvme/056.out
@@ -0,0 +1,14 @@
+Running nvme/056
+Remap namespace #0
+Remap namespace #1
+Remap namespace #2
+Remap namespace #3
+Remap namespace #4
+Remap namespace #5
+Remap namespace #6
+Remap namespace #7
+Remap namespace #8
+Remap namespace #9
+Remap namespace #10
+disconnected 6 controller(s)
+Test complete
diff --git a/tests/nvme/rc b/tests/nvme/rc
index d63afd1..2ddc6bc 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -307,6 +307,37 @@ _set_nvmet_dhgroup() {
"${cfs_path}/dhchap_dhgroup"
}
+_enable_nvmet_ns() {
+ local subsysnqn="${def_subsysnqn}"
+ local nsid="${1:-1}"
+
+ cfs_path="${NVMET_CFS}/subsystems/${subsysnqn}"
+ ns_path="${cfs_path}/namespaces/${nsid}"
+
+ echo 1 > "${ns_path}/enable"
+}
+
+_disable_nvmet_ns() {
+ local subsysnqn="${def_subsysnqn}"
+ local nsid="${1:-1}"
+
+ cfs_path="${NVMET_CFS}/subsystems/${subsysnqn}"
+ ns_path="${cfs_path}/namespaces/${nsid}"
+
+ echo 0 > "${ns_path}/enable"
+}
+
+_set_nvmet_ns_uuid() {
+ local subsysnqn="${def_subsysnqn}"
+ local nsid="${1:-1}"
+ local uuid="${2:-$(uuidgen)}"
+
+ cfs_path="${NVMET_CFS}/subsystems/${subsysnqn}"
+ ns_path="${cfs_path}/namespaces/${nsid}"
+
+ printf "%s" "${uuid}" > "${ns_path}/device_uuid"
+}
+
_find_nvme_passthru_loop_dev() {
local subsys=$1
local nsid
--
2.47.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 1/7] nvme/031: open-code helper functions
2024-11-29 13:26 ` [PATCH blktests 1/7] nvme/031: open-code helper functions Shin'ichiro Kawasaki
@ 2024-12-03 4:55 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 4:55 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> The default helper functions are doing quite some things which are unneccesary for
> this test, so open-code them to call just the required functions.
>
> Signed-off-by: Hannes Reinecke<hare@suse.de>
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 2/7] nvme: add _setup_nvmet_port_ana()
2024-11-29 13:26 ` [PATCH blktests 2/7] nvme: add _setup_nvmet_port_ana() Shin'ichiro Kawasaki
@ 2024-12-03 4:56 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 4:56 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> From: Hannes Reinecke<hare@suse.de>
>
> Add a function to set the ANA state and group id for a port.
>
> Signed-off-by: Hannes Reinecke<hare@suse.de>
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 3/7] nvme: add _setup_nvmet_ns_ana()
2024-11-29 13:26 ` [PATCH blktests 3/7] nvme: add _setup_nvmet_ns_ana() Shin'ichiro Kawasaki
@ 2024-12-03 4:56 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 4:56 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> From: Hannes Reinecke<hare@suse.de>
>
> Add a function to set the ANA groupid for a namespace.
>
> Signed-off-by: Hannes Reinecke<hare@suse.de>
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 4/7] nvme/rc: add argument '--ports' to _nvmet_target_setup()
2024-11-29 13:26 ` [PATCH blktests 4/7] nvme/rc: add argument '--ports' to _nvmet_target_setup() Shin'ichiro Kawasaki
@ 2024-12-03 4:57 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 4:57 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> From: Hannes Reinecke<hare@suse.de>
>
> Add an argument '--ports' to _nvmet_target_setup() to specify the
> number of ports to create.
>
> Signed-off-by: Hannes Reinecke<hare@suse.de>
> [Shin'ichiro: rebased on the commit e3fe06e and resolved conflicts]
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 5/7] nvme: delete all ana_groups when removing a port
2024-11-29 13:26 ` [PATCH blktests 5/7] nvme: delete all ana_groups when removing a port Shin'ichiro Kawasaki
@ 2024-12-03 4:58 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 4:58 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> From: Hannes Reinecke <hare@suse.de>
>
> A port might have several ANA groups, and we have to remove all
> ANA groups with a group id other than 1, otherwise we cannot
> remove the port itself.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> [Shin'ichiro: fixed shellcheck warning]
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
instead of local variable a it could be something meaningful ..
irrespective of that :-
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
> ---
> common/nvme | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/common/nvme b/common/nvme
> index dfd9876..8bce403 100644
> --- a/common/nvme
> +++ b/common/nvme
> @@ -491,6 +491,8 @@ _setup_nvmet_port_ana() {
>
> _remove_nvmet_port() {
> local port="$1"
> + local cfsport="${NVMET_CFS}/ports/${port}"
> + local a
>
> if [[ "${nvme_trtype}" == "fc" ]]; then
> _nvme_fcloop_del_tport "$(_remote_wwnn "$port")" \
> @@ -499,7 +501,11 @@ _remove_nvmet_port() {
> "$(_remote_wwnn "$port")" \
> "$(_remote_wwpn "$port")"
> fi
> - rmdir "${NVMET_CFS}/ports/${port}"
> + for a in "${cfsport}/ana_groups/"*; do
> + [[ "${a##*/}" == "1" ]] && continue
> + rmdir "${a}"
> + done
> + rmdir "${cfsport}"
> }
>
> _create_nvmet_ns() {
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 6/7] test/nvme: add test for basic ANA support
2024-11-29 13:26 ` [PATCH blktests 6/7] test/nvme: add test for basic ANA support Shin'ichiro Kawasaki
@ 2024-12-03 4:59 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 4:59 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> From: Hannes Reinecke<hare@suse.de>
>
> Add a test for basic ANA support by creating 4 paths, run a fio
> process to generate load, and then switch port states to check
> if I/O continues uninterrupted.
>
> Signed-off-by: Hannes Reinecke<hare@suse.de>
> [Shin'ichiro: renumbered the test case from 054 to 055]
> [Shin'ichiro: fixed a fio option typo]
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 7/7] test/nvme: add test for rapid namespace remapping
2024-11-29 13:26 ` [PATCH blktests 7/7] test/nvme: add test for rapid namespace remapping Shin'ichiro Kawasaki
@ 2024-12-03 5:00 ` Chaitanya Kulkarni
0 siblings, 0 replies; 16+ messages in thread
From: Chaitanya Kulkarni @ 2024-12-03 5:00 UTC (permalink / raw)
To: Shin'ichiro Kawasaki, linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On 11/29/24 05:26, Shin'ichiro Kawasaki wrote:
> From: Hannes Reinecke<hare@suse.de>
>
> Add a test for rapid namespace remapping to simulate short-lived
> namespaces being created and deleted in rapid succession with a
> cluster.
>
> Signed-off-by: Hannes Reinecke<hare@suse.de>
> [Shin'ichiro: renumbered the test case from 055 to 056]
> [Shin'ichiro: use for loop instead of seq per style guideline]
> Signed-off-by: Shin'ichiro Kawasaki<shinichiro.kawasaki@wdc.com>
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH blktests 0/7] nvme: add test cases for ANA support
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
` (6 preceding siblings ...)
2024-11-29 13:26 ` [PATCH blktests 7/7] test/nvme: add test for rapid namespace remapping Shin'ichiro Kawasaki
@ 2024-12-11 8:35 ` Shinichiro Kawasaki
7 siblings, 0 replies; 16+ messages in thread
From: Shinichiro Kawasaki @ 2024-12-11 8:35 UTC (permalink / raw)
To: linux-nvme@lists.infradead.org; +Cc: Hannes Reinecke
On Nov 29, 2024 / 22:26, Shin'ichiro Kawasaki wrote:
> Hannes reworked the nvme test group scripts to support ANA, or Asymmetric
> Namespace Access. This work is tracked with GitHub PR 146 [1]. The amount of
> change is large, then I split them into a few series for easier review. This is
> the last series, which follows the second series [2] and a follow-up fix [3].
>
> The first 6 patches in this series prepare for the new test case addition. The
> 7th patch add the test case for basic ANA support. The last patch add the other
> test case for rapid namespace remapping.
>
> [1] https://github.com/osandov/blktests/pull/146
> [2] https://lore.kernel.org/linux-nvme/20241107111354.80606-1-shinichiro.kawasaki@wdc.com/
> [3] https://lore.kernel.org/linux-nvme/20241120102051.247995-1-shinichiro.kawasaki@wdc.com/
>
> Hannes Reinecke (7):
> nvme/031: open-code helper functions
> nvme: add _setup_nvmet_port_ana()
> nvme: add _setup_nvmet_ns_ana()
> nvme/rc: add argument '--ports' to _nvmet_target_setup()
> nvme: delete all ana_groups when removing a port
> test/nvme: add test for basic ANA support
> test/nvme: add test for rapid namespace remapping
FYI, I applied the series, except the first patch. Of note is that the two new
test cases are renumbered to nvme/057 and 058. As for the first patch, I
remembered that it needs more work per discussion in the previous series [X]. I
included it again in this series by mistake.
Hannes, thank you for this contribution :)
[X] https://lore.kernel.org/linux-nvme/07ba0b79-1438-4068-a901-18d5713d52f2@suse.de/
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2024-12-11 8:35 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-29 13:26 [PATCH blktests 0/7] nvme: add test cases for ANA support Shin'ichiro Kawasaki
2024-11-29 13:26 ` [PATCH blktests 1/7] nvme/031: open-code helper functions Shin'ichiro Kawasaki
2024-12-03 4:55 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 2/7] nvme: add _setup_nvmet_port_ana() Shin'ichiro Kawasaki
2024-12-03 4:56 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 3/7] nvme: add _setup_nvmet_ns_ana() Shin'ichiro Kawasaki
2024-12-03 4:56 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 4/7] nvme/rc: add argument '--ports' to _nvmet_target_setup() Shin'ichiro Kawasaki
2024-12-03 4:57 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 5/7] nvme: delete all ana_groups when removing a port Shin'ichiro Kawasaki
2024-12-03 4:58 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 6/7] test/nvme: add test for basic ANA support Shin'ichiro Kawasaki
2024-12-03 4:59 ` Chaitanya Kulkarni
2024-11-29 13:26 ` [PATCH blktests 7/7] test/nvme: add test for rapid namespace remapping Shin'ichiro Kawasaki
2024-12-03 5:00 ` Chaitanya Kulkarni
2024-12-11 8:35 ` [PATCH blktests 0/7] nvme: add test cases for ANA support Shinichiro Kawasaki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox