From: Daniel Wagner <dwagner@suse.de>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: Chaitanya Kulkarni <chaitanyak@nvidia.com>,
Hannes Reinecke <hare@suse.de>,
linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
Daniel Wagner <dwagner@suse.de>
Subject: [RFC blktests v2 1/3] nvme/rc: introduce remote target support
Date: Wed, 12 Jun 2024 13:04:42 +0200 [thread overview]
Message-ID: <20240612110444.4507-2-dwagner@suse.de> (raw)
In-Reply-To: <20240612110444.4507-1-dwagner@suse.de>
Most of the NVMEeoF tests are exercising the host code of the nvme
subsystem. There is no real reason not to run these against a real
target. We just have to skip the soft target setup and make it possible
to setup a remote target.
Because all tests use now the common setup/cleanup helpers we just need
to intercept this call and forward it to an external component.
As we already have various nvme variables to setup the target which we
should allow to overwrite. Also introduce a NVME_TARGET_CONTROL variable
which points to a script which gets executed whenever a targets needs to
be created/destroyed.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
Documentation/running-tests.md | 9 +++++++
tests/nvme/rc | 48 +++++++++++++++++++++++++++++++---
2 files changed, 53 insertions(+), 4 deletions(-)
diff --git a/Documentation/running-tests.md b/Documentation/running-tests.md
index 968702e76bb5..99dedaebfab0 100644
--- a/Documentation/running-tests.md
+++ b/Documentation/running-tests.md
@@ -120,6 +120,15 @@ The NVMe tests can be additionally parameterized via environment variables.
- NVME_NUM_ITER: 1000 (default)
The number of iterations a test should do. This parameter had an old name
'nvme_num_iter'. The old name is still usable, but not recommended.
+- NVME_TRADDR: transport address. Overwrites the default
+ transport address. See also NVME_TARGET_CONTROL.
+- NVME_HOST_TRADDR: host address. Overwrites the default
+ host address. See also NVME_TARGET_CONTROL.
+- NVME_TRSVID: transport service id. Overwrite the default
+ transport service ide. See also NVME_TARGET_CONTROL.
+- NVME_TARGET_CONTROL: When defined, the generic target setup/cleanup code will
+ be skipped and this script gets called. This makes it possible to run
+ the fabric nvme tests against a real target.
### Running nvme-rdma and SRP tests
diff --git a/tests/nvme/rc b/tests/nvme/rc
index c1ddf412033b..aaa64453fe16 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -7,9 +7,10 @@
. common/rc
. common/multipath-over-rdma
-def_traddr="127.0.0.1"
+def_traddr="${NVME_TRADDR:-127.0.0.1}"
+def_host_traddr="${NVME_HOST_TRADDDR:-}"
def_adrfam="ipv4"
-def_trsvcid="4420"
+def_trsvcid="${NVME_TRSVID:-4420}"
def_remote_wwnn="0x10001100aa000001"
def_remote_wwpn="0x20001100aa000001"
def_local_wwnn="0x10001100aa000002"
@@ -23,6 +24,7 @@ _check_conflict_and_set_default NVME_IMG_SIZE nvme_img_size 1G
_check_conflict_and_set_default NVME_NUM_ITER nvme_num_iter 1000
nvmet_blkdev_type=${nvmet_blkdev_type:-"device"}
NVMET_BLKDEV_TYPES=${NVMET_BLKDEV_TYPES:-"device file"}
+nvme_target_control="${NVME_TARGET_CONTROL:-}"
_NVMET_TRTYPES_is_valid() {
local type
@@ -359,6 +361,10 @@ _cleanup_nvmet() {
fi
done
+ if [[ -n "${nvme_target_control}" ]]; then
+ return
+ fi
+
for port in "${NVMET_CFS}"/ports/*; do
name=$(basename "${port}")
echo "WARNING: Test did not clean up port: ${name}"
@@ -403,11 +409,19 @@ _cleanup_nvmet() {
_setup_nvmet() {
_register_test_cleanup _cleanup_nvmet
+
+ if [[ -n "${nvme_target_control}" ]]; then
+ return
+ fi
+
modprobe -q nvmet
+
if [[ "${nvme_trtype}" != "loop" ]]; then
modprobe -q nvmet-"${nvme_trtype}"
fi
+
modprobe -q nvme-"${nvme_trtype}"
+
if [[ "${nvme_trtype}" == "rdma" ]]; then
start_soft_rdma
for i in $(rdma_network_interfaces)
@@ -425,6 +439,7 @@ _setup_nvmet() {
fi
done
fi
+
if [[ "${nvme_trtype}" = "fc" ]]; then
modprobe -q nvme-fcloop
_setup_fcloop "${def_local_wwnn}" "${def_local_wwpn}" \
@@ -873,11 +888,13 @@ _find_nvme_passthru_loop_dev() {
_nvmet_target_setup() {
local blkdev_type="${nvmet_blkdev_type}"
+ local subsys_uuid="${def_subsys_uuid}"
+ local subsysnqn="${def_subsysnqn}"
local blkdev
+ local ARGS=()
local ctrlkey=""
local hostkey=""
- local subsysnqn="${def_subsysnqn}"
- local subsys_uuid="${def_subsys_uuid}"
+ local blkdev
local port
while [[ $# -gt 0 ]]; do
@@ -909,6 +926,22 @@ _nvmet_target_setup() {
esac
done
+ if [[ -n "${hostkey}" ]]; then
+ ARGS+=(--hostkey "${hostkey}")
+ fi
+ if [[ -n "${ctrlkey}" ]]; then
+ ARGS+=(--ctrkey "${ctrlkey}")
+ fi
+
+ if [[ -n "${nvme_target_control}" ]]; then
+ eval "${nvme_target_control}" setup \
+ --subsysnqn "${subsysnqn}" \
+ --subsys-uuid "${subsys_uuid}" \
+ --hostnqn "${def_hostnqn}" \
+ "${ARGS[@]}" > /dev/null 2>&1
+ return
+ fi
+
truncate -s "${NVME_IMG_SIZE}" "$(_nvme_def_file_path)"
if [[ "${blkdev_type}" == "device" ]]; then
blkdev="$(losetup -f --show "$(_nvme_def_file_path)")"
@@ -948,6 +981,13 @@ _nvmet_target_cleanup() {
esac
done
+ if [[ -n "${nvme_target_control}" ]]; then
+ eval "${nvme_target_control}" cleanup \
+ --subsysnqn "${subsysnqn}" \
+ > /dev/null
+ return
+ fi
+
_get_nvmet_ports "${subsysnqn}" ports
for port in "${ports[@]}"; do
--
2.45.2
next prev parent reply other threads:[~2024-06-12 11:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-12 11:04 [RFC blktests v2 00/03] Add support to run against real target Daniel Wagner
2024-06-12 11:04 ` Daniel Wagner [this message]
2024-06-14 5:09 ` [RFC blktests v2 1/3] nvme/rc: introduce remote target support Shinichiro Kawasaki
2024-06-12 11:04 ` [RFC blktests v2 2/3] nvme/030: only run against kernel soft target Daniel Wagner
2024-06-14 5:11 ` Shinichiro Kawasaki
2024-06-12 11:04 ` [RFC blktests v2 3/3] contrib: add remote target setup/cleanup script Daniel Wagner
2024-06-12 12:21 ` Daniel Wagner
2024-06-14 5:05 ` [RFC blktests v2 00/03] Add support to run against real target Shinichiro Kawasaki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240612110444.4507-2-dwagner@suse.de \
--to=dwagner@suse.de \
--cc=chaitanyak@nvidia.com \
--cc=hare@suse.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=shinichiro.kawasaki@wdc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox