All the mail mirrored from lore.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: [PATCH blktests v3 16/20] nvme: drop default subsysnqn argument from _nvme_passthru_target_{setup|cleanup}
Date: Tue, 26 Mar 2024 14:13:58 +0100	[thread overview]
Message-ID: <20240326131402.5092-17-dwagner@suse.de> (raw)
In-Reply-To: <20240326131402.5092-1-dwagner@suse.de>

Remove the last positional argument for
_nvme_passthrue_target_{setup|cleanup} which most test pass in the
default subsysnqn anyway. There is little point in cluttering all the
test textual noise.

While at it, also use subsysnqn as variable name everywhere, instead of
subsys_name.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 tests/nvme/033 |  4 ++--
 tests/nvme/034 |  4 ++--
 tests/nvme/035 |  4 ++--
 tests/nvme/036 |  4 ++--
 tests/nvme/037 |  5 +++--
 tests/nvme/rc  | 42 ++++++++++++++++++++++++++++++++++--------
 6 files changed, 45 insertions(+), 18 deletions(-)

diff --git a/tests/nvme/033 b/tests/nvme/033
index c0482c808d43..f7d9f04450a8 100755
--- a/tests/nvme/033
+++ b/tests/nvme/033
@@ -51,14 +51,14 @@ test_device() {
 
 	local nsdev
 
-	_nvmet_passthru_target_setup "${def_subsysnqn}"
+	_nvmet_passthru_target_setup
 
 	nsdev=$(_nvmet_passthru_target_connect "${def_subsysnqn}")
 
 	compare_dev_info "${nsdev}"
 
 	_nvme_disconnect_subsys
-	_nvmet_passthru_target_cleanup "${def_subsysnqn}"
+	_nvmet_passthru_target_cleanup
 
 	echo "Test complete"
 }
diff --git a/tests/nvme/034 b/tests/nvme/034
index 8bb2d8cd8d62..e5518d497377 100755
--- a/tests/nvme/034
+++ b/tests/nvme/034
@@ -22,13 +22,13 @@ test_device() {
 	local ctrldev
 	local nsdev
 
-	_nvmet_passthru_target_setup "${def_subsysnqn}"
+	_nvmet_passthru_target_setup
 	nsdev=$(_nvmet_passthru_target_connect "${def_subsysnqn}")
 
 	_run_fio_verify_io --size="${nvme_img_size}" --filename="${nsdev}"
 
 	_nvme_disconnect_subsys
-	_nvmet_passthru_target_cleanup "${def_subsysnqn}"
+	_nvmet_passthru_target_cleanup
 
 	echo "Test complete"
 }
