Switch to allowed_host
Subsystems (2)
cover Switch to allowed_host
Max asked me to replace replace the 'nvme/rc: Avoid triggering host nvme-cli autoconnect' feature with using allowed_host on the target side [1]
So while looking into this new feature, I first started to refactor existing code so that it looks a bit more consistent. I think there is even more potential to make it smaller, by introducing something similiar to _nvmet_passthru_target_setup() and _nvmet_passthru_target_cleanup() for non passthru tests. A lot of duplicated setup/cleanup code in many tests.
Except the last two patches are just refactoring patches. So if we decide to use common target setup/cleanup helpers, I think we could add them before the last two patches, which would make the last patch way smaller.
Daniel
[1] https://lore.kernel.org/all/[email protected]/
Daniel Wagner (11):
nvme/{003,004,005,013,046,049}: Group all variables declarations
nvme: Reorganize test preamble code section
nvme/rc: Add common subsystem nqn define
nvme: Use def_subsysnqn variable instead local variable nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and
hostid
nvme/rc: Add common file_path name define
nvme: Use def_file_path variable instead local variable nvme/rc: Add common def_subsys_uuid define
nvme: Use def_subsys_uuid variable
nvme/rc: Add helper for adding/removing to allow list
nvme: Add explicitly host to allow_host list
tests/nvme/003 | 11 ++++---- tests/nvme/004 | 27 +++++++++++--------- tests/nvme/005 | 27 +++++++++++--------- tests/nvme/006 | 21 ++++++++------- tests/nvme/007 | 20 ++++++--------- tests/nvme/008 | 26 +++++++++---------- tests/nvme/009 | 24 +++++++++--------- tests/nvme/010 | 26 +++++++++---------- tests/nvme/011 | 25 +++++++++--------- tests/nvme/012 | 26 +++++++++---------- tests/nvme/013 | 25 +++++++++--------- tests/nvme/014 | 26 +++++++++---------- tests/nvme/015 | 24 +++++++++--------- tests/nvme/016 | 17 ++++++------- tests/nvme/017 | 26 ++++++++----------- tests/nvme/018 | 24 +++++++++--------- tests/nvme/019 | 26 +++++++++---------- tests/nvme/020 | 24 +++++++++--------- tests/nvme/021 | 24 +++++++++--------- tests/nvme/022 | 24 +++++++++--------- tests/nvme/023 | 26 +++++++++---------- tests/nvme/024 | 24 +++++++++--------- tests/nvme/025 | 24 +++++++++--------- tests/nvme/026 | 24 +++++++++--------- tests/nvme/027 | 24 +++++++++--------- tests/nvme/028 | 24 +++++++++--------- tests/nvme/029 | 26 +++++++++---------- tests/nvme/030 | 19 +++++++------- tests/nvme/031 | 14 +++++----- tests/nvme/033 | 9 ++++--- tests/nvme/034 | 9 ++++--- tests/nvme/035 | 9 ++++--- tests/nvme/036 | 9 ++++--- tests/nvme/037 | 8 +++--- tests/nvme/038 | 6 ++--- tests/nvme/039 | 4 +-- tests/nvme/040 | 30 ++++++++++++---------- tests/nvme/041 | 50 ++++++++++++++++-------------------- tests/nvme/042 | 55 ++++++++++++++++++---------------------- tests/nvme/043 | 52 +++++++++++++++++-------------------- tests/nvme/044 | 69 +++++++++++++++++++++++--------------------------- tests/nvme/045 | 61 ++++++++++++++++++++------------------------ tests/nvme/046 | 1 + tests/nvme/047 | 30 +++++++++++----------- tests/nvme/048 | 46 +++++++++++++++------------------ tests/nvme/049 | 1 + tests/nvme/rc | 30 +++++++++++++++++++--- 47 files changed, 572 insertions(+), 585 deletions(-)
Signature · 1 line
2.41.0
PATCH 1/11 nvme/{003,004,005,013,046,049}: Group all variables declarations
Group all variable declarations together at the beginning of the function.
--- tests/nvme/003 | 3 ++- tests/nvme/004 | 3 ++- tests/nvme/005 | 5 +++-- tests/nvme/013 | 1 - tests/nvme/046 | 1 + tests/nvme/049 | 1 + 6 files changed, 9 insertions(+), 5 deletions(-)
tests/nvme/003 +2 -1
@@ -22,10 +22,11 @@ test() { _setup_nvmet + local loop_dev local port + port="$(_create_nvmet_port "${nvme_trtype}")" - local loop_dev loop_dev="$(losetup -f)" _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}"
tests/nvme/004 +2 -1
@@ -23,11 +23,12 @@ test() { _setup_nvmet local port + local loop_dev + port="$(_create_nvmet_port "${nvme_trtype}")" truncate -s "${nvme_img_size}" "$TMPDIR/img" - local loop_dev loop_dev="$(losetup -f --show "$TMPDIR/img")" _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \
tests/nvme/005 +3 -2
@@ -22,11 +22,13 @@ test() { _setup_nvmet local port + local loop_dev + local nvmedev + port="$(_create_nvmet_port "${nvme_trtype}")" truncate -s "${nvme_img_size}" "$TMPDIR/img" - local loop_dev loop_dev="$(losetup -f --show "$TMPDIR/img")" _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \
@@ -35,7 +37,6 @@ test() { _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 - local nvmedev nvmedev=$(_find_nvme_dev "blktests-subsystem-1") udevadm settle
tests/nvme/013 +0 -1
@@ -26,7 +26,6 @@ test() { local port local nvmedev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}"
tests/nvme/046 +1 -0
@@ -16,6 +16,7 @@ requires() { test_device() { echo "Running ${TEST_NAME}" + local ngdev=${TEST_DEV/nvme/ng} local perm nsid
tests/nvme/049 +1 -0
@@ -17,6 +17,7 @@ requires() { test_device() { echo "Running ${TEST_NAME}" + local ngdev=${TEST_DEV/nvme/ng} local common_args=( --size=1M
Signature · 1 line
2.41.0
PATCH 2/11 nvme: Reorganize test preamble code section
In reply to Daniel WagnerThis unifies all the tests preamble code section.
Reorganize all tests to start with printing the test name, then the setting nvmet and finally followed by the variable declarations.
--- tests/nvme/006 | 4 ++-- tests/nvme/007 | 4 ++-- tests/nvme/016 | 4 ++-- tests/nvme/017 | 4 ++-- tests/nvme/030 | 8 ++++---- tests/nvme/031 | 8 ++++---- tests/nvme/033 | 7 ++++--- tests/nvme/034 | 7 ++++--- tests/nvme/035 | 7 ++++--- tests/nvme/036 | 7 ++++--- tests/nvme/037 | 8 ++++---- tests/nvme/038 | 6 +++--- tests/nvme/039 | 4 ++-- tests/nvme/040 | 7 ++++--- tests/nvme/041 | 8 ++++---- tests/nvme/042 | 8 ++++---- tests/nvme/043 | 8 ++++---- tests/nvme/044 | 8 ++++---- tests/nvme/045 | 8 ++++---- tests/nvme/048 | 8 ++++---- 20 files changed, 69 insertions(+), 64 deletions(-)
tests/nvme/006 +2 -2
@@ -18,12 +18,12 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local loop_dev local subsys_name="blktests-subsystem-1" - _setup_nvmet - truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/007 +2 -2
@@ -17,12 +17,12 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local file_path local subsys_name="blktests-subsystem-1" - _setup_nvmet - file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}"
tests/nvme/016 +2 -2
@@ -16,13 +16,13 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local iterations="${nvme_num_iter}" local loop_dev local subsys_nqn="blktests-subsystem-1" - _setup_nvmet - loop_dev="$(losetup -f)" local genctr=1
tests/nvme/017 +2 -2
@@ -16,13 +16,13 @@ requires() { test() { echo "Running ${TEST_NAME}" + _setup_nvmet + local port local file_path local iterations="${nvme_num_iter}" local subsys_name="blktests-subsystem-1" - _setup_nvmet - file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}"
tests/nvme/030 +4 -4
@@ -16,14 +16,14 @@ requires() { } test() { - local port - local genctr - local subsys="blktests-subsystem-" - echo "Running ${TEST_NAME}" _setup_nvmet + local port + local genctr + local subsys="blktests-subsystem-" + port="$(_create_nvmet_port "${nvme_trtype}")" _create_nvmet_subsystem "${subsys}1" "$(losetup -f)"
tests/nvme/031 +4 -4
@@ -24,15 +24,15 @@ requires() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-" local iterations=10 local loop_dev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")"
tests/nvme/033 +4 -3
@@ -45,13 +45,14 @@ compare_dev_info() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
tests/nvme/034 +4 -3
@@ -15,14 +15,15 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
tests/nvme/035 +4 -3
@@ -21,14 +21,15 @@ device_requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local nsdev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
tests/nvme/036 +4 -3
@@ -14,13 +14,14 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local ctrldev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet port=$(_nvmet_passthru_target_setup "${subsys}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${subsys}")
tests/nvme/037 +4 -4
@@ -13,15 +13,15 @@ requires() { } test_device() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-" local iterations=10 local ctrldev local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - for ((i = 0; i < iterations; i++)); do port=$(_nvmet_passthru_target_setup "${subsys}${i}") nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" \
tests/nvme/038 +3 -3
@@ -19,13 +19,13 @@ requires() { } test() { - local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" - local port - echo "Running ${TEST_NAME}" _setup_nvmet + local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local port + mkdir -p "${subsys_path}" rmdir "${subsys_path}"
tests/nvme/039 +2 -2
@@ -131,12 +131,12 @@ inject_invalid_admin_cmd() } test_device() { + echo "Running ${TEST_NAME}" + local nvme_verbose_errors local ns_dev local ctrl_dev - echo "Running ${TEST_NAME}" - if _check_kernel_option NVME_VERBOSE_ERRORS; then nvme_verbose_errors=true else
tests/nvme/040 +4 -3
@@ -17,6 +17,10 @@ requires() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys="blktests-subsystem-1" local file_path="${TMPDIR}/img" local port
@@ -24,9 +28,6 @@ test() { local nvmedev local fio_pid - echo "Running ${TEST_NAME}" - - _setup_nvmet truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")"
tests/nvme/041 +4 -4
@@ -20,6 +20,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid
@@ -28,8 +32,6 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
@@ -38,8 +40,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}" \
tests/nvme/042 +4 -4
@@ -20,6 +20,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid
@@ -30,13 +34,9 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}"
tests/nvme/043 +4 -4
@@ -21,6 +21,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid
@@ -31,8 +35,6 @@ test() { local hostkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)"
@@ -41,8 +43,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}"
tests/nvme/044 +4 -4
@@ -21,6 +21,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid
@@ -30,8 +34,6 @@ test() { local ctrlkey local ctrldev - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}"
@@ -47,8 +49,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}"
tests/nvme/045 +4 -4
@@ -22,6 +22,10 @@ requires() { test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local port local subsys_name="blktests-subsystem-1" local hostid
@@ -34,8 +38,6 @@ test() { local ctrldev local rand_io_size - echo "Running ${TEST_NAME}" - hostid="${def_hostid}" hostnqn="${def_hostnqn}"
@@ -51,8 +53,6 @@ test() { return 1 fi - _setup_nvmet - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${subsys_name}" "${file_path}"
tests/nvme/048 +4 -4
@@ -81,6 +81,10 @@ set_qid_max() { } test() { + echo "Running ${TEST_NAME}" + + _setup_nvmet + local subsys_name="blktests-subsystem-1" local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}" local file_path="${TMPDIR}/img"
@@ -89,10 +93,6 @@ test() { local hostid local port - echo "Running ${TEST_NAME}" - - _setup_nvmet - hostid="${def_hostid}" hostnqn="${def_hostnqn}"
Signature · 1 line
2.41.0
PATCH 3/11 nvme/rc: Add common subsystem nqn define
In reply to Daniel WagnerAdd common subsystem nqn as global definition so that we can reuse it.
--- tests/nvme/rc | 1 + 1 file changed, 1 insertion(+)
tests/nvme/rc +1 -0
@@ -16,6 +16,7 @@ def_local_wwnn="0x10001100aa000002" def_local_wwpn="0x20001100aa000002" def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" +def_subsysnqn="blktests-subsystem-1" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"} nvme_num_iter=${nvme_num_iter:-"1000"}
Signature · 1 line
2.41.0
PATCH 5/11 nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and hostid
In reply to Daniel WagnerCommit acc408477e85 ("nvme/{041,042,043,044,045,048}: Use default hostnqn and hostid") switched the test over to use the default hostnqn. It missed the change to remove the local variable and use the def_hostnqn/def_hostid directly.
--- tests/nvme/041 | 16 ++++++---------- tests/nvme/042 | 21 ++++++++------------- tests/nvme/043 | 22 +++++++++------------- tests/nvme/044 | 27 +++++++++++---------------- tests/nvme/045 | 23 +++++++++-------------- tests/nvme/048 | 12 ++++-------- 6 files changed, 47 insertions(+), 74 deletions(-)
tests/nvme/041 +6 -10
@@ -25,14 +25,10 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed"
@@ -45,21 +41,21 @@ test() { "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" _nvme_disconnect_subsys "${def_subsysnqn}" # Test authenticated connection echo "Test authenticated connection" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle
@@ -71,7 +67,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}"
tests/nvme/042 +8 -13
@@ -25,23 +25,18 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hmac local key_len local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" for hmac in 0 1 2 3; do echo "Testing hmac ${hmac}"
@@ -50,11 +45,11 @@ test() { echo "couldn't generate host key for hmac ${hmac}" return 1 fi - _set_nvmet_hostkey "${hostnqn}" "${hostkey}" + _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle
@@ -68,11 +63,11 @@ test() { echo "couldn't generate host key for length ${key_len}" return 1 fi - _set_nvmet_hostkey "${hostnqn}" "${hostkey}" + _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle
@@ -85,7 +80,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}"
tests/nvme/043 +9 -13
@@ -26,17 +26,13 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hash local dhgroup local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_hostnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" return 1
@@ -47,17 +43,17 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do echo "Testing hash ${hash}" - _set_nvmet_hash "${hostnqn}" "${hash}" + _set_nvmet_hash "${def_hostnqn}" "${hash}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle
@@ -69,11 +65,11 @@ test() { echo "Testing DH group ${dhgroup}" - _set_nvmet_dhgroup "${hostnqn}" "${dhgroup}" + _set_nvmet_dhgroup "${def_hostnqn}" "${dhgroup}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle
@@ -86,7 +82,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}"
tests/nvme/044 +11 -16
@@ -26,16 +26,11 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hostkey local ctrlkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key"
@@ -53,16 +48,16 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" \ + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ "${hostkey}" "${ctrlkey}" - _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" + _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" # Step 1: Connect with host authentication only echo "Test host authentication" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" udevadm settle
@@ -73,8 +68,8 @@ test() { # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${hostkey}"
@@ -86,8 +81,8 @@ test() { # and valid ctrl authentication echo "Test valid ctrl authentication" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}"
@@ -100,8 +95,8 @@ test() { echo "Test invalid ctrl key (should fail)" invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${invkey}"
@@ -114,7 +109,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}"
tests/nvme/045 +9 -14
@@ -27,8 +27,6 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hostkey local new_hostkey
@@ -37,9 +35,6 @@ test() { local ctrldev local rand_io_size - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key"
@@ -57,13 +52,13 @@ test() { _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" "${ctrlkey}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" "${ctrlkey}" - _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" + _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}"
@@ -82,7 +77,7 @@ test() { new_hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" - _set_nvmet_hostkey "${hostnqn}" "${new_hostkey}" + _set_nvmet_hostkey "${def_hostnqn}" "${new_hostkey}" echo "Re-authenticate with new host key"
@@ -92,7 +87,7 @@ test() { new_ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" - _set_nvmet_ctrlkey "${hostnqn}" "${new_ctrlkey}" + _set_nvmet_ctrlkey "${def_hostnqn}" "${new_ctrlkey}" echo "Re-authenticate with new ctrl key"
@@ -101,7 +96,7 @@ test() { echo "Change DH group to ffdhe8192" - _set_nvmet_dhgroup "${hostnqn}" "ffdhe8192" + _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe8192" echo "Re-authenticate with changed DH group"
@@ -109,7 +104,7 @@ test() { echo "Change hash to hmac(sha512)" - _set_nvmet_hash "${hostnqn}" "hmac(sha512)" + _set_nvmet_hash "${def_hostnqn}" "hmac(sha512)" echo "Re-authenticate with changed hash"
@@ -127,7 +122,7 @@ test() { _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}"
tests/nvme/048 +4 -8
@@ -88,25 +88,21 @@ test() { local cfs_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" local file_path="${TMPDIR}/img" local skipped=false - local hostnqn - local hostid local port - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - truncate -s "${nvme_img_size}" "${file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" if [[ -f "${cfs_path}/attr_qid_max" ]] ; then _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ - --hostnqn "${hostnqn}" \ - --hostid "${hostid}" \ + --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ --keep-alive-tmo 1 \ --reconnect-delay 2
@@ -126,7 +122,7 @@ test() { _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - _remove_nvmet_host "${hostnqn}" + _remove_nvmet_host "${def_hostnqn}" rm "${file_path}"
Signature · 1 line
2.41.0
PATCH 6/11 nvme/rc: Add common file_path name define
In reply to Daniel WagnerAdd common file_path name as global definition so that we can reuse it.
--- tests/nvme/rc | 1 + 1 file changed, 1 insertion(+)
tests/nvme/rc +1 -0
@@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002" def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" def_subsysnqn="blktests-subsystem-1" +def_file_path="${TMPDIR}/img" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"} nvme_num_iter=${nvme_num_iter:-"1000"}
Signature · 1 line
2.41.0
PATCH 7/11 nvme: Use def_file_path variable instead local variable
In reply to Daniel WagnerAs all tests are using the same file path name anyway, use the def_file_path variable.
--- tests/nvme/004 | 6 +++--- tests/nvme/005 | 6 +++--- tests/nvme/006 | 6 +++--- tests/nvme/007 | 9 +++------ tests/nvme/008 | 7 +++---- tests/nvme/009 | 7 +++---- tests/nvme/010 | 7 +++---- tests/nvme/011 | 8 +++----- tests/nvme/012 | 7 +++---- tests/nvme/013 | 7 +++---- tests/nvme/014 | 7 +++---- tests/nvme/015 | 7 +++---- tests/nvme/017 | 11 ++++------- tests/nvme/018 | 7 +++---- tests/nvme/019 | 7 +++---- tests/nvme/020 | 7 +++---- tests/nvme/021 | 7 +++---- tests/nvme/022 | 7 +++---- tests/nvme/023 | 7 +++---- tests/nvme/024 | 7 +++---- tests/nvme/025 | 7 +++---- tests/nvme/026 | 7 +++---- tests/nvme/027 | 7 +++---- tests/nvme/028 | 7 +++---- tests/nvme/029 | 7 +++---- tests/nvme/031 | 6 +++--- tests/nvme/040 | 7 +++---- tests/nvme/041 | 7 +++---- tests/nvme/042 | 7 +++---- tests/nvme/043 | 7 +++---- tests/nvme/044 | 7 +++---- tests/nvme/045 | 7 +++---- tests/nvme/047 | 7 +++---- tests/nvme/048 | 7 +++---- 34 files changed, 103 insertions(+), 138 deletions(-)
tests/nvme/004 +3 -3
@@ -27,9 +27,9 @@ test() { port="$(_create_nvmet_port "${nvme_trtype}")" - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -47,7 +47,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/005 +3 -3
@@ -27,9 +27,9 @@ test() { port="$(_create_nvmet_port "${nvme_trtype}")" - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -49,7 +49,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/006 +3 -3
@@ -23,9 +23,9 @@ test() { local port local loop_dev - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -38,7 +38,7 @@ test() { losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/007 +3 -6
@@ -20,13 +20,10 @@ test() { _setup_nvmet local port - local file_path - file_path="${TMPDIR}/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - truncate -s "${nvme_img_size}" "${file_path}" - - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -35,7 +32,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/008 +3 -4
@@ -23,11 +23,10 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -50,7 +49,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/009 +3 -4
@@ -21,11 +21,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -44,7 +43,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/010 +3 -4
@@ -23,11 +23,10 @@ test() { local port local nvmedev local loop_dev - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -51,7 +50,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/011 +3 -5
@@ -22,12 +22,10 @@ test() { local port local nvmedev - local file_path - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -47,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/012 +3 -4
@@ -27,11 +27,10 @@ test() { local port local nvmedev local loop_dev - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -54,7 +53,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/013 +3 -4
@@ -25,11 +25,10 @@ test() { local port local nvmedev - local file_path="${TMPDIR}/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -48,7 +47,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/014 +3 -4
@@ -26,11 +26,10 @@ test() { local size local bs local count - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -60,7 +59,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/015 +3 -4
@@ -25,11 +25,10 @@ test() { local size local bs local count - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -55,7 +54,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/017 +4 -7
@@ -19,20 +19,17 @@ test() { _setup_nvmet local port - local file_path local iterations="${nvme_num_iter}" - file_path="${TMPDIR}/img" - - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" local genctr=1 - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" for ((i = 2; i <= iterations; i++)); do - _create_nvmet_ns "${def_subsysnqn}" "${i}" "${file_path}" + _create_nvmet_ns "${def_subsysnqn}" "${i}" "${def_file_path}" done port="$(_create_nvmet_port "${nvme_trtype}")"
@@ -49,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/018 +3 -4
@@ -23,11 +23,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -52,7 +51,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/019 +3 -4
@@ -23,13 +23,12 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -52,7 +51,7 @@ test() { losetup -d "${loop_dev}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/020 +3 -4
@@ -21,13 +21,12 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/021 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/022 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/023 +3 -4
@@ -23,11 +23,10 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -52,7 +51,7 @@ test() { losetup -d "${loop_dev}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/024 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/025 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/026 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -47,7 +46,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/027 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/028 +3 -4
@@ -22,11 +22,10 @@ test() { local port local nvmedev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -46,7 +45,7 @@ test() { _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/029 +3 -4
@@ -56,11 +56,10 @@ test() { local port local nvmedev local loop_dev - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -89,7 +88,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/031 +3 -3
@@ -33,9 +33,9 @@ test() { local loop_dev local port - truncate -s "${nvme_img_size}" "$TMPDIR/img" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "$TMPDIR/img")" + loop_dev="$(losetup -f --show "${def_file_path}")" port="$(_create_nvmet_port "${nvme_trtype}")"
@@ -50,7 +50,7 @@ test() { _remove_nvmet_port "${port}" losetup -d "$loop_dev" - rm "$TMPDIR/img" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/040 +3 -4
@@ -21,14 +21,13 @@ test() { _setup_nvmet - local file_path="${TMPDIR}/img" local port local loop_dev local nvmedev local fio_pid - truncate -s "${nvme_img_size}" "${file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + truncate -s "${nvme_img_size}" "${def_file_path}" + loop_dev="$(losetup -f --show "${def_file_path}")" port="$(_create_nvmet_port "${nvme_trtype}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}"
@@ -60,7 +59,7 @@ test() { losetup -d "${loop_dev}" - rm -f "${file_path}" + rm -f "${def_file_path}" echo "Test complete" }
tests/nvme/041 +3 -4
@@ -25,7 +25,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hostkey local ctrldev
@@ -35,9 +34,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
@@ -69,7 +68,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/042 +3 -4
@@ -25,15 +25,14 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hmac local key_len local hostkey local ctrldev - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}"
@@ -82,7 +81,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/043 +3 -4
@@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hash local dhgroup local hostkey
@@ -38,9 +37,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}"
@@ -84,7 +83,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/044 +3 -4
@@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hostkey local ctrlkey local ctrldev
@@ -43,9 +42,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \
@@ -111,7 +110,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/045 +3 -4
@@ -27,7 +27,6 @@ test() { _setup_nvmet local port - local file_path="${TMPDIR}/img" local hostkey local new_hostkey local ctrlkey
@@ -47,9 +46,9 @@ test() { return 1 fi - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}" "${ctrlkey}"
@@ -124,7 +123,7 @@ test() { _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/047 +3 -4
@@ -26,11 +26,10 @@ test() { local nvmedev local loop_dev local rand_io_size - local file_path="$TMPDIR/img" - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - loop_dev="$(losetup -f --show "${file_path}")" + loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e"
@@ -61,7 +60,7 @@ test() { losetup -d "${loop_dev}" - rm "${file_path}" + rm "${def_file_path}" echo "Test complete" }
tests/nvme/048 +3 -4
@@ -86,13 +86,12 @@ test() { _setup_nvmet local cfs_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" - local file_path="${TMPDIR}/img" local skipped=false local port - truncate -s "${nvme_img_size}" "${file_path}" + truncate -s "${nvme_img_size}" "${def_file_path}" - _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")"
@@ -124,7 +123,7 @@ test() { _remove_nvmet_port "${port}" _remove_nvmet_host "${def_hostnqn}" - rm "${file_path}" + rm "${def_file_path}" if [[ "${skipped}" = true ]] ; then return 1
Signature · 1 line
2.41.0
PATCH 9/11 nvme: Use def_subsys_uuid variable
In reply to Daniel WagnerAs all tests are using the same subsys uuid name anyway, use the def_subsys_uuid variable.
--- tests/nvme/004 | 2 +- tests/nvme/005 | 2 +- tests/nvme/006 | 2 +- tests/nvme/007 | 2 +- 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/017 | 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/041 | 2 +- tests/nvme/047 | 2 +- tests/nvme/048 | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-)
tests/nvme/004 +1 -1
@@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}"
tests/nvme/005 +1 -1
@@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _nvme_connect_subsys "${nvme_trtype}" ${def_subsysnqn}
tests/nvme/006 +1 -1
@@ -28,7 +28,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/007 +1 -1
@@ -24,7 +24,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/008 +1 -1
@@ -29,7 +29,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/009 +1 -1
@@ -25,7 +25,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/010 +1 -1
@@ -29,7 +29,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/011 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/012 +1 -1
@@ -33,7 +33,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/013 +1 -1
@@ -29,7 +29,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/014 +1 -1
@@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/015 +1 -1
@@ -29,7 +29,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/017 +1 -1
@@ -26,7 +26,7 @@ test() { local genctr=1 _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" for ((i = 2; i <= iterations; i++)); do _create_nvmet_ns "${def_subsysnqn}" "${i}" "${def_file_path}"
tests/nvme/018 +1 -1
@@ -27,7 +27,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/019 +1 -1
@@ -31,7 +31,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/020 +1 -1
@@ -27,7 +27,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/021 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/022 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/023 +1 -1
@@ -29,7 +29,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/024 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/025 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/026 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/027 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/028 +1 -1
@@ -26,7 +26,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/029 +1 -1
@@ -62,7 +62,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/041 +1 -1
@@ -37,7 +37,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "b92842df-a394-44b1-84a4-92ae7d112861" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" "${hostkey}"
tests/nvme/047 +1 -1
@@ -32,7 +32,7 @@ test() { loop_dev="$(losetup -f --show "${def_file_path}")" _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ - "91fdba0d-f87b-4c25-b80f-db7be1418b9e" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
tests/nvme/048 +1 -1
@@ -92,7 +92,7 @@ test() { truncate -s "${nvme_img_size}" "${def_file_path}" _create_nvmet_subsystem "${def_subsysnqn}" "${def_file_path}" \ - "b92842df-a394-44b1-84a4-92ae7d112861" + "${def_subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}"
Signature · 1 line
2.41.0
PATCH 10/11 nvme/rc: Add helper for adding/removing to allow list
In reply to Daniel WagnerAdd two helpers to add or remove the host from the allow list of the subsystem.
--- tests/nvme/rc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
tests/nvme/rc +18 -2
@@ -612,6 +612,23 @@ _create_nvmet_subsystem() { _create_nvmet_ns "${nvmet_subsystem}" "1" "${blkdev}" "${uuid}" } +_add_nvmet_allow_hosts() { + local nvmet_subsystem="$1" + local nvmet_hostnqn="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" + + ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" +} + +_remove_nvmet_allow_hosts() { + local nvmet_subsystem="$1" + local nvmet_hostnqn="$2" + local cfs_path="${NVMET_CFS}/subsystems/${nvmet_subsystem}" + + rm "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" +} + _create_nvmet_host() { local nvmet_subsystem="$1" local nvmet_hostnqn="$2"
@@ -621,8 +638,7 @@ _create_nvmet_host() { local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" mkdir "${host_path}" - echo 0 > "${cfs_path}/attr_allow_any_host" - ln -s "${host_path}" "${cfs_path}/allowed_hosts/${nvmet_hostnqn}" + _add_nvmet_allow_hosts "${nvmet_subsystem}" "${nvmet_hostnqn}" if [[ "${nvmet_hostkey}" ]] ; then echo "${nvmet_hostkey}" > "${host_path}/dhchap_key" fi
Signature · 1 line
2.41.0
PATCH 8/11 nvme/rc: Add common def_subsys_uuid define
In reply to Daniel WagnerAdd common subsys uuid as global definition so that we can reuse it.
--- tests/nvme/rc | 1 + 1 file changed, 1 insertion(+)
tests/nvme/rc +1 -0
@@ -17,6 +17,7 @@ def_local_wwpn="0x20001100aa000002" def_hostid="0f01fb42-9f7f-4856-b0b3-51e60b8de349" def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" def_subsysnqn="blktests-subsystem-1" +def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e" def_file_path="${TMPDIR}/img" nvme_trtype=${nvme_trtype:-"loop"} nvme_img_size=${nvme_img_size:-"1G"}
Signature · 1 line
2.41.0
PATCH 4/11 nvme: Use def_subsysnqn variable instead local variable
In reply to Daniel WagnerAs all tests are using the same subsystem nqn anyway, use the def_subsysnqn variable and drop the local subsys_name variable.
--- tests/nvme/003 | 8 ++++---- tests/nvme/004 | 14 +++++++------- tests/nvme/005 | 12 ++++++------ tests/nvme/006 | 9 ++++----- tests/nvme/007 | 9 ++++----- tests/nvme/008 | 15 +++++++-------- tests/nvme/009 | 15 +++++++-------- tests/nvme/010 | 15 +++++++-------- tests/nvme/011 | 15 +++++++-------- tests/nvme/012 | 15 +++++++-------- tests/nvme/013 | 15 +++++++-------- tests/nvme/014 | 15 +++++++-------- tests/nvme/015 | 15 +++++++-------- tests/nvme/016 | 13 ++++++------- tests/nvme/017 | 13 ++++++------- tests/nvme/018 | 15 +++++++-------- tests/nvme/019 | 15 +++++++-------- tests/nvme/020 | 15 +++++++-------- tests/nvme/021 | 15 +++++++-------- tests/nvme/022 | 15 +++++++-------- tests/nvme/023 | 15 +++++++-------- tests/nvme/024 | 15 +++++++-------- tests/nvme/025 | 15 +++++++-------- tests/nvme/026 | 15 +++++++-------- tests/nvme/027 | 15 +++++++-------- tests/nvme/028 | 15 +++++++-------- tests/nvme/029 | 15 +++++++-------- tests/nvme/033 | 2 +- tests/nvme/034 | 2 +- tests/nvme/035 | 2 +- tests/nvme/036 | 2 +- tests/nvme/038 | 2 +- tests/nvme/040 | 13 ++++++------- tests/nvme/041 | 21 ++++++++++----------- tests/nvme/042 | 23 +++++++++++------------ tests/nvme/043 | 19 +++++++++---------- tests/nvme/044 | 31 +++++++++++++++---------------- tests/nvme/045 | 27 +++++++++++++-------------- tests/nvme/047 | 19 +++++++++---------- tests/nvme/048 | 23 +++++++++++------------ 40 files changed, 266 insertions(+), 298 deletions(-)
tests/nvme/003 +4 -4
@@ -29,8 +29,8 @@ test() { loop_dev="$(losetup -f)" - _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" _nvme_connect_subsys "${nvme_trtype}" nqn.2014-08.org.nvmexpress.discovery
@@ -46,8 +46,8 @@ test() { fi _nvme_disconnect_subsys nqn.2014-08.org.nvmexpress.discovery - _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" - _remove_nvmet_subsystem "blktests-subsystem-1" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" echo "Test complete"
tests/nvme/004 +7 -7
@@ -31,20 +31,20 @@ test() { loop_dev="$(losetup -f --show "$TMPDIR/img")" - _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" local nvmedev - nvmedev=$(_find_nvme_dev "blktests-subsystem-1") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" - _nvme_disconnect_subsys blktests-subsystem-1 - _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" - _remove_nvmet_subsystem "blktests-subsystem-1" + _nvme_disconnect_subsys ${def_subsysnqn} + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "$loop_dev" rm "$TMPDIR/img"
tests/nvme/005 +6 -6
@@ -31,23 +31,23 @@ test() { loop_dev="$(losetup -f --show "$TMPDIR/img")" - _create_nvmet_subsystem "blktests-subsystem-1" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" - _add_nvmet_subsys_to_port "${port}" "blktests-subsystem-1" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" blktests-subsystem-1 + _nvme_connect_subsys "${nvme_trtype}" ${def_subsysnqn} - nvmedev=$(_find_nvme_dev "blktests-subsystem-1") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") udevadm settle echo 1 > "/sys/class/nvme/${nvmedev}/reset_controller" _nvme_disconnect_ctrl "${nvmedev}" - _remove_nvmet_subsystem_from_port "${port}" "blktests-subsystem-1" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" - _remove_nvmet_subsystem "blktests-subsystem-1" + _remove_nvmet_subsystem "${def_subsysnqn}" losetup -d "$loop_dev" rm "$TMPDIR/img"
tests/nvme/006 +4 -5
@@ -22,19 +22,18 @@ test() { local port local loop_dev - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "$TMPDIR/img" loop_dev="$(losetup -f --show "$TMPDIR/img")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "$loop_dev"
tests/nvme/007 +4 -5
@@ -21,19 +21,18 @@ test() { local port local file_path - local subsys_name="blktests-subsystem-1" file_path="${TMPDIR}/img" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}"
tests/nvme/008 +7 -8
@@ -24,29 +24,28 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/009 +7 -8
@@ -22,27 +22,26 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}"
tests/nvme/010 +7 -8
@@ -24,30 +24,29 @@ test() { local nvmedev local loop_dev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _run_fio_verify_io --size="${nvme_img_size}" \ --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/011 +7 -8
@@ -24,28 +24,27 @@ test() { local nvmedev local file_path local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _run_fio_verify_io --size="${nvme_img_size}" \ --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}"
tests/nvme/012 +7 -8
@@ -28,29 +28,28 @@ test() { local nvmedev local loop_dev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _xfs_run_fio_verify_io "/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/013 +7 -8
@@ -26,27 +26,26 @@ test() { local port local nvmedev local file_path="${TMPDIR}/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" _xfs_run_fio_verify_io "/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}"
tests/nvme/014 +7 -8
@@ -27,20 +27,19 @@ test() { local bs local count local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -53,10 +52,10 @@ test() { nvme flush "/dev/${nvmedev}" -n 1 - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/015 +7 -8
@@ -26,18 +26,17 @@ test() { local bs local count local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -50,10 +49,10 @@ test() { nvme flush "/dev/${nvmedev}n1" -n 1 - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}"
tests/nvme/016 +6 -7
@@ -21,30 +21,29 @@ test() { local port local iterations="${nvme_num_iter}" local loop_dev - local subsys_nqn="blktests-subsystem-1" loop_dev="$(losetup -f)" local genctr=1 - _create_nvmet_subsystem "${subsys_nqn}" "${loop_dev}" + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" for ((i = 2; i <= iterations; i++)); do - _create_nvmet_ns "${subsys_nqn}" "${i}" "${loop_dev}" + _create_nvmet_ns "${def_subsysnqn}" "${i}" "${loop_dev}" done port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "$port" "${subsys_nqn}" + _add_nvmet_subsys_to_port "$port" "${def_subsysnqn}" genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port") - _remove_nvmet_subsystem_from_port "${port}" "${subsys_nqn}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" for ((i = iterations; i > 1; i--)); do - _remove_nvmet_ns "${subsys_nqn}" "$i" + _remove_nvmet_ns "${def_subsysnqn}" "$i" done - _remove_nvmet_subsystem "${subsys_nqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" echo "Test complete" }
tests/nvme/017 +6 -7
@@ -21,7 +21,6 @@ test() { local port local file_path local iterations="${nvme_num_iter}" - local subsys_name="blktests-subsystem-1" file_path="${TMPDIR}/img"
@@ -29,26 +28,26 @@ test() { local genctr=1 - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" for ((i = 2; i <= iterations; i++)); do - _create_nvmet_ns "${subsys_name}" "${i}" "${file_path}" + _create_nvmet_ns "${def_subsysnqn}" "${i}" "${file_path}" done port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" genctr=$(_check_genctr "${genctr}" "adding a subsystem to a port") - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" _remove_nvmet_port "${port}" for ((i = iterations; i > 1; i--)); do - _remove_nvmet_ns "${subsys_name}" "$i" + _remove_nvmet_ns "${def_subsysnqn}" "$i" done - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem "${def_subsysnqn}" rm "${file_path}"
tests/nvme/018 +7 -8
@@ -24,18 +24,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -47,10 +46,10 @@ test() { nvme read "/dev/${nvmedev}n1" -s "$sectors" -c 0 -z "$bs" &>"$FULL" \ && echo "ERROR: nvme read for out of range LBA was not rejected" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm "${file_path}"
tests/nvme/019 +7 -8
@@ -24,7 +24,6 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000"
@@ -32,23 +31,23 @@ test() { loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/020 +7 -8
@@ -22,29 +22,28 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" local nblk_range="10,10,10,10,10,10,10,10,10,10" local sblk_range="100,200,300,400,500,600,700,800,900,1000" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/021 +7 -8
@@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -42,10 +41,10 @@ test() { echo "ERROR: device not listed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/022 +7 -8
@@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -42,10 +41,10 @@ test() { echo "ERROR: reset failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/023 +7 -8
@@ -24,20 +24,19 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -45,10 +44,10 @@ test() { echo "ERROR: smart-log bdev-ns failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/024 +7 -8
@@ -23,28 +23,27 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then echo "ERROR: smart-log file-ns failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/025 +7 -8
@@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -42,10 +41,10 @@ test() { echo "ERROR: effects-log failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/026 +7 -8
@@ -23,18 +23,17 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -42,10 +41,10 @@ test() { echo "ERROR: ns-desc failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/027 +7 -8
@@ -23,28 +23,27 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" if ! nvme ns-rescan "/dev/${nvmedev}" >> "$FULL" 2>&1; then echo "ERROR: ns-rescan failed" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/028 +7 -8
@@ -23,28 +23,27 @@ test() { local port local nvmedev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid" if ! nvme list-subsys 2>> "$FULL" | grep -q "${nvme_trtype}"; then echo "ERROR: list-subsys" fi - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" rm -f "${file_path}"
tests/nvme/029 +7 -8
@@ -57,20 +57,19 @@ test() { local nvmedev local loop_dev local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") cat "/sys/block/${nvmedev}n1/uuid" cat "/sys/block/${nvmedev}n1/wwid"
@@ -82,10 +81,10 @@ test() { test_user_io "$dev" 511 1023 > "$FULL" 2>&1 || echo FAIL test_user_io "$dev" 511 1025 > "$FULL" 2>&1 || echo FAIL - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/033 +1 -1
@@ -49,7 +49,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local nsdev local port
tests/nvme/034 +1 -1
@@ -19,7 +19,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local ctrldev local nsdev local port
tests/nvme/035 +1 -1
@@ -25,7 +25,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local ctrldev local nsdev local port
tests/nvme/036 +1 -1
@@ -18,7 +18,7 @@ test_device() { _setup_nvmet - local subsys="blktests-subsystem-1" + local subsys="${def_subsysnqn}" local ctrldev local port
tests/nvme/038 +1 -1
@@ -23,7 +23,7 @@ test() { _setup_nvmet - local subsys_path="${NVMET_CFS}/subsystems/blktests-subsystem-1" + local subsys_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" local port mkdir -p "${subsys_path}"
tests/nvme/040 +6 -7
@@ -21,7 +21,6 @@ test() { _setup_nvmet - local subsys="blktests-subsystem-1" local file_path="${TMPDIR}/img" local port local loop_dev
@@ -32,11 +31,11 @@ test() { loop_dev="$(losetup -f --show "${file_path}")" port="$(_create_nvmet_port "${nvme_trtype}")" - _create_nvmet_subsystem "${subsys}" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "${subsys}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys}" + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" udevadm settle - nvmedev=$(_find_nvme_dev "${subsys}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") # start fio job echo "starting background fio"
@@ -55,8 +54,8 @@ test() { { kill "${fio_pid}"; wait; } &> /dev/null - _remove_nvmet_subsystem_from_port "${port}" "${subsys}" - _remove_nvmet_subsystem "${subsys}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/041 +10 -11
@@ -25,7 +25,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img"
@@ -34,7 +33,7 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "nvme gen-dhchap-key failed" return 1
@@ -42,33 +41,33 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Test authenticated connection echo "Test authenticated connection" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}"
tests/nvme/042 +11 -12
@@ -25,7 +25,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img"
@@ -39,50 +38,50 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" for hmac in 0 1 2 3; do echo "Testing hmac ${hmac}" - hostkey="$(nvme gen-dhchap-key --hmac=${hmac} -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key --hmac=${hmac} -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "couldn't generate host key for hmac ${hmac}" return 1 fi _set_nvmet_hostkey "${hostnqn}" "${hostkey}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done for key_len in 32 48 64; do echo "Testing key length ${key_len}" - hostkey="$(nvme gen-dhchap-key --key-length=${key_len} -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key --key-length=${key_len} -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "couldn't generate host key for length ${key_len}" return 1 fi _set_nvmet_hostkey "${hostnqn}" "${hostkey}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}"
tests/nvme/043 +9 -10
@@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img"
@@ -45,10 +44,10 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" for hash in "hmac(sha256)" "hmac(sha384)" "hmac(sha512)" ; do
@@ -56,14 +55,14 @@ test() { _set_nvmet_hash "${hostnqn}" "${hash}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done for dhgroup in "ffdhe2048" "ffdhe3072" "ffdhe4096" "ffdhe6144" "ffdhe8192" ; do
@@ -72,18 +71,18 @@ test() { _set_nvmet_dhgroup "${hostnqn}" "${dhgroup}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" done - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}"
tests/nvme/044 +15 -16
@@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img"
@@ -37,13 +36,13 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key" return 1 fi - ctrlkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$ctrlkey" ] ; then echo "failed to generate ctrl key" return 1
@@ -51,29 +50,29 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" \ + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" \ "${hostkey}" "${ctrlkey}" _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" # Step 1: Connect with host authentication only echo "Test host authentication" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Step 2: Connect with host authentication # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \
@@ -81,12 +80,12 @@ test() { udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Step 3: Connect with host authentication # and valid ctrl authentication echo "Test valid ctrl authentication" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \
@@ -94,13 +93,13 @@ test() { udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" # Step 4: Connect with host authentication # and invalid ctrl key echo "Test invalid ctrl key (should fail)" invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \
@@ -108,10 +107,10 @@ test() { udevadm settle - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}"
tests/nvme/045 +13 -14
@@ -27,7 +27,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1" local hostid local hostnqn local file_path="${TMPDIR}/img"
@@ -41,13 +40,13 @@ test() { hostid="${def_hostid}" hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then echo "failed to generate host key" return 1 fi - ctrlkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$ctrlkey" ] ; then echo "failed to generate ctrl key" return 1
@@ -55,14 +54,14 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" "${hostkey}" "${ctrlkey}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${hostnqn}" "${hostkey}" "${ctrlkey}" _set_nvmet_dhgroup "${hostnqn}" "ffdhe2048" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --dhchap-secret "${hostkey}" \
@@ -72,7 +71,7 @@ test() { echo "Re-authenticate with original host key" - ctrldev=$(_find_nvme_dev "${subsys_name}") + ctrldev=$(_find_nvme_dev "${def_subsysnqn}") if [ -z "$ctrldev" ] ; then echo "nvme controller not found" fi
@@ -81,7 +80,7 @@ test() { echo "Renew host key on the controller" - new_hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + new_hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" _set_nvmet_hostkey "${hostnqn}" "${new_hostkey}"
@@ -91,7 +90,7 @@ test() { echo "Renew ctrl key on the controller" - new_ctrlkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + new_ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" _set_nvmet_ctrlkey "${hostnqn}" "${new_ctrlkey}"
@@ -116,15 +115,15 @@ test() { echo "${new_hostkey}" > "${hostkey_file}" - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") rand_io_size="$(_nvme_calc_rand_io_size 4m)" _run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}"
tests/nvme/047 +9 -10
@@ -27,37 +27,36 @@ test() { local loop_dev local rand_io_size local file_path="$TMPDIR/img" - local subsys_name="blktests-subsystem-1" truncate -s "${nvme_img_size}" "${file_path}" loop_dev="$(losetup -f --show "${file_path}")" - _create_nvmet_subsystem "${subsys_name}" "${loop_dev}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${loop_dev}" \ "91fdba0d-f87b-4c25-b80f-db7be1418b9e" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --nr-write-queues 1 || echo FAIL - nvmedev=$(_find_nvme_dev "${subsys_name}") + nvmedev=$(_find_nvme_dev "${def_subsysnqn}") rand_io_size="$(_nvme_calc_rand_io_size 4M)" _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --nr-write-queues 1 \ --nr-poll-queues 1 || echo FAIL _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" - _nvme_disconnect_subsys "${subsys_name}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" losetup -d "${loop_dev}"
tests/nvme/048 +11 -12
@@ -85,8 +85,7 @@ test() { _setup_nvmet - local subsys_name="blktests-subsystem-1" - local cfs_path="${NVMET_CFS}/subsystems/${subsys_name}" + local cfs_path="${NVMET_CFS}/subsystems/${def_subsysnqn}" local file_path="${TMPDIR}/img" local skipped=false local hostnqn
@@ -98,34 +97,34 @@ test() { truncate -s "${nvme_img_size}" "${file_path}" - _create_nvmet_subsystem "${subsys_name}" "${file_path}" \ + _create_nvmet_subsystem "${def_subsysnqn}" "${file_path}" \ "b92842df-a394-44b1-84a4-92ae7d112861" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${subsys_name}" - _create_nvmet_host "${subsys_name}" "${hostnqn}" + _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" + _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" if [[ -f "${cfs_path}/attr_qid_max" ]] ; then - _nvme_connect_subsys "${nvme_trtype}" "${subsys_name}" \ + _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ --hostnqn "${hostnqn}" \ --hostid "${hostid}" \ --keep-alive-tmo 1 \ --reconnect-delay 2 - if ! nvmf_wait_for_state "${subsys_name}" "live" ; then + if ! nvmf_wait_for_state "${def_subsysnqn}" "live" ; then echo FAIL else - set_qid_max "${port}" "${subsys_name}" 1 || echo FAIL - set_qid_max "${port}" "${subsys_name}" 2 || echo FAIL + set_qid_max "${port}" "${def_subsysnqn}" 1 || echo FAIL + set_qid_max "${port}" "${def_subsysnqn}" 2 || echo FAIL fi - _nvme_disconnect_subsys "${subsys_name}" + _nvme_disconnect_subsys "${def_subsysnqn}" else SKIP_REASONS+=("missing attr_qid_max feature") skipped=true fi - _remove_nvmet_subsystem_from_port "${port}" "${subsys_name}" - _remove_nvmet_subsystem "${subsys_name}" + _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem "${def_subsysnqn}" _remove_nvmet_port "${port}" _remove_nvmet_host "${hostnqn}"
Signature · 1 line
2.41.0
PATCH 11/11 nvme: Add explicitly host to allow_host list
In reply to Daniel WagnerOnly 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.
--- 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(-)
tests/nvme/004 +2 -0
@@ -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}"
tests/nvme/005 +3 -1
@@ -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}"
tests/nvme/008 +2 -0
@@ -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}"
tests/nvme/009 +2 -0
@@ -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}"
tests/nvme/010 +2 -0
@@ -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}"
tests/nvme/011 +2 -0
@@ -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}"
tests/nvme/012 +2 -0
@@ -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}"
tests/nvme/013 +2 -0
@@ -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}"
tests/nvme/014 +2 -0
@@ -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}"
tests/nvme/015 +2 -0
@@ -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}"
tests/nvme/018 +2 -0
@@ -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}"
tests/nvme/019 +2 -0
@@ -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}"
tests/nvme/020 +2 -0
@@ -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}"
tests/nvme/021 +2 -0
@@ -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}"
tests/nvme/022 +2 -0
@@ -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}"
tests/nvme/023 +2 -0
@@ -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}"
tests/nvme/024 +2 -0
@@ -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}"
tests/nvme/025 +2 -0
@@ -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}"
tests/nvme/026 +2 -0
@@ -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}"
tests/nvme/027 +2 -0
@@ -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}"
tests/nvme/028 +2 -0
@@ -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}"
tests/nvme/029 +2 -0
@@ -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}"
tests/nvme/030 +6 -5
@@ -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" }
tests/nvme/040 +3 -0
@@ -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}"
tests/nvme/047 +2 -0
@@ -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}"
tests/nvme/rc +5 -2
@@ -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() {
Signature · 1 line
2.41.0
Re: [PATCH blktests v1 01/11] nvme/{003,004,005,013,046,049}: Group all variables declarations
In reply to Daniel WagnerQuoted 2 lines · Daniel Wagner
Group all variable declarations together at the beginning of the function.
An explanation of why this change has been proposed is missing from the patch description.
I think the current style, with variable declarations occurring just before the first use of a variable, is on purpose. I like that style.
Bart.
Re: [PATCH blktests v1 01/11] nvme/{003,004,005,013,046,049}: Group all variables declarations
Quoted 6 lines · Bart Van Assche
Quoted 2 lines · Daniel Wagner
Group all variable declarations together at the beginning of the function.
An explanation of why this change has been proposed is missing from the patch description.
Sure, I'll add one. The coding style to declare all local variables at the beginning of the function.
Quoted 2 lines
I think the current style, with variable declarations occurring just before the first use of a variable, is on purpose. I like that style.
The majority of functions declare variables at the beginning of the functions. As you can see these are only a handful of declerations which do not adhere to the coding style.
Re: [PATCH blktests v1 01/11] nvme/{003,004,005,013,046,049}: Group all variables declarations
Quoted 10 lines · Daniel Wagner
Quoted 6 lines · Bart Van Assche
Quoted 2 lines · Daniel Wagner
Group all variable declarations together at the beginning of the function.
An explanation of why this change has been proposed is missing from the patch description.
Sure, I'll add one. The coding style to declare all local variables at the beginning of the function.
Isn't declaring local variables just before their first use a better style?
Thanks,
Bart.
Re: [PATCH blktests v1 01/11] nvme/{003,004,005,013,046,049}: Group all variables declarations
Quoted 6 lines · Bart Van Assche
Quoted 5 lines · Daniel Wagner
Quoted 4 lines · Bart Van Assche
Quoted 2 lines · Daniel Wagner
Group all variable declarations together at the beginning of the function.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
An explanation of why this change has been proposed is missing from the patch description.
Sure, I'll add one. The coding style to declare all local variables at the beginning of the function.
Isn't declaring local variables just before their first use a better style?
IMO both styles have pros and cons. Declarations at "beginning of functions" helps to understand what the function uses as its local data (pros), but the declaration and the usage are separated and makes it difficult to understand (cons). Declarations at "just before first use" have the opposite pros and cons. This style is easier to read especially when a function is rather long.
In the past, I preferred declarations at the beginning functions and requested it in my review comments [1], but I learned that this guide is not so widely
applied: xfstests scripts, or even blktests 'check' scripts have declarations in the middle of the functions. So I think both styles are okay at this moment.
[1] https://github.com/osandov/blktests/pull/99
More importantly, this discussion maybe going towards "too strict" guidelines, which will discourage contributions. Similar topic is [[ ]] vs [ ]. Once I was requesting strictly to use [[ ]], but it did not seem productive. Now I no longer request to replace [ ] with [[ ]]. In same manner, I suggest not to be strict on the local variable declaration position either.
As for this patch, it is not required to follow guidelines. Does it make Daniel's refactoring work easier? If so, I guess it will be valuable.
Re: [PATCH blktests v1 01/11] nvme/{003,004,005,013,046,049}: Group all variables declarations
Quoted 13 lines · Shinichiro Kawasaki
Quoted 12 lines · Bart Van Assche
Quoted 10 lines · Daniel Wagner
Quoted 6 lines · Bart Van Assche
Quoted 2 lines · Daniel Wagner
Group all variable declarations together at the beginning of the function.
An explanation of why this change has been proposed is missing from the patch description.
Sure, I'll add one. The coding style to declare all local variables at the beginning of the function.
Quoted 7 lines
Quoted 1 line
Isn't declaring local variables just before their first use a better style?
IMO both styles have pros and cons. Declarations at "beginning of functions" helps to understand what the function uses as its local data (pros), but the declaration and the usage are separated and makes it difficult to understand (cons). Declarations at "just before first use" have the opposite pros and cons. This style is easier to read especially when a function is rather long.
FWIW, if I keep going with the refactoring (providing helper function to setup/cleanpup the complete target in one step), most of the tests will be very short. Thus there are far less variables to declare anyway.
Quoted 4 lines
In the past, I preferred declarations at the beginning functions and requested it in my review comments [1], but I learned that this guide is not so widely
applied: xfstests scripts, or even blktests 'check' scripts have declarations in the middle of the functions. So I think both styles are okay at this moment.
Okay, I wasn't aware of this.
Quoted 10 lines
[1] https://github.com/osandov/blktests/pull/99
More importantly, this discussion maybe going towards "too strict" guidelines, which will discourage contributions. Similar topic is [[ ]] vs [ ]. Once I was requesting strictly to use [[ ]], but it did not seem productive. Now I no longer request to replace [ ] with [[ ]]. In same manner, I suggest not to be strict on the local variable declaration position either.
As for this patch, it is not required to follow guidelines. Does it make Daniel's refactoring work easier? If so, I guess it will be valuable.
IMO, this is the case, because you can way easier identify odd balls in the large bulk changes where I have to touch almost all tests cases for a change.
So ideally, after these refactoring most of the tests will be shorter. Thinking about this, I could first introduce these helpers and update the callsides. Though I find this harder to review because all the tests look slightly different. But hey there are more one road to reach Rome. I suspect this approach would reduce the code churn a bit. Anyway, let me know what you prefer.
Re: [PATCH blktests v1 01/11] nvme/{003,004,005,013,046,049}: Group all variables declarations
Quoted 22 lines · Daniel Wagner
Quoted 13 lines · Shinichiro Kawasaki
Quoted 12 lines · Bart Van Assche
Quoted 10 lines · Daniel Wagner
Quoted 6 lines · Bart Van Assche
Quoted 2 lines · Daniel Wagner
Group all variable declarations together at the beginning of the function.
An explanation of why this change has been proposed is missing from the patch description.
Sure, I'll add one. The coding style to declare all local variables at the beginning of the function.
Quoted 7 lines
Quoted 1 line
Isn't declaring local variables just before their first use a better style?
IMO both styles have pros and cons. Declarations at "beginning of functions" helps to understand what the function uses as its local data (pros), but the declaration and the usage are separated and makes it difficult to understand (cons). Declarations at "just before first use" have the opposite pros and cons. This style is easier to read especially when a function is rather long.
Quoted 3 lines
FWIW, if I keep going with the refactoring (providing helper function to setup/cleanpup the complete target in one step), most of the tests will be very short. Thus there are far less variables to declare anyway.
I can imagine that. Sounds good :)
Quoted 16 lines
Quoted 5 lines
In the past, I preferred declarations at the beginning functions and requested it in my review comments [1], but I learned that this guide is not so widely
applied: xfstests scripts, or even blktests 'check' scripts have declarations in the middle of the functions. So I think both styles are okay at this moment.Okay, I wasn't aware of this.
Quoted 8 lines
[1] https://github.com/osandov/blktests/pull/99
More importantly, this discussion maybe going towards "too strict" guidelines, which will discourage contributions. Similar topic is [[ ]] vs [ ]. Once I was requesting strictly to use [[ ]], but it did not seem productive. Now I no longer request to replace [ ] with [[ ]]. In same manner, I suggest not to be strict on the local variable declaration position either.
Quoted 5 lines
Quoted 2 lines
As for this patch, it is not required to follow guidelines. Does it make Daniel's refactoring work easier? If so, I guess it will be valuable.
IMO, this is the case, because you can way easier identify odd balls in the large bulk changes where I have to touch almost all tests cases for a change.
I think this reasoning is good enough to have this patch. So, purpose of this patch is not to follow guidelines but to "find the odd balls" and make refactoring easier.
Quoted 6 lines
So ideally, after these refactoring most of the tests will be shorter. Thinking about this, I could first introduce these helpers and update the callsides. Though I find this harder to review because all the tests look slightly different. But hey there are more one road to reach Rome. I suspect this approach would reduce the code churn a bit. Anyway, let me know what you prefer.
The road you chose looks the fastest way for me.
Re: [PATCH blktests v1 04/11] nvme: Use def_subsysnqn variable instead local variable
In reply to Daniel WagnerQuoted 3 lines · Daniel Wagner
As all tests are using the same subsystem nqn anyway, use the
def_subsysnqnvariable and drop the localsubsys_namevariable.
[...]
tests/nvme/043 test() { · line 29
Quoted 9 lines
tests/nvme/043 +0
-1@@ -26,7 +26,6 @@ test() { _setup_nvmet local port - local subsys_name="blktests-subsystem-1"
The variable subsys_name is removed here, but this patch still leaves a reference to it. This causes this test case fail. The reference is removed in the next patch. I think the left reference should be replaced with def_subsysnqn in this patch.
Re: [PATCH blktests v1 05/11] nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and hostid
In reply to Daniel WagnerQuoted 4 lines · Daniel Wagner
Commit
acc408477e85("nvme/{041,042,043,044,045,048}: Use default hostnqn and hostid") switched the test over to use the default hostnqn. It missed the change to remove the local variable and use the def_hostnqn/def_hostid directly.
[...]
Quoted 10 lines
tests/nvme/043 +0
-2@@ -26,17 +26,13 @@ test() { _setup_nvmet local port - local hostid - local hostnqn
tests/nvme/043 test() { · line 35
Quoted 10 lines
tests/nvme/043 +1
-3local file_path="${TMPDIR}/img" local hash local dhgroup local hostkey local ctrldev - hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_hostnqn} 2> /dev/null)"
As I commented on the previous patch, the left reference to subsys_name is replaced def_hostnqn. It means that the -n option value changes. I guess this change is fine for this test. Could you confirm it?
Re: [PATCH blktests v1 11/11] nvme: Add explicitly host to allow_host list
In reply to Daniel WagnerQuoted 4 lines · Daniel Wagner
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_hostlist.
[...]
Quoted 18 lines
tests/nvme/030 +2
-2@@ -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")
tests/nvme/030 test() { · line 49
Quoted 10 lines
tests/nvme/030 +3
-2+ 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"
The hunk above looks different from other changes. Is it changing test content slightly to meet request by Max? If so, it would be good to note in the commit message.
Quoted 8 lines · Daniel Wagner
Max asked me to replace replace the 'nvme/rc: Avoid triggering host nvme-cli autoconnect' feature with using
allowed_hoston the target side [1]So while looking into this new feature, I first started to refactor existing code so that it looks a bit more consistent. I think there is even more potential to make it smaller, by introducing something similiar to
_nvmet_passthru_target_setup()and_nvmet_passthru_target_cleanup()for non passthru tests. A lot of duplicated setup/cleanup code in many tests.
Thanks for this action :)
Quoted 4 lines
Except the last two patches are just refactoring patches. So if we decide to use common target setup/cleanup helpers, I think we could add them before the last two patches, which would make the last patch way smaller.
I ran 'make check' and saw shellecheck complaints below. I added 'export' to the variables then they disappeared.
tests/nvme/rc:19:1: warning: def_subsysnqn appears unused. Verify use (or export if used externally). [SC2034] tests/nvme/rc:20:1: warning: def_file_path appears unused. Verify use (or export if used externally). [SC2034] tests/nvme/rc:21:1: warning: def_file_path appears unused. Verify use (or export if used externally). [SC2034]
I also ran nvme tests with the export fixes and saw no regression. Looks good from test run point of view.
Re: [PATCH blktests v1 05/11] nvme/{041,042,043,044,045,048}: Remove local variable hostnqn and hostid
In reply to Shinichiro KawasakiQuoted 24 lines · Shinichiro Kawasaki
Quoted 4 lines · Daniel Wagner
Commit
acc408477e85("nvme/{041,042,043,044,045,048}: Use default hostnqn and hostid") switched the test over to use the default hostnqn. It missed the change to remove the local variable and use the def_hostnqn/def_hostid directly.[...]
Quoted 16 lines
tests/nvme/043 +0
-2@@ -26,17 +26,13 @@ test() { _setup_nvmet local port - local hostid - local hostnqn local file_path="${TMPDIR}/img" local hash local dhgroup local hostkey local ctrldev
Quoted 8 lines
tests/nvme/043 test() { · line 35
Quoted 4 lines
tests/nvme/043 +1
-3- hostid="${def_hostid}" - hostnqn="${def_hostnqn}" - hostkey="$(nvme gen-dhchap-key -n ${subsys_name} 2> /dev/null)" + hostkey="$(nvme gen-dhchap-key -n ${def_hostnqn} 2> /dev/null)"As I commented on the previous patch, the left reference to
subsys_nameis replaceddef_hostnqn. It means that the -n option value changes. I guess this change is fine for this test. Could you confirm it?
This change should be in the previous patch as you commented in the previous patch. This is an artifact from my devel steps.
Re: [PATCH blktests v1 11/11] nvme: Add explicitly host to allow_host list
In reply to Shinichiro KawasakiQuoted 34 lines · Shinichiro Kawasaki
Quoted 4 lines · Daniel Wagner
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_hostlist.[...]
Quoted 26 lines
tests/nvme/030 +5
-4@@ -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")
Quoted 6 lines
tests/nvme/030 test() { · line 49
Quoted 2 lines
tests/nvme/030 +0
-0_remove_nvmet_subsystem_from_port "${port}" "${subsys}2" _remove_nvmet_subsystem "${subsys}2"The hunk above looks different from other changes. Is it changing test content slightly to meet request by Max? If so, it would be good to note in the commit message.
I should have explained this change in the commit message. When we use allowed_hosts, the attr_allow_any_host feature is disabled and thus has no side effects like updating the genctr. This makes the test fail. I opted to use _[add|remove]_nvmet_allow_hosts to trigger the same side effect. While at it, I also updated the logging info.
Quoted 10 lines · Shinichiro Kawasaki
Quoted 3 lines
Except the last two patches are just refactoring patches. So if we decide to use common target setup/cleanup helpers, I think we could add them before the last two patches, which would make the last patch way smaller.
I ran 'make check' and saw shellecheck complaints below. I added 'export' to the variables then they disappeared.
tests/nvme/rc:19:1: warning:
def_subsysnqnappears unused. Verify use (or export if used externally). [SC2034] tests/nvme/rc:20:1: warning:def_file_pathappears unused. Verify use (or export if used externally). [SC2034] tests/nvme/rc:21:1: warning:def_file_pathappears unused. Verify use (or export if used externally). [SC2034]
These variables are not used in nvme/rc at the point I introduce them. Only in the tests. I could add the nvmet setup/cleanup helpers with the variables which would make those warnings go away. But these helpers would then add the end of the series. Also not really good. I don't what is best here.
Quoted 2 lines
I also ran nvme tests with the export fixes and saw no regression. Looks good from test run point of view.
Thanks!
BTW, I am off next week, so I don't think I send soon an update.