-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test/nvme: add test for basic ANA support
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 <[email protected]>
- Loading branch information
Showing
2 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
#!/bin/bash | ||
# SPDX-License-Identifier: GPL-3.0+ | ||
# Copyright (C) 2024 Hannes Reinecke (SUSE) <[email protected]> | ||
# | ||
# 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() { | ||
echo "Running ${TEST_NAME}" | ||
|
||
_setup_nvmet | ||
|
||
local subsysnqn="${def_subsysnqn}" | ||
local nvmedev | ||
local fio_pid | ||
local ns | ||
local ports | ||
local ctrls | ||
|
||
_nvmet_target_setup --ports 4 | ||
|
||
_get_nvmet_ports "${subsysnqn}" ports | ||
failback "${ports[@]}" | ||
|
||
_nvme_connect_subsys | ||
|
||
# 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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Running nvme/054 | ||
ANA failover | ||
ANA failback | ||
disconnected 4 controller(s) | ||
Test complete |