@@ -34,6 +34,7 @@ test() {
_create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \
"${def_subsys_uuid}"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -46,6 +47,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "$loop_dev"
rm "${def_file_path}"
@@ -34,6 +34,7 @@ test() {
_create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \
"${def_subsys_uuid}"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" ${def_subsysnqn}
@@ -46,8 +47,9 @@ test() {
_nvme_disconnect_ctrl "${nvmedev}"
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_port "${port}"
-
_remove_nvmet_subsystem "${def_subsysnqn}"
+ _remove_nvmet_host "${def_hostnqn}"
+
losetup -d "$loop_dev"
rm "${def_file_path}"
@@ -32,6 +32,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -46,6 +47,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -28,6 +28,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -42,6 +43,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm "${def_file_path}"
@@ -32,6 +32,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -47,6 +48,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -44,6 +45,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm "${def_file_path}"
@@ -36,6 +36,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -50,6 +51,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -32,6 +32,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -46,6 +47,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm "${def_file_path}"
@@ -35,6 +35,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -56,6 +57,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -32,6 +32,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -53,6 +54,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm "${def_file_path}"
@@ -30,6 +30,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -50,6 +51,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm "${def_file_path}"
@@ -34,6 +34,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -48,6 +49,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -30,6 +30,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -44,6 +45,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -45,6 +46,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -45,6 +46,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -32,6 +32,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -48,6 +49,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -44,6 +45,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -45,6 +46,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -45,6 +46,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -44,6 +45,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -29,6 +29,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -44,6 +45,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
rm -f "${def_file_path}"
@@ -65,6 +65,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
@@ -85,6 +86,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -28,6 +28,7 @@ test() {
_create_nvmet_subsystem "${subsys}1" "$(losetup -f)"
_add_nvmet_subsys_to_port "${port}" "${subsys}1"
+ _create_nvmet_host "${subsys}1" "${def_hostnqn}"
genctr=$(_discovery_genctr)
@@ -36,13 +37,13 @@ test() {
genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port")
- echo 0 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host"
+ _add_nvmet_allow_hosts "${subsys}2" "${def_hostnqn}"
- genctr=$(_check_genctr "${genctr}" "clearing attr_allow_any_host")
+ genctr=$(_check_genctr "${genctr}" "adding host to allow_hosts")
- echo 1 > "${NVMET_CFS}/subsystems/${subsys}2/attr_allow_any_host"
+ _remove_nvmet_allow_hosts "${subsys}2" "${def_hostnqn}"
- genctr=$(_check_genctr "${genctr}" "setting attr_allow_any_host")
+ genctr=$(_check_genctr "${genctr}" "removing host from allow_hosts")
_remove_nvmet_subsystem_from_port "${port}" "${subsys}2"
_remove_nvmet_subsystem "${subsys}2"
@@ -51,8 +52,8 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${subsys}1"
_remove_nvmet_subsystem "${subsys}1"
-
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
echo "Test complete"
}
@@ -32,6 +32,8 @@ test() {
port="$(_create_nvmet_port "${nvme_trtype}")"
_create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
+
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
udevadm settle
nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
@@ -56,6 +58,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -35,6 +35,7 @@ test() {
"${def_subsys_uuid}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
+ _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
_nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \
--nr-write-queues 1 || echo FAIL
@@ -57,6 +58,7 @@ test() {
_remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}"
_remove_nvmet_subsystem "${def_subsysnqn}"
_remove_nvmet_port "${port}"
+ _remove_nvmet_host "${def_hostnqn}"
losetup -d "${loop_dev}"
@@ -608,7 +608,7 @@ _create_nvmet_subsystem() {
local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}"
mkdir -p "${cfs_path}"
- echo 1 > "${cfs_path}/attr_allow_any_host"
+ echo 0 > "${cfs_path}/attr_allow_any_host"
_create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}"
}
@@ -679,7 +679,7 @@ _create_nvmet_passthru() {
local passthru_path="${subsys_path}/passthru"
mkdir -p "${subsys_path}"
- echo 1 > "${subsys_path}/attr_allow_any_host"
+ echo 0 > "${subsys_path}/attr_allow_any_host"
_test_dev_nvme_ctrl > "${passthru_path}/device_path"
echo 1 > "${passthru_path}/enable"
@@ -694,6 +694,7 @@ _remove_nvmet_passhtru() {
local passthru_path="${subsys_path}/passthru"
echo 0 > "${passthru_path}/enable"
+ rm -f "${subsys_path}"/allowed_hosts/*
rmdir "${subsys_path}"
}
@@ -785,6 +786,7 @@ _nvmet_passthru_target_setup() {
_create_nvmet_passthru "${subsys_name}"
port="$(_create_nvmet_port "${nvme_trtype}")"
_add_nvmet_subsys_to_port "${port}" "${subsys_name}"
+ _create_nvmet_host "${subsys_name}" "${def_hostnqn}"
echo "$port"
}
@@ -811,6 +813,7 @@ _nvmet_passthru_target_cleanup() {
_remove_nvmet_subsystem_from_port "${port}" "${subsys_name}"
_remove_nvmet_port "${port}"
_remove_nvmet_passhtru "${subsys_name}"
+ _remove_nvmet_host "${def_hostnqn}"
}
_discovery_genctr() {
Only allow to connect to our setup target with the correct hostnqn. Thus we have to explicitly add the test hostnqn to the test subsysnqn allow_host list. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- tests/nvme/004 | 2 ++ tests/nvme/005 | 4 +++- tests/nvme/008 | 2 ++ tests/nvme/009 | 2 ++ tests/nvme/010 | 2 ++ tests/nvme/011 | 2 ++ tests/nvme/012 | 2 ++ tests/nvme/013 | 2 ++ tests/nvme/014 | 2 ++ tests/nvme/015 | 2 ++ tests/nvme/018 | 2 ++ tests/nvme/019 | 2 ++ tests/nvme/020 | 2 ++ tests/nvme/021 | 2 ++ tests/nvme/022 | 2 ++ tests/nvme/023 | 2 ++ tests/nvme/024 | 2 ++ tests/nvme/025 | 2 ++ tests/nvme/026 | 2 ++ tests/nvme/027 | 2 ++ tests/nvme/028 | 2 ++ tests/nvme/029 | 2 ++ tests/nvme/030 | 11 ++++++----- tests/nvme/040 | 3 +++ tests/nvme/047 | 2 ++ tests/nvme/rc | 7 +++++-- 26 files changed, 61 insertions(+), 8 deletions(-)