diff --git a/tests/nvme/035 b/tests/nvme/035
index 1d1b5e4ac46e..8a66c2c15218 100755
--- a/tests/nvme/035
+++ b/tests/nvme/035
@@ -28,7 +28,7 @@ test_device() {
 	local ctrldev
 	local nsdev
 
-	_nvmet_passthru_target_setup "${def_subsysnqn}"
+	_nvmet_passthru_target_setup
 	nsdev=$(_nvmet_passthru_target_connect "${def_subsysnqn}")
 
 	if ! _xfs_run_fio_verify_io "${nsdev}" "${nvme_img_size}"; then
@@ -36,7 +36,7 @@ test_device() {
 	fi
 
 	_nvme_disconnect_subsys
-	_nvmet_passthru_target_cleanup "${def_subsysnqn}"
+	_nvmet_passthru_target_cleanup
 
 	echo "Test complete"
 }
diff --git a/tests/nvme/036 b/tests/nvme/036
index 0e9c3bf3486c..20cd3af7081a 100755
--- a/tests/nvme/036
+++ b/tests/nvme/036
@@ -20,7 +20,7 @@ test_device() {
 
 	local ctrldev
 
-	_nvmet_passthru_target_setup "${def_subsysnqn}"
+	_nvmet_passthru_target_setup
 	nsdev=$(_nvmet_passthru_target_connect "${def_subsysnqn}")
 
 	ctrldev=$(_find_nvme_dev "${def_subsysnqn}")
@@ -30,7 +30,7 @@ test_device() {
 	fi
 
 	_nvme_disconnect_subsys
-	_nvmet_passthru_target_cleanup "${def_subsysnqn}"
+	_nvmet_passthru_target_cleanup
 
 	echo "Test complete"
 }
diff --git a/tests/nvme/037 b/tests/nvme/037
index 159d9d990bb7..2fe37a7a7340 100755
--- a/tests/nvme/037
+++ b/tests/nvme/037
@@ -22,12 +22,13 @@ test_device() {
 	local ctrldev
 
 	for ((i = 0; i < iterations; i++)); do
-		_nvmet_passthru_target_setup "${subsys}${i}"
+		_nvmet_passthru_target_setup --subsysnqn "${subsys}${i}"
 		nsdev=$(_nvmet_passthru_target_connect "${subsys}${i}")
 
 		_nvme_disconnect_subsys \
 			--subsysnqn "${subsys}${i}" >>"${FULL}" 2>&1
-		_nvmet_passthru_target_cleanup "${subsys}${i}"
+		_nvme_disconnect_subsys "${subsys}${i}" >>"${FULL}" 2>&1
+		_nvmet_passthru_target_cleanup --subsysnqn "${subsys}${i}"
 	done
 
 	echo "Test complete"
diff --git a/tests/nvme/rc b/tests/nvme/rc
index 6493aa30adef..fca7408062ee 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -899,13 +899,26 @@ _nvmet_target_cleanup() {
 }
 
 _nvmet_passthru_target_setup() {
-	local subsys_name=$1
+	local subsysnqn="$def_subsysnqn"
 	local port
 
-	_create_nvmet_passthru "${subsys_name}"
+	while [[ $# -gt 0 ]]; do
+		case $1 in
+			--subsysnqn)
+				subsysnqn="$2"
+				shift 2
+				;;
+			*)
+				echo "WARNING: unknown argument: $1"
+				shift
+				;;
+		esac
+	done
+
+	_create_nvmet_passthru "${subsysnqn}"
 	port="$(_create_nvmet_port "${nvme_trtype}")"
-	_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
-	_create_nvmet_host "${subsys_name}" "${def_hostnqn}"
+	_add_nvmet_subsys_to_port "${port}" "${subsysnqn}"
+	_create_nvmet_host "${subsysnqn}" "${def_hostnqn}"
 }
 
 _nvmet_passthru_target_connect() {
@@ -923,18 +936,31 @@ _nvmet_passthru_target_connect() {
 }
 
 _nvmet_passthru_target_cleanup() {
-	local subsys_name=$1
+	local subsysnqn="$def_subsysnqn"
 	local ports
 	local port
 
-	_get_nvmet_ports "${subsys_name}" ports
+	while [[ $# -gt 0 ]]; do
+		case $1 in
+			--subsysnqn)
+				subsysnqn="$2"
+				shift 2
+				;;
+			*)
+				echo "WARNING: unknown argument: $1"
+				shift
+				;;
+		esac
+	done
+
+	_get_nvmet_ports "${subsysnqn}" ports
 
 	for port in "${ports[@]}"; do
-		_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
+		_remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}"
 		_remove_nvmet_port "${port}"
 	done
 
-	_remove_nvmet_passhtru "${subsys_name}"
+	_remove_nvmet_passhtru "${subsysnqn}"
 	_remove_nvmet_host "${def_hostnqn}"
 }
 
-- 
2.44.0


  parent reply	other threads:[~2024-03-26 13:14 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-26 13:13 [PATCH blktests v3 00/20] refactoring and various cleanups/fixes Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 01/20] nvme/rc: silence error on module unload for fc Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 02/20] nvme/rc: silence fcloop cleanup failures Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 03/20] nvme/rc: log error if stale configuration is found Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 04/20] common/xfs: propagate errors from _xfs_run_fio_verify_io Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 05/20] nvme/{012,013,035}: check return value of _xfs_run_fio_verify_io Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 06/20] nvme/rc: use long command line option for nvme Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 07/20] nvme/{014,015,018,019,020,023,024,026,045,046}: " Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 08/20] nvme/rc: connect subsys only support long options Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 09/20] nvme/rc: add nqn/uuid args to target setup/cleanup helper Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 10/20] nvme/rc: remove unused connect options Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 11/20] nvme/rc: do not cleanup external managed loop device Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 12/20] nvme/031: do not open code target setup/cleanup Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 13/20] nvme: drop default trtype argument for _nvmet_connect_subsys Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 14/20] nvme: drop default trtype argument for _nvmet_passthru_target_connect Daniel Wagner
2024-03-26 13:13 ` [PATCH blktests v3 15/20] nvme: drop default subsysnqn argument from _nvme_{connect|disconnect}_subsys Daniel Wagner
2024-03-26 13:13 ` Daniel Wagner [this message]
2024-03-29  8:05   ` [PATCH blktests v3 16/20] nvme: drop default subsysnqn argument from _nvme_passthru_target_{setup|cleanup} Shinichiro Kawasaki
2024-03-26 13:13 ` [PATCH blktests v3 17/20] nvme: drop default subsysnqn argument from _nvmet_passthru_target_connect Daniel Wagner
2024-03-26 13:14 ` [PATCH blktests v3 18/20] nvme/{041,042,043,044,045,048}: do not pass default host{nqn|id} to _nvme_connect_subsys Daniel Wagner
2024-03-26 13:14 ` [PATCH blktests v3 19/20] nvme: don't assume namespace id Daniel Wagner
2024-03-26 13:14 ` [PATCH blktests v3 20/20] nvme/028: drop unused nvmedev Daniel Wagner
2024-03-29  8:05 ` [PATCH blktests v3 00/20] refactoring and various cleanups/fixes 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=20240326131402.5092-17-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.