From: Daniel Wagner <dwagner@suse.de>
To: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Cc: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org,
Chaitanya Kulkarni <chaitanyak@nvidia.com>,
Hannes Reinecke <hare@suse.de>, Daniel Wagner <dwagner@suse.de>
Subject: [RFC blktests v1 09/10] nvme/rc: introduce remote target support
Date: Mon, 18 Mar 2024 10:38:55 +0100 [thread overview]
Message-ID: <20240318093856.22307-11-dwagner@suse.de> (raw)
In-Reply-To: <20240318093856.22307-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, extend
this part with 'nvme_target_control' which is expected to be script
which setups the remote target accordingly.
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
tests/nvme/rc | 49 ++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 2e9a0860c0e7..35eb4cc5e954 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_traddr:-}"
def_adrfam="ipv4"
-def_trsvcid="4420"
+def_trsvcid="${nvme_trsvcid:-4420}"
def_remote_wwnn="0x10001100aa000001"
def_remote_wwpn="0x20001100aa000001"
def_local_wwnn="0x10001100aa000002"
@@ -19,6 +20,7 @@ def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}"
export def_subsysnqn="blktests-subsystem-1"
export def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e"
nvme_trtype=${nvme_trtype:-"loop"}
+nvme_target_control="${nvme_target_control:-}"
nvme_img_size=${nvme_img_size:-"1G"}
nvme_num_iter=${nvme_num_iter:-"1000"}
@@ -325,6 +327,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}"
@@ -369,11 +375,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)
@@ -391,6 +405,7 @@ _setup_nvmet() {
fi
done
fi
+
if [[ "${nvme_trtype}" = "fc" ]]; then
modprobe -q nvme-fcloop
_setup_fcloop "${def_local_wwnn}" "${def_local_wwpn}" \
@@ -819,12 +834,13 @@ _find_nvme_passthru_loop_dev() {
}
_nvmet_target_setup() {
+ local subsys_uuid="${def_subsys_uuid}"
+ local subsysnqn="${def_subsysnqn}"
local blkdev_type="device"
- 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
@@ -856,6 +872,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)")"
@@ -890,6 +922,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 "${def_subsysnqn}" ports
for port in "${ports[@]}"; do
--
2.44.0
next prev parent reply other threads:[~2024-03-18 9:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 9:38 [RFC blktests v1 00/10] Add support to run against real target Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 01/10] common/xfs: propagate errors from _xfs_run_fio_verify_io Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 02/10] nvme/{012,013,035}: check return value of _xfs_run_fio_verify_io Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 03/10] nvme/rc: use long command line option for nvme Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 04/10] nvme/{014,015,018,019,020,023,024,026,045,046}: " Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 05/10] nvme/rc: connect subsys only support long options Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 06/10] nvme/rc: remove unused connect options Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 06/10] nvme/rc: Remove " Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 07/10] nvme/rc: add nqn/uuid args to target setup/cleanup helper Daniel Wagner
2024-03-18 9:38 ` [RFC blktests v1 08/10] nvme/031: do not open code target setup/cleanup Daniel Wagner
2024-03-18 9:38 ` Daniel Wagner [this message]
2024-03-18 9:38 ` [RFC blktests v1 10/10] nvme/030: only run against kernel soft target Daniel Wagner
2024-03-18 11:21 ` [RFC blktests v1 00/10] Add support to run against real target Daniel Wagner
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=20240318093856.22307-11-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