public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
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 07/10] nvme/rc: add nqn/uuid args to target setup/cleanup helper
Date: Mon, 18 Mar 2024 10:38:53 +0100	[thread overview]
Message-ID: <20240318093856.22307-9-dwagner@suse.de> (raw)
In-Reply-To: <20240318093856.22307-1-dwagner@suse.de>

Make these helper a bit more flexible, so that the caller
can setup not just the default subsysnqn.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/rc | 36 ++++++++++++++++++++++++++++++------
 1 file changed, 30 insertions(+), 6 deletions(-)

diff --git a/tests/nvme/rc b/tests/nvme/rc
index af48593e2cb7..2e9a0860c0e7 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -823,6 +823,8 @@ _nvmet_target_setup() {
 	local blkdev
 	local ctrlkey=""
 	local hostkey=""
+	local subsysnqn="${def_subsysnqn}"
+	local subsys_uuid="${def_subsys_uuid}"
 	local port
 
 	while [[ $# -gt 0 ]]; do
@@ -839,6 +841,14 @@ _nvmet_target_setup() {
 				hostkey="$2"
 				shift 2
 				;;
+			--subsysnqn)
+				subsysnqn="$2"
+				shift 2
+				;;
+			--subsys-uuid)
+				subsys_uuid="$2"
+				shift 2
+				;;
 			*)
 				echo "WARNING: unknown argument: $1"
 				shift
@@ -853,11 +863,11 @@ _nvmet_target_setup() {
 		blkdev="$(_nvme_def_file_path)"
 	fi
 
-	_create_nvmet_subsystem "${def_subsysnqn}" "${blkdev}" \
-				"${def_subsys_uuid}"
+	_create_nvmet_subsystem "${subsysnqn}" "${blkdev}" \
+				"${subsys_uuid}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
-	_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
-	_create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \
+	_add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
+	_create_nvmet_host "${subsysnqn}" "${def_hostnqn}" \
 			"${hostkey}" "${ctrlkey}"
 }
 
@@ -865,14 +875,28 @@ _nvmet_target_cleanup() {
 	local ports
 	local port
 	local blkdev
+	local subsysnqn="${def_subsysnqn}"
+
+	while [[ $# -gt 0 ]]; do
+		case $1 in
+			--subsysnqn)
+				subsysnqn="$2"
+				shift 2
+				;;
+			*)
+				echo "WARNING: unknown argument: $1"
+				shift
+				;;
+		esac
+	done
 
 	_get_nvmet_ports "${def_subsysnqn}" ports
 
 	for port in "${ports[@]}"; do
-		_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
+		_remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}"
 		_remove_nvmet_port "${port}"
 	done
-	_remove_nvmet_subsystem "${def_subsysnqn}"
+	_remove_nvmet_subsystem "${subsysnqn}"
 	_remove_nvmet_host "${def_hostnqn}"
 
 	_cleanup_blkdev
-- 
2.44.0


  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 ` Daniel Wagner [this message]
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 ` [RFC blktests v1 09/10] nvme/rc: introduce remote target support Daniel Wagner
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-9-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