@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
@@ -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}"
}
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(-)