[RFC blktests v1 07/10] nvme/rc: add nqn/uuid args to target setup/cleanup helper
Daniel Wagner
dwagner at suse.de
Mon Mar 18 02:38:53 PDT 2024
Make these helper a bit more flexible, so that the caller
can setup not just the default subsysnqn.
Signed-off-by: Daniel Wagner <dwagner at 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
More information about the Linux-nvme
mailing list