refactoring and various cleanups/fixes
Subsystems (2)
PATCH 2/18 nvme/rc: silence fcloop cleanup failures
In reply to Daniel WagnerWhen the ctl file is missing we are logging
tests/nvme/rc: line 265: /sys/class/fcloop/ctl/del_target_port: No such file or directory tests/nvme/rc: line 257: /sys/class/fcloop/ctl/del_local_port: No such file or directory tests/nvme/rc: line 249: /sys/class/fcloop/ctl/del_remote_port: No such file or directory
because the first redirect operator fails. Thus first check if the ctl file exists.
--- tests/nvme/rc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
tests/nvme/rc +12 -3
@@ -234,7 +234,10 @@ _nvme_fcloop_del_rport() { local remote_wwpn="$4" local loopctl=/sys/class/fcloop/ctl - echo "wwnn=${remote_wwnn},wwpn=${remote_wwpn}" > ${loopctl}/del_remote_port 2> /dev/null + if [[ ! -f "${loopctrl}" ]]; then + return + fi + echo "wwnn=${remote_wwnn},wwpn=${remote_wwpn}" > ${loopctl}/del_remote_port > /dev/null 2>&1 } _nvme_fcloop_del_lport() {
@@ -242,7 +245,10 @@ _nvme_fcloop_del_lport() { local wwpn="$2" local loopctl=/sys/class/fcloop/ctl - echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/del_local_port 2> /dev/null + if [[ ! -f "${loopctrl}" ]]; then + return + fi + echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/del_local_port > /dev/null > /dev/null 2>&1 } _nvme_fcloop_del_tport() {
@@ -250,7 +256,10 @@ _nvme_fcloop_del_tport() { local wwpn="$2" local loopctl=/sys/class/fcloop/ctl - echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/del_target_port 2> /dev/null + if [[ ! -f "${loopctrl}" ]]; then + return + fi + echo "wwnn=${wwnn},wwpn=${wwpn}" > ${loopctl}/del_target_port > /dev/null 2&>1 } _cleanup_fcloop() {
Signature · 1 line
2.44.0
PATCH 4/18 common/xfs: propagate errors from _xfs_run_fio_verify_io
In reply to Daniel WagnerIf _xfs_mkfs_and_mount fails _xfs_run_fio_verify_io will continue to execute and fio will run against the local file system instead against the block device.
Propagate all errors back to the caller.
--- common/xfs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
common/xfs +7 -2
@@ -16,7 +16,7 @@ _xfs_mkfs_and_mount() { mkdir -p "${mount_dir}" umount "${mount_dir}" - mkfs.xfs -l size=64m -f "${bdev}" + mkfs.xfs -l size=64m -f "${bdev}" || return $? mount "${bdev}" "${mount_dir}" }
@@ -27,8 +27,10 @@ _xfs_run_fio_verify_io() { local sz_mb local avail local avail_mb + local rc - _xfs_mkfs_and_mount "${bdev}" "${mount_dir}" >> "${FULL}" 2>&1 + _xfs_mkfs_and_mount "${bdev}" "${mount_dir}" \ + >>"${FULL}" 2>&1 || return $? avail="$(df --output=avail "${mount_dir}" | tail -1)" avail_mb="$((avail / 1024))"
@@ -43,7 +45,10 @@ _xfs_run_fio_verify_io() { fi _run_fio_verify_io --size="${sz_mb}m" --directory="${mount_dir}/" + rc=$? umount "${mount_dir}" >> "${FULL}" 2>&1 rm -fr "${mount_dir}" + + return "${rc}" }
Signature · 1 line
2.44.0
PATCH 5/18 nvme/{012,013,035}: check return value of _xfs_run_fio_verify_io
In reply to Daniel WagnerWhen _xfs_run_fio_verify_io fails we should log the error. Currently, no failure is detected when this function fails.
--- tests/nvme/012 | 4 +++- tests/nvme/013 | 4 +++- tests/nvme/035 | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)
tests/nvme/012 +3 -1
@@ -33,7 +33,9 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - _xfs_run_fio_verify_io "/dev/${nvmedev}n1" + if ! _xfs_run_fio_verify_io "/dev/${nvmedev}n1"; then + echo "FAIL: fio verify failed" + fi _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/013 +3 -1
@@ -32,7 +32,9 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - _xfs_run_fio_verify_io "/dev/${nvmedev}n1" + if ! _xfs_run_fio_verify_io "/dev/${nvmedev}n1"; then + echo "FAIL: fio verify failed" + fi _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/035 +3 -1
@@ -31,7 +31,9 @@ test_device() { _nvmet_passthru_target_setup "${def_subsysnqn}" nsdev=$(_nvmet_passthru_target_connect "${nvme_trtype}" "${def_subsysnqn}") - _xfs_run_fio_verify_io "${nsdev}" "${nvme_img_size}" + if ! _xfs_run_fio_verify_io "${nsdev}" "${nvme_img_size}"; then + echo "FAIL: fio verify failed" + fi _nvme_disconnect_subsys "${def_subsysnqn}" _nvmet_passthru_target_cleanup "${def_subsysnqn}"
Signature · 1 line
2.44.0
PATCH 6/18 nvme/rc: use long command line option for nvme
In reply to Daniel WagnerThe long format of the command line option are more descriptive and more likely to stay stable.
--- tests/nvme/rc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
tests/nvme/rc +9 -9
@@ -148,7 +148,7 @@ _require_nvme_trtype_is_fabrics() { } _require_nvme_cli_auth() { - if ! nvme gen-dhchap-key -n nvmf-test-subsys > /dev/null 2>&1 ; then + if ! nvme gen-dhchap-key --nqn nvmf-test-subsys > /dev/null 2>&1 ; then SKIP_REASONS+=("nvme gen-dhchap-key command missing") return 1 fi
@@ -396,13 +396,13 @@ _setup_nvmet() { _nvme_disconnect_ctrl() { local ctrl="$1" - nvme disconnect -d "${ctrl}" + nvme disconnect --device "${ctrl}" } _nvme_disconnect_subsys() { local subsysnqn="$1" - nvme disconnect -n "${subsysnqn}" |& tee -a "$FULL" | + nvme disconnect --nqn "${subsysnqn}" |& tee -a "$FULL" | grep -o "disconnected.*" }
@@ -496,11 +496,11 @@ _nvme_connect_subsys() { trtype="$1" subsysnqn="$2" - ARGS=(-t "${trtype}" -n "${subsysnqn}") + ARGS=(--transport "${trtype}" --nqn "${subsysnqn}") if [[ "${trtype}" == "fc" ]] ; then - ARGS+=(-a "${traddr}" -w "${host_traddr}") + ARGS+=(--traddr "${traddr}" --host-traddr "${host_traddr}") elif [[ "${trtype}" != "loop" ]]; then - ARGS+=(-a "${traddr}" -s "${trsvcid}") + ARGS+=(--traddr "${traddr}" --trsvcid "${trsvcid}") fi ARGS+=(--hostnqn="${hostnqn}") ARGS+=(--hostid="${hostid}")
@@ -565,13 +565,13 @@ _nvme_discover() { local host_traddr="${3:-$def_host_traddr}" local trsvcid="${3:-$def_trsvcid}" - ARGS=(-t "${trtype}") + ARGS=(--transport "${trtype}") ARGS+=(--hostnqn="${def_hostnqn}") ARGS+=(--hostid="${def_hostid}") if [[ "${trtype}" = "fc" ]]; then - ARGS+=(-a "${traddr}" -w "${host_traddr}") + ARGS+=(--traddr "${traddr}" --host-traddr "${host_traddr}") elif [[ "${trtype}" != "loop" ]]; then - ARGS+=(-a "${traddr}" -s "${trsvcid}") + ARGS+=(--traddr "${traddr}" --trsvcid "${trsvcid}") fi nvme discover "${ARGS[@]}" }
Signature · 1 line
2.44.0
PATCH 7/18 nvme/{014,015,018,019,020,023,024,026,045,046}: use long command line option for nvme
In reply to Daniel WagnerThe long format of the command line option are more descriptive and more likely to stay stable.
--- tests/nvme/014 | 2 +- tests/nvme/015 | 2 +- tests/nvme/018 | 3 ++- tests/nvme/019 | 3 ++- tests/nvme/020 | 3 ++- tests/nvme/023 | 3 ++- tests/nvme/024 | 3 ++- tests/nvme/026 | 3 ++- tests/nvme/045 | 4 ++-- tests/nvme/046 | 7 ++++--- 10 files changed, 20 insertions(+), 13 deletions(-)
tests/nvme/014 +1 -1
@@ -39,7 +39,7 @@ test() { dd if=/dev/urandom of="/dev/${nvmedev}n1" \ count="${count}" bs="${bs}" status=none - nvme flush "/dev/${nvmedev}" -n 1 + nvme flush "/dev/${nvmedev}" --namespace-id 1 _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/015 +1 -1
@@ -39,7 +39,7 @@ test() { dd if=/dev/urandom of="/dev/${nvmedev}n1" \ count="${count}" bs="${bs}" status=none - nvme flush "/dev/${nvmedev}n1" -n 1 + nvme flush "/dev/${nvmedev}n1" --namespace-id 1 _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/018 +2 -1
@@ -35,7 +35,8 @@ test() { sectors="$(blockdev --getsz "/dev/${nvmedev}n1")" bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" - nvme read "/dev/${nvmedev}n1" -s "$sectors" -c 0 -z "$bs" &>"$FULL" \ + nvme read "/dev/${nvmedev}n1" --start-block "$sectors" \ + --block-count 0 --data-size "$bs" &>"$FULL" \ && echo "ERROR: nvme read for out of range LBA was not rejected" _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/019 +2 -1
@@ -31,7 +31,8 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" + nvme dsm "/dev/${nvmedev}" --namespace-id 1 --ad \ + --slbs "${sblk_range}" --blocks "${nblk_range}" _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/020 +2 -1
@@ -30,7 +30,8 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - nvme dsm "/dev/${nvmedev}" -n 1 -d -s "${sblk_range}" -b "${nblk_range}" + nvme dsm "/dev/${nvmedev}" --namespace-id 1 --ad \ + --slbs "${sblk_range}" --blocks "${nblk_range}" _nvme_disconnect_subsys "${def_subsysnqn}"
tests/nvme/023 +2 -1
@@ -29,7 +29,8 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then + if ! nvme smart-log "/dev/${nvmedev}" --namespace-id 1 \ + >> "$FULL" 2>&1; then echo "ERROR: smart-log bdev-ns failed" fi
tests/nvme/024 +2 -1
@@ -29,7 +29,8 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - if ! nvme smart-log "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then + if ! nvme smart-log "/dev/${nvmedev}" --namespace-id 1 \ + >> "$FULL" 2>&1; then echo "ERROR: smart-log file-ns failed" fi _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1
tests/nvme/026 +2 -1
@@ -29,7 +29,8 @@ test() { nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - if ! nvme ns-descs "/dev/${nvmedev}" -n 1 >> "$FULL" 2>&1; then + if ! nvme ns-descs "/dev/${nvmedev}" --namespace-id 1 \ + >> "$FULL" 2>&1; then echo "ERROR: ns-desc failed" fi
tests/nvme/045 +2 -2
@@ -68,7 +68,7 @@ test() { echo "Renew host key on the controller" - new_hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" + new_hostkey="$(nvme gen-dhchap-key --nqn ${def_subsysnqn} 2> /dev/null)" _set_nvmet_hostkey "${def_hostnqn}" "${new_hostkey}"
@@ -78,7 +78,7 @@ test() { echo "Renew ctrl key on the controller" - new_ctrlkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" + new_ctrlkey="$(nvme gen-dhchap-key --nqn ${def_subsysnqn} 2> /dev/null)" _set_nvmet_ctrlkey "${def_hostnqn}" "${new_ctrlkey}"
tests/nvme/046 +4 -3
@@ -25,13 +25,14 @@ test_device() { chmod g+r,o+r "$ngdev" - if ! _run_user "nvme io-passthru ${ngdev} --opcode 2 -l 4096 \ - -n $nsid -r" >> "${FULL}" 2>&1; then + if ! _run_user "nvme io-passthru ${ngdev} --opcode 2 --data-len 4096 \ + --namespace-id $nsid --read" >> "${FULL}" 2>&1; then echo "Error: io-passthru read failed" fi if _run_user "echo hello | nvme io-passthru ${ngdev} --opcode 1 \ - -l 4096 -n $nsid -r" >> "${FULL}" 2>&1; then + --data-len 4096 --namespace-id $nsid --read" \ + >> "${FULL}" 2>&1; then echo "Error: io-passthru write passed (unexpected)" fi
Signature · 1 line
2.44.0
cover refactoring and various cleanups/fixes
While working on two new features I collected a bunch of patches which I think make sense to review and merge them indepenedly. And I got a few more ideas for refactoring and cleanups. But one step after the other.
Daniel Wagner (18):
nvme/rc: silence error on module unload for fc
nvme/rc: silence fcloop cleanup failures
nvme/rc: log error if stale configuration is found common/xfs: propagate errors from _xfs_run_fio_verify_io nvme/{012,013,035}: check return value of _xfs_run_fio_verify_io nvme/rc: use long command line option for nvme nvme/{014,015,018,019,020,023,024,026,045,046}: use long command line
option for nvme
nvme/rc: connect subsys only support long options
nvme/rc: add nqn/uuid args to target setup/cleanup helper nvme/rc: remove unused connect options
nvme/rc: remove correct port from target
nvme/031: do not open code target setup/cleanup nvme/{rc,031}: do not cleanup external managed loop device
nvme: drop default trtype argument for _nvmet_connect_subsys
nvme: drop default subsysnqn argument from
_nvme_{connect|disconnect}_subsys
nvme/{041,042,043,044,045,048}: do not pass default host{nqn|id} to
_nvme_connect_subsys
nvme: don't assume namespace id
nvme/028: drop unused nvmedev
common/xfs | 9 ++- tests/nvme/003 | 4 +- tests/nvme/004 | 5 +- tests/nvme/005 | 2 +- tests/nvme/008 | 4 +- tests/nvme/009 | 4 +- tests/nvme/010 | 11 ++-- tests/nvme/011 | 11 ++-- tests/nvme/012 | 13 ++-- tests/nvme/013 | 13 ++-- tests/nvme/014 | 17 +++-- tests/nvme/015 | 17 +++-- tests/nvme/018 | 20 +++--- tests/nvme/019 | 13 ++-- tests/nvme/020 | 12 ++-- tests/nvme/021 | 11 ++-- tests/nvme/022 | 4 +- tests/nvme/023 | 11 ++-- tests/nvme/024 | 12 ++-- tests/nvme/025 | 11 ++-- tests/nvme/026 | 11 ++-- tests/nvme/027 | 4 +- tests/nvme/028 | 9 +-- tests/nvme/029 | 10 +-- tests/nvme/031 | 14 ++-- tests/nvme/035 | 4 +- tests/nvme/040 | 6 +- tests/nvme/041 | 13 ++-- tests/nvme/042 | 14 ++-- tests/nvme/043 | 14 ++-- tests/nvme/044 | 28 +++----- tests/nvme/045 | 17 ++--- tests/nvme/046 | 7 +- tests/nvme/047 | 16 ++--- tests/nvme/048 | 9 +-- tests/nvme/rc | 170 +++++++++++++++++++++++++++++++++---------------- 36 files changed, 282 insertions(+), 268 deletions(-)
Signature · 1 line
2.44.0
PATCH 1/18 nvme/rc: silence error on module unload for fc
The other transports silence the error output when trying to unload the module. Do the same for FC.
--- tests/nvme/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/nvme/rc +1 -1
@@ -332,7 +332,7 @@ _cleanup_nvmet() { if [[ "${nvme_trtype}" == "fc" ]]; then _cleanup_fcloop "${def_local_wwnn}" "${def_local_wwpn}" \ "${def_remote_wwnn}" "${def_remote_wwpn}" - modprobe -rq nvme-fcloop + modprobe -rq nvme-fcloop 2>/dev/null fi modprobe -rq nvme-"${nvme_trtype}" 2>/dev/null if [[ "${nvme_trtype}" != "loop" ]]; then
Signature · 1 line
2.44.0
PATCH 10/18 nvme/rc: remove unused connect options
In reply to Daniel WagnerThese options are not used, thus remove them.
--- tests/nvme/rc | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
tests/nvme/rc +2 -17
@@ -410,9 +410,6 @@ _nvme_connect_subsys() { local positional_args=() local trtype="" local subsysnqn="" - local traddr="$def_traddr" - local host_traddr="$def_host_traddr" - local trsvcid="$def_trsvcid" local hostnqn="$def_hostnqn" local hostid="$def_hostid" local hostkey=""
@@ -428,18 +425,6 @@ _nvme_connect_subsys() { while [[ $# -gt 0 ]]; do case $1 in - --traddr) - traddr="$2" - shift 2 - ;; - --host-traddr) - host_traddr="$2" - shift 2 - ;; - --trsvcid) - trsvcid="$2" - shift 2 - ;; --hostnqn) hostnqn="$2" shift 2
@@ -498,9 +483,9 @@ _nvme_connect_subsys() { ARGS=(--transport "${trtype}" --nqn "${subsysnqn}") if [[ "${trtype}" == "fc" ]] ; then - ARGS+=(--traddr "${traddr}" --host-traddr "${host_traddr}") + ARGS+=(--traddr "${def_traddr}" --host-traddr "${def_host_traddr}") elif [[ "${trtype}" != "loop" ]]; then - ARGS+=(--traddr "${traddr}" --trsvcid "${trsvcid}") + ARGS+=(--traddr "${def_traddr}" --trsvcid "${def_trsvcid}") fi ARGS+=(--hostnqn="${hostnqn}") ARGS+=(--hostid="${hostid}")
Signature · 1 line
2.44.0
PATCH 11/18 nvme/rc: remove correct port from target
In reply to Daniel WagnerRemove the port from the subsystem the test wants to remove.
--- tests/nvme/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tests/nvme/rc +1 -1
@@ -869,7 +869,7 @@ _nvmet_target_cleanup() { esac done - _get_nvmet_ports "${def_subsysnqn}" ports + _get_nvmet_ports "${subsysnqn}" ports for port in "${ports[@]}"; do _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}"
Signature · 1 line
2.44.0
PATCH 3/18 nvme/rc: log error if stale configuration is found
In reply to Daniel WagnerIt's possible that a previous run of blktest left some stale configuration left. E.g. when the module unload doesn't work (the bug might in the kernel we are testing). In this case error out and avoid confusion.
--- tests/nvme/rc | 5 +++++ 1 file changed, 5 insertions(+)
tests/nvme/rc +5 -0
@@ -658,6 +658,11 @@ _create_nvmet_host() { local nvmet_ctrlkey="$4" local host_path="${NVMET_CFS}/hosts/${nvmet_hostnqn}" + if [[ -d "${host_path}" ]]; then + echo "FAIL target setup failed. stale host configuration found" + return 1; + fi + mkdir "${host_path}" _add_nvmet_allow_hosts "${nvmet_subsystem}" "${nvmet_hostnqn}" if [[ "${nvmet_hostkey}" ]] ; then
Signature · 1 line
2.44.0
PATCH 13/18 nvme/{rc,031}: do not cleanup external managed loop device
In reply to Daniel WagnerIf the test setups a loop device itself (not created by _nvmet_target_create), do not cleanup automatically.
--- tests/nvme/031 | 2 +- tests/nvme/rc | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)
tests/nvme/031 +1 -1
@@ -45,7 +45,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys}$i" _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 - _nvmet_target_cleanup --subsysnqn "${subsys}$i" + _nvmet_target_cleanup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}" done _remove_nvmet_port "${port}"
tests/nvme/rc +8 -1
@@ -855,9 +855,14 @@ _nvmet_target_cleanup() { local port local blkdev local subsysnqn="${def_subsysnqn}" + local blkdev_type="" while [[ $# -gt 0 ]]; do case $1 in + --blkdev) + blkdev_type="$2" + shift 2 + ;; --subsysnqn) subsysnqn="$2" shift 2
@@ -878,7 +883,9 @@ _nvmet_target_cleanup() { _remove_nvmet_subsystem "${subsysnqn}" _remove_nvmet_host "${def_hostnqn}" - _cleanup_blkdev + if [[ "${blkdev_type}" == "device" ]]; then + _cleanup_blkdev + fi } _nvmet_passthru_target_setup() {
Signature · 1 line
2.44.0
PATCH 14/18 nvme: drop default trtype argument for _nvmet_connect_subsys
In reply to Daniel WagnerEvery invocation of _nvmet_connect_subsys passes in the default nvme_trtype argument. nvme/rc also assumes the test is always using nvme_trtype for trtype (e.g. cleanup code paths), thus just drop this argument.
--- tests/nvme/003 | 2 +- tests/nvme/004 | 3 +-- tests/nvme/005 | 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/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/031 | 2 +- tests/nvme/040 | 2 +- tests/nvme/041 | 4 ++-- tests/nvme/042 | 4 ++-- tests/nvme/043 | 4 ++-- tests/nvme/044 | 8 ++++---- tests/nvme/045 | 2 +- tests/nvme/047 | 4 ++-- tests/nvme/048 | 2 +- tests/nvme/rc | 10 ++++------ 33 files changed, 43 insertions(+), 46 deletions(-)
tests/nvme/003 +1 -1
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" nqn.2014-08.org.nvmexpress.discovery + _nvme_connect_subsys nqn.2014-08.org.nvmexpress.discovery # This is ugly but checking for the absence of error messages is ... sleep 10
tests/nvme/004 +1 -2
@@ -22,10 +22,9 @@ test() { _setup_nvmet - _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" local nvmedev nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
tests/nvme/005 +1 -1
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
tests/nvme/008 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/009 +1 -1
@@ -23,7 +23,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/010 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/011 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/012 +1 -1
@@ -28,7 +28,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/013 +1 -1
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/014 +1 -1
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/015 +1 -1
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/018 +1 -1
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/019 +1 -1
@@ -26,7 +26,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/020 +1 -1
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/021 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/022 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/023 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/024 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/025 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/026 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/027 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/028 +1 -1
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/029 +1 -1
@@ -58,7 +58,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
tests/nvme/031 +1 -1
@@ -42,7 +42,7 @@ test() { for ((i = 0; i < iterations; i++)); do _nvmet_target_setup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}" - _nvme_connect_subsys "${nvme_trtype}" "${subsys}$i" + _nvme_connect_subsys "${subsys}$i" _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 _nvmet_target_cleanup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}"
tests/nvme/040 +1 -1
@@ -26,7 +26,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" + _nvme_connect_subsys "${def_subsysnqn}" nvmedev=$(_find_nvme_dev "${def_subsysnqn}") # start fio job
tests/nvme/041 +2 -2
@@ -38,7 +38,7 @@ test() { # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}"
@@ -46,7 +46,7 @@ test() { # Test authenticated connection echo "Test authenticated connection" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}"
tests/nvme/042 +2 -2
@@ -41,7 +41,7 @@ test() { fi _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}"
@@ -58,7 +58,7 @@ test() { fi _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}"
tests/nvme/043 +2 -2
@@ -45,7 +45,7 @@ test() { _set_nvmet_hash "${def_hostnqn}" "${hash}" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}"
@@ -59,7 +59,7 @@ test() { _set_nvmet_dhgroup "${def_hostnqn}" "${dhgroup}" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}"
tests/nvme/044 +4 -4
@@ -49,7 +49,7 @@ test() { # Step 1: Connect with host authentication only echo "Test host authentication" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}"
@@ -59,7 +59,7 @@ test() { # Step 2: Connect with host authentication # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \
@@ -70,7 +70,7 @@ test() { # Step 3: Connect with host authentication # and valid ctrl authentication echo "Test valid ctrl authentication" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \
@@ -82,7 +82,7 @@ test() { # and invalid ctrl key echo "Test invalid ctrl key (should fail)" invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \
tests/nvme/045 +1 -1
@@ -51,7 +51,7 @@ test() { _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \
tests/nvme/047 +2 -2
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys \ --nr-write-queues 1 || echo FAIL nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
@@ -37,7 +37,7 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --nr-write-queues 1 \ --nr-poll-queues 1 || echo FAIL
tests/nvme/048 +1 -1
@@ -99,7 +99,7 @@ test() { _nvmet_target_setup --blkdev file if [[ -f "${cfs_path}/attr_qid_max" ]] ; then - _nvme_connect_subsys "${nvme_trtype}" "${def_subsysnqn}" \ + _nvme_connect_subsys "${def_subsysnqn}" \ --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --keep-alive-tmo 1 \
tests/nvme/rc +4 -6
@@ -408,7 +408,6 @@ _nvme_disconnect_subsys() { _nvme_connect_subsys() { local positional_args=() - local trtype="" local subsysnqn="" local hostnqn="$def_hostnqn" local hostid="$def_hostid"
@@ -478,13 +477,12 @@ _nvme_connect_subsys() { set -- "${positional_args[@]}" - trtype="$1" - subsysnqn="$2" + subsysnqn="$1" - ARGS=(--transport "${trtype}" --nqn "${subsysnqn}") - if [[ "${trtype}" == "fc" ]] ; then + ARGS=(--transport "${nvme_trtype}" --nqn "${subsysnqn}") + if [[ "${nvme_trtype}" == "fc" ]] ; then ARGS+=(--traddr "${def_traddr}" --host-traddr "${def_host_traddr}") - elif [[ "${trtype}" != "loop" ]]; then + elif [[ "${nvme_trtype}" != "loop" ]]; then ARGS+=(--traddr "${def_traddr}" --trsvcid "${def_trsvcid}") fi ARGS+=(--hostnqn="${hostnqn}")
Signature · 1 line
2.44.0
PATCH 12/18 nvme/031: do not open code target setup/cleanup
In reply to Daniel WagnerNo need to open code the target setup and cleanup step. Just use the common helper to setup and cleanup the target.
--- tests/nvme/031 | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
tests/nvme/031 +4 -6
@@ -40,14 +40,12 @@ test() { port="$(_create_nvmet_port "${nvme_trtype}")" for ((i = 0; i < iterations; i++)); do - _create_nvmet_subsystem "${subsys}$i" "${loop_dev}" - _add_nvmet_subsys_to_port "${port}" "${subsys}$i" - _create_nvmet_host "${subsys}$i" "${def_hostnqn}" + _nvmet_target_setup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}" + _nvme_connect_subsys "${nvme_trtype}" "${subsys}$i" _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 - _remove_nvmet_subsystem_from_port "${port}" "${subsys}$i" - _remove_nvmet_subsystem "${subsys}$i" - _remove_nvmet_host "${def_hostnqn}" + + _nvmet_target_cleanup --subsysnqn "${subsys}$i" done _remove_nvmet_port "${port}"
Signature · 1 line
2.44.0
PATCH 15/18 nvme: drop default subsysnqn argument from _nvme_{connect|disconnect}_subsys
In reply to Daniel WagnerRemove the last positional argument for _nvme_connect_subsys which most test pass in the default subsysnqn anyway. There is little point in cluttering all the test textual noise.
--- tests/nvme/003 | 4 ++-- tests/nvme/004 | 4 ++-- tests/nvme/005 | 2 +- tests/nvme/008 | 4 ++-- tests/nvme/009 | 4 ++-- tests/nvme/010 | 4 ++-- tests/nvme/011 | 4 ++-- tests/nvme/012 | 4 ++-- tests/nvme/013 | 4 ++-- tests/nvme/014 | 4 ++-- tests/nvme/015 | 4 ++-- tests/nvme/018 | 4 ++-- tests/nvme/019 | 4 ++-- tests/nvme/020 | 4 ++-- tests/nvme/021 | 4 ++-- tests/nvme/022 | 4 ++-- tests/nvme/023 | 4 ++-- tests/nvme/024 | 4 ++-- tests/nvme/025 | 4 ++-- tests/nvme/026 | 4 ++-- tests/nvme/027 | 4 ++-- tests/nvme/028 | 4 ++-- tests/nvme/029 | 4 ++-- tests/nvme/031 | 4 ++-- tests/nvme/040 | 2 +- tests/nvme/041 | 10 ++++------ tests/nvme/042 | 10 ++++------ tests/nvme/043 | 10 ++++------ tests/nvme/044 | 20 ++++++++------------ tests/nvme/045 | 6 ++---- tests/nvme/047 | 4 ++-- tests/nvme/048 | 11 +++++------ tests/nvme/rc | 28 ++++++++++++++++++++-------- 33 files changed, 97 insertions(+), 98 deletions(-)
tests/nvme/003 +2 -2
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys nqn.2014-08.org.nvmexpress.discovery + _nvme_connect_subsys --subsysnqn "nqn.2014-08.org.nvmexpress.discovery" # This is ugly but checking for the absence of error messages is ... sleep 10
@@ -38,7 +38,7 @@ test() { echo "Fail" fi - _nvme_disconnect_subsys nqn.2014-08.org.nvmexpress.discovery + _nvme_disconnect_subsys --subsysnqn "nqn.2014-08.org.nvmexpress.discovery" _nvmet_target_cleanup
tests/nvme/004 +2 -2
@@ -24,13 +24,13 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys local nvmedev nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - _nvme_disconnect_subsys ${def_subsysnqn} + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/005 +1 -1
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}")
tests/nvme/008 +2 -2
@@ -24,12 +24,12 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/009 +2 -2
@@ -23,12 +23,12 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/010 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -32,7 +32,7 @@ test() { _run_fio_verify_io --size="${nvme_img_size}" \ --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/011 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -32,7 +32,7 @@ test() { _run_fio_verify_io --size="${nvme_img_size}" \ --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/012 +2 -2
@@ -28,7 +28,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -37,7 +37,7 @@ test() { echo "FAIL: fio verify failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/013 +2 -2
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -36,7 +36,7 @@ test() { echo "FAIL: fio verify failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/014 +2 -2
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -41,7 +41,7 @@ test() { nvme flush "/dev/${nvmedev}" --namespace-id 1 - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/015 +2 -2
@@ -27,7 +27,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -41,7 +41,7 @@ test() { nvme flush "/dev/${nvmedev}n1" --namespace-id 1 - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/018 +2 -2
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -39,7 +39,7 @@ test() { --block-count 0 --data-size "$bs" &>"$FULL" \ && echo "ERROR: nvme read for out of range LBA was not rejected" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/019 +2 -2
@@ -26,7 +26,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -34,7 +34,7 @@ test() { nvme dsm "/dev/${nvmedev}" --namespace-id 1 --ad \ --slbs "${sblk_range}" --blocks "${nblk_range}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/020 +2 -2
@@ -25,7 +25,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { nvme dsm "/dev/${nvmedev}" --namespace-id 1 --ad \ --slbs "${sblk_range}" --blocks "${nblk_range}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/021 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { echo "ERROR: device not listed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/022 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { echo "ERROR: reset failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/023 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -34,7 +34,7 @@ test() { echo "ERROR: smart-log bdev-ns failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/024 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { >> "$FULL" 2>&1; then echo "ERROR: smart-log file-ns failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/025 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { echo "ERROR: effects-log failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/026 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -34,7 +34,7 @@ test() { echo "ERROR: ns-desc failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/027 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { echo "ERROR: ns-rescan failed" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/028 +2 -2
@@ -24,7 +24,7 @@ test() { _nvmet_target_setup --blkdev file - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -33,7 +33,7 @@ test() { echo "ERROR: list-subsys" fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/029 +2 -2
@@ -58,7 +58,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") _check_uuid "${nvmedev}"
@@ -84,7 +84,7 @@ test() { echo 0 > /proc/sys/vm/nr_hugepages fi - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/031 +2 -2
@@ -42,8 +42,8 @@ test() { for ((i = 0; i < iterations; i++)); do _nvmet_target_setup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}" - _nvme_connect_subsys "${subsys}$i" - _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 + _nvme_connect_subsys --subsysnqn "${subsys}$i" + _nvme_disconnect_subsys --subsysnqn "${subsys}$i" >> "${FULL}" 2>&1 _nvmet_target_cleanup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}" done
tests/nvme/040 +1 -1
@@ -26,7 +26,7 @@ test() { _nvmet_target_setup - _nvme_connect_subsys "${def_subsysnqn}" + _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") # start fio job
tests/nvme/041 +4 -6
@@ -38,20 +38,18 @@ test() { # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys # Test authenticated connection echo "Test authenticated connection" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/042 +4 -6
@@ -41,12 +41,11 @@ test() { fi _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys done for key_len in 32 48 64; do
@@ -58,12 +57,11 @@ test() { fi _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys done _nvmet_target_cleanup
tests/nvme/043 +4 -6
@@ -45,12 +45,11 @@ test() { _set_nvmet_hash "${def_hostnqn}" "${hash}" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys done for dhgroup in "ffdhe2048" "ffdhe3072" "ffdhe4096" "ffdhe6144" "ffdhe8192" ; do
@@ -59,12 +58,11 @@ test() { _set_nvmet_dhgroup "${def_hostnqn}" "${dhgroup}" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys done _nvmet_target_cleanup
tests/nvme/044 +8 -12
@@ -49,46 +49,42 @@ test() { # Step 1: Connect with host authentication only echo "Test host authentication" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys # Step 2: Connect with host authentication # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${hostkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys # Step 3: Connect with host authentication # and valid ctrl authentication echo "Test valid ctrl authentication" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys # 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 "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${invkey}" - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys _nvmet_target_cleanup
tests/nvme/045 +2 -4
@@ -51,8 +51,7 @@ test() { _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ --hostid "${def_hostid}" \ --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}"
@@ -108,8 +107,7 @@ test() { rand_io_size="$(_nvme_calc_rand_io_size 4m)" _run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1" - _nvme_disconnect_subsys "${def_subsysnqn}" - + _nvme_disconnect_subsys "${subsysnqn}" _nvmet_target_cleanup echo "Test complete"
tests/nvme/047 +2 -2
@@ -37,13 +37,13 @@ test() { _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 - _nvme_connect_subsys "${def_subsysnqn}" \ + _nvme_connect_subsys \ --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 "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/048 +5 -6
@@ -99,11 +99,10 @@ test() { _nvmet_target_setup --blkdev file if [[ -f "${cfs_path}/attr_qid_max" ]] ; then - _nvme_connect_subsys "${def_subsysnqn}" \ - --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --keep-alive-tmo 1 \ - --reconnect-delay 2 + _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ + --hostid "${def_hostid}" \ + --keep-alive-tmo 1 \ + --reconnect-delay 2 if ! nvmf_wait_for_state "${def_subsysnqn}" "live" ; then echo FAIL
@@ -112,7 +111,7 @@ test() { set_qid_max "${def_subsysnqn}" 2 || echo FAIL fi - _nvme_disconnect_subsys "${def_subsysnqn}" + _nvme_disconnect_subsys else SKIP_REASONS+=("missing attr_qid_max feature") skipped=true
tests/nvme/rc +20 -8
@@ -400,15 +400,27 @@ _nvme_disconnect_ctrl() { } _nvme_disconnect_subsys() { - local subsysnqn="$1" + local subsysnqn="$def_subsysnqn" + + while [[ $# -gt 0 ]]; do + case $1 in + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + *) + echo "WARNING: unknown argument: $1" + shift + ;; + esac + done nvme disconnect --nqn "${subsysnqn}" |& tee -a "$FULL" | grep -o "disconnected.*" } _nvme_connect_subsys() { - local positional_args=() - local subsysnqn="" + local subsysnqn="$def_subsysnqn" local hostnqn="$def_hostnqn" local hostid="$def_hostid" local hostkey=""
@@ -424,6 +436,10 @@ _nvme_connect_subsys() { while [[ $# -gt 0 ]]; do case $1 in + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; --hostnqn) hostnqn="$2" shift 2
@@ -469,16 +485,12 @@ _nvme_connect_subsys() { shift 1 ;; *) - positional_args+=("$1") + echo "WARNING: unknown argument: $1" shift ;; esac done - set -- "${positional_args[@]}" - - subsysnqn="$1" - ARGS=(--transport "${nvme_trtype}" --nqn "${subsysnqn}") if [[ "${nvme_trtype}" == "fc" ]] ; then ARGS+=(--traddr "${def_traddr}" --host-traddr "${def_host_traddr}")
Signature · 1 line
2.44.0
PATCH 16/18 nvme/{041,042,043,044,045,048}: do not pass default host{nqn|id} to _nvme_connect_subsys
In reply to Daniel WagnerThere is no point in passing the default values to _nvme_connect_subsys, thus drop these arguments.
--- tests/nvme/041 | 7 ++----- tests/nvme/042 | 8 ++------ tests/nvme/043 | 8 ++------ tests/nvme/044 | 16 ++++------------ tests/nvme/045 | 4 +--- tests/nvme/048 | 4 +--- 6 files changed, 12 insertions(+), 35 deletions(-)
tests/nvme/041 +2 -5
@@ -38,16 +38,13 @@ test() { # Test unauthenticated connection (should fail) echo "Test unauthenticated connection (should fail)" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" + _nvme_connect_subsys _nvme_disconnect_subsys # Test authenticated connection echo "Test authenticated connection" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" + _nvme_connect_subsys --dhchap-secret "${hostkey}" _nvme_disconnect_subsys
tests/nvme/042 +2 -6
@@ -41,9 +41,7 @@ test() { fi _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" + _nvme_connect_subsys --dhchap-secret "${hostkey}" _nvme_disconnect_subsys done
@@ -57,9 +55,7 @@ test() { fi _set_nvmet_hostkey "${def_hostnqn}" "${hostkey}" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" + _nvme_connect_subsys --dhchap-secret "${hostkey}" _nvme_disconnect_subsys done
tests/nvme/043 +2 -6
@@ -45,9 +45,7 @@ test() { _set_nvmet_hash "${def_hostnqn}" "${hash}" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" + _nvme_connect_subsys --dhchap-secret "${hostkey}" _nvme_disconnect_subsys done
@@ -58,9 +56,7 @@ test() { _set_nvmet_dhgroup "${def_hostnqn}" "${dhgroup}" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" + _nvme_connect_subsys --dhchap-secret "${hostkey}" _nvme_disconnect_subsys done
tests/nvme/044 +4 -12
@@ -49,18 +49,14 @@ test() { # Step 1: Connect with host authentication only echo "Test host authentication" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" + _nvme_connect_subsys --dhchap-secret "${hostkey}" _nvme_disconnect_subsys # Step 2: Connect with host authentication # and invalid ctrl authentication echo "Test invalid ctrl authentication (should fail)" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" \ + _nvme_connect_subsys --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${hostkey}" _nvme_disconnect_subsys
@@ -68,9 +64,7 @@ test() { # Step 3: Connect with host authentication # and valid ctrl authentication echo "Test valid ctrl authentication" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" \ + _nvme_connect_subsys --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}" _nvme_disconnect_subsys
@@ -79,9 +73,7 @@ test() { # and invalid ctrl key echo "Test invalid ctrl key (should fail)" invkey="DHHC-1:00:Jc/My1o0qtLCWRp+sHhAVafdfaS7YQOMYhk9zSmlatobqB8C:" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" \ + _nvme_connect_subsys --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${invkey}" _nvme_disconnect_subsys
tests/nvme/045 +1 -3
@@ -51,9 +51,7 @@ test() { _set_nvmet_dhgroup "${def_hostnqn}" "ffdhe2048" - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --dhchap-secret "${hostkey}" \ + _nvme_connect_subsys --dhchap-secret "${hostkey}" \ --dhchap-ctrl-secret "${ctrlkey}" echo "Re-authenticate with original host key"
tests/nvme/048 +1 -3
@@ -99,9 +99,7 @@ test() { _nvmet_target_setup --blkdev file if [[ -f "${cfs_path}/attr_qid_max" ]] ; then - _nvme_connect_subsys --hostnqn "${def_hostnqn}" \ - --hostid "${def_hostid}" \ - --keep-alive-tmo 1 \ + _nvme_connect_subsys --keep-alive-tmo 1 \ --reconnect-delay 2 if ! nvmf_wait_for_state "${def_subsysnqn}" "live" ; then
Signature · 1 line
2.44.0
PATCH 8/18 nvme/rc: connect subsys only support long options
In reply to Daniel WagnerThere is no user for the short command line options, thus remove the short options to reduce the parsing overhead.
--- tests/nvme/rc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
tests/nvme/rc +13 -13
@@ -428,55 +428,55 @@ _nvme_connect_subsys() { while [[ $# -gt 0 ]]; do case $1 in - -a|--traddr) + --traddr) traddr="$2" shift 2 ;; - -w|--host-traddr) + --host-traddr) host_traddr="$2" shift 2 ;; - -s|--trsvcid) + --trsvcid) trsvcid="$2" shift 2 ;; - -n|--hostnqn) + --hostnqn) hostnqn="$2" shift 2 ;; - -I|--hostid) + --hostid) hostid="$2" shift 2 ;; - -S|--dhchap-secret) + --dhchap-secret) hostkey="$2" shift 2 ;; - -C|--dhchap-ctrl-secret) + --dhchap-ctrl-secret) ctrlkey="$2" shift 2 ;; - -i|--nr-io-queues) + --nr-io-queues) nr_io_queues="$2" shift 2 ;; - -W|--nr-write-queues) + --nr-write-queues) nr_write_queues="$2" shift 2 ;; - -P|--nr-poll-queues) + --nr-poll-queues) nr_poll_queues="$2" shift 2 ;; - -k|--keep-alive-tmo) + --keep-alive-tmo) keep_alive_tmo="$2" shift 2 ;; - -c|--reconnect-delay) + --reconnect-delay) reconnect_delay="$2" shift 2 ;; - -l|--ctrl-loss-tmo) + --ctrl-loss-tmo) ctrl_loss_tmo="$2" shift 2 ;;
Signature · 1 line
2.44.0
PATCH 17/18 nvme: don't assume namespace id
In reply to Daniel WagnerThe tests assume that the namespace id is always 1. This might not be correct in future (e.g. running real targets), thus harden the test by using the uuid to lookup the correct namespace id.
The passthru test already do this, so it makes also sense to update the other tests as well.
--- tests/nvme/010 | 7 +++---- tests/nvme/011 | 7 +++---- tests/nvme/012 | 7 +++---- tests/nvme/013 | 7 +++---- tests/nvme/014 | 13 ++++++------- tests/nvme/015 | 13 ++++++------- tests/nvme/018 | 15 +++++++-------- tests/nvme/019 | 8 +++----- tests/nvme/020 | 7 +++---- tests/nvme/021 | 7 +++---- tests/nvme/023 | 8 +++----- tests/nvme/024 | 9 ++++----- tests/nvme/025 | 7 +++---- tests/nvme/026 | 8 +++----- tests/nvme/029 | 6 +----- tests/nvme/040 | 4 +++- tests/nvme/045 | 5 +++-- tests/nvme/047 | 10 +++++----- tests/nvme/rc | 18 ++++++++++++++++++ 19 files changed, 83 insertions(+), 83 deletions(-)
tests/nvme/010 +3 -4
@@ -20,17 +20,16 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") _run_fio_verify_io --size="${nvme_img_size}" \ - --filename="/dev/${nvmedev}n1" + --filename="/dev/${ns}" _nvme_disconnect_subsys
tests/nvme/011 +3 -4
@@ -20,17 +20,16 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") _run_fio_verify_io --size="${nvme_img_size}" \ - --filename="/dev/${nvmedev}n1" + --filename="$/dev/{ns}" _nvme_disconnect_subsys
tests/nvme/012 +3 -4
@@ -24,16 +24,15 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - if ! _xfs_run_fio_verify_io "/dev/${nvmedev}n1"; then + if ! _xfs_run_fio_verify_io "/dev/${ns}"; then echo "FAIL: fio verify failed" fi
tests/nvme/013 +3 -4
@@ -23,16 +23,15 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - if ! _xfs_run_fio_verify_io "/dev/${nvmedev}n1"; then + if ! _xfs_run_fio_verify_io "$/dev/{ns}"; then echo "FAIL: fio verify failed" fi
tests/nvme/014 +6 -7
@@ -20,7 +20,7 @@ test() { _setup_nvmet - local nvmedev + local ns local size local bs local count
@@ -29,17 +29,16 @@ test() { _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - size="$(blockdev --getsize64 "/dev/${nvmedev}n1")" - bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + size="$(blockdev --getsize64 "/dev/${ns}")" + bs="$(blockdev --getbsz "/dev/${ns}")" count=$((size / bs)) - dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + dd if=/dev/urandom of="$/dev/{ns}" \ count="${count}" bs="${bs}" status=none - nvme flush "/dev/${nvmedev}" --namespace-id 1 + nvme flush "/dev/${ns}" _nvme_disconnect_subsys
tests/nvme/015 +6 -7
@@ -20,7 +20,7 @@ test() { _setup_nvmet - local nvmedev + local ns local size local bs local count
@@ -29,17 +29,16 @@ test() { _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - size="$(blockdev --getsize64 "/dev/${nvmedev}n1")" - bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + size="$(blockdev --getsize64 "/dev/${ns}")" + bs="$(blockdev --getbsz "/dev/${ns}")" count=$((size / bs)) - dd if=/dev/urandom of="/dev/${nvmedev}n1" \ + dd if=/dev/urandom of="/dev/${ns}" \ count="${count}" bs="${bs}" status=none - nvme flush "/dev/${nvmedev}n1" --namespace-id 1 + nvme flush "/dev/${ns}" _nvme_disconnect_subsys
tests/nvme/018 +7 -8
@@ -21,21 +21,20 @@ test() { _setup_nvmet - local nvmedev + local ns + local sectors + local bs _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - local sectors - local bs - sectors="$(blockdev --getsz "/dev/${nvmedev}n1")" - bs="$(blockdev --getbsz "/dev/${nvmedev}n1")" + sectors="$(blockdev --getsz "/dev/${ns}")" + bs="$(blockdev --getbsz "/dev/${ns}")" - nvme read "/dev/${nvmedev}n1" --start-block "$sectors" \ + nvme read "/dev/${ns}" --start-block "$sectors" \ --block-count 0 --data-size "$bs" &>"$FULL" \ && echo "ERROR: nvme read for out of range LBA was not rejected"
tests/nvme/019 +3 -5
@@ -20,7 +20,7 @@ test() { _setup_nvmet - local nvmedev + local ns 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"
@@ -28,10 +28,8 @@ test() { _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" - - nvme dsm "/dev/${nvmedev}" --namespace-id 1 --ad \ + ns=$(_find_nvme_ns "${def_subsys_uuid}") + nvme dsm "/dev/${ns}" --ad \ --slbs "${sblk_range}" --blocks "${nblk_range}" _nvme_disconnect_subsys
tests/nvme/020 +3 -4
@@ -19,7 +19,7 @@ test() { _setup_nvmet - local nvmedev + local ns 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"
@@ -27,10 +27,9 @@ test() { _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - nvme dsm "/dev/${nvmedev}" --namespace-id 1 --ad \ + nvme dsm "/dev/${ns}" --ad \ --slbs "${sblk_range}" --blocks "${nblk_range}" _nvme_disconnect_subsys
tests/nvme/021 +3 -4
@@ -20,16 +20,15 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - if ! nvme list 2>> "$FULL" | grep -q "${nvmedev}n1"; then + if ! nvme list 2>> "$FULL" | grep -q "/dev/${ns}"; then echo "ERROR: device not listed" fi
tests/nvme/023 +3 -5
@@ -20,17 +20,15 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - if ! nvme smart-log "/dev/${nvmedev}" --namespace-id 1 \ - >> "$FULL" 2>&1; then + if ! nvme smart-log "/dev/${ns}" >> "$FULL" 2>&1; then echo "ERROR: smart-log bdev-ns failed" fi
tests/nvme/024 +4 -5
@@ -20,19 +20,18 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns ${def_subsys_uuid}) - if ! nvme smart-log "/dev/${nvmedev}" --namespace-id 1 \ - >> "$FULL" 2>&1; then + if ! nvme smart-log "/dev/${ns}" >> "$FULL" 2>&1; then echo "ERROR: smart-log file-ns failed" fi + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvmet_target_cleanup
tests/nvme/025 +3 -4
@@ -20,16 +20,15 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - if ! nvme effects-log "/dev/${nvmedev}" >> "$FULL" 2>&1; then + if ! nvme effects-log "/dev/${ns}" >> "$FULL" 2>&1; then echo "ERROR: effects-log failed" fi
tests/nvme/026 +3 -5
@@ -20,17 +20,15 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}") - if ! nvme ns-descs "/dev/${nvmedev}" --namespace-id 1 \ - >> "$FULL" 2>&1; then + if ! nvme ns-descs "/dev/${ns}" >> "$FULL" 2>&1; then echo "ERROR: ns-desc failed" fi
tests/nvme/029 +1 -5
@@ -53,16 +53,12 @@ test() { _setup_nvmet - local nvmedev local reset_nr_hugepages=false _nvmet_target_setup _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" - # nvme-cli may fail to allocate linear memory for rather large IO buffers. # Increase nr_hugepages to allow nvme-cli to try the linear memory allocation # from HugeTLB pool.
@@ -72,7 +68,7 @@ test() { reset_nr_hugepages=true fi - local dev="/dev/${nvmedev}n1" + local dev="/dev/$(_find_nvme_ns "${def_subsys_uuid}")" test_user_io "$dev" 1 512 > "$FULL" 2>&1 || echo FAIL test_user_io "$dev" 1 511 > "$FULL" 2>&1 || echo FAIL test_user_io "$dev" 1 513 > "$FULL" 2>&1 || echo FAIL
tests/nvme/040 +3 -1
@@ -23,15 +23,17 @@ test() { local nvmedev local fio_pid + local ns _nvmet_target_setup _nvme_connect_subsys nvmedev=$(_find_nvme_dev "${def_subsysnqn}") + ns=$(_find_nvme_ns "${def_subsys_uuid}") # start fio job echo "starting background fio" - _run_fio_rand_io --filename="/dev/${nvmedev}n1" \ + _run_fio_rand_io --filename="/dev/${ns}" \ --group_reporting --ramp_time=5 \ --time_based --runtime=1d &> /dev/null & fio_pid=$!
tests/nvme/045 +3 -2
@@ -33,6 +33,7 @@ test() { local new_ctrlkey local ctrldev local rand_io_size + local ns hostkey="$(nvme gen-dhchap-key -n ${def_subsysnqn} 2> /dev/null)" if [ -z "$hostkey" ] ; then
@@ -100,10 +101,10 @@ test() { echo "${new_hostkey}" > "${hostkey_file}" - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") + ns=$(_find_nvme_ns "${def_subsys_uuid}") rand_io_size="$(_nvme_calc_rand_io_size 4m)" - _run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${nvmedev}n1" + _run_fio_rand_io --size="${rand_io_size}" --filename="/dev/${ns}" _nvme_disconnect_subsys "${subsysnqn}" _nvmet_target_cleanup
tests/nvme/047 +5 -5
@@ -22,7 +22,7 @@ test() { _setup_nvmet - local nvmedev + local ns local rand_io_size _nvmet_target_setup
@@ -30,18 +30,18 @@ test() { _nvme_connect_subsys \ --nr-write-queues 1 || echo FAIL - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") + ns=$(_find_nvme_ns "${def_subsys_uuid}") rand_io_size="$(_nvme_calc_rand_io_size 4M)" - _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" + _run_fio_rand_io --filename="/dev/${ns}" --size="${rand_io_size}" - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1 _nvme_connect_subsys \ --nr-write-queues 1 \ --nr-poll-queues 1 || echo FAIL - _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" + _run_fio_rand_io --filename="/dev/${ns}" --size="${rand_io_size}" _nvme_disconnect_subsys >> "$FULL" 2>&1
tests/nvme/rc +18 -0
@@ -797,6 +797,24 @@ _find_nvme_dev() { done } +_find_nvme_ns() { + local subsys_uuid=$1 + local uuid + local ns + + for ns in "/sys/block/nvme"* ; do + # ignore nvme channel block devices + if ! [[ "${ns}" =~ nvme[0-9]+n[0-9]+ ]]; then + continue + fi + [ -e "${ns}/uuid" ] || continue + uuid=$(cat "${ns}/uuid") + if [[ "${subsys_uuid}" == "${uuid}" ]]; then + echo "$(basename ${ns})" + fi + done +} + _find_nvme_passthru_loop_dev() { local subsys=$1 local nsid
Signature · 1 line
2.44.0
PATCH 18/18 nvme/028: drop unused nvmedev
In reply to Daniel WagnerNothing uses nvmedev, so just remove it.
--- tests/nvme/028 | 5 ----- 1 file changed, 5 deletions(-)
tests/nvme/028 +0 -5
@@ -20,15 +20,10 @@ test() { _setup_nvmet - local nvmedev - _nvmet_target_setup --blkdev file _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" - if ! nvme list-subsys 2>> "$FULL" | grep -q "${nvme_trtype}"; then echo "ERROR: list-subsys" fi
Signature · 1 line
2.44.0
PATCH 9/18 nvme/rc: add nqn/uuid args to target setup/cleanup helper
In reply to Daniel WagnerMake these helper a bit more flexible, so that the caller can setup not just the default subsysnqn.
--- tests/nvme/rc | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)
tests/nvme/rc +30 -6
@@ -817,6 +817,8 @@ _nvmet_target_setup() { local blkdev local ctrlkey="" local hostkey="" + local subsysnqn="${def_subsysnqn}" + local subsys_uuid="${def_subsys_uuid}" local port while [[ $# -gt 0 ]]; do
@@ -833,6 +835,14 @@ _nvmet_target_setup() { hostkey="$2" shift 2 ;; + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + --subsys-uuid) + subsys_uuid="$2" + shift 2 + ;; *) echo "WARNING: unknown argument: $1" shift
@@ -847,11 +857,11 @@ _nvmet_target_setup() { blkdev="$(_nvme_def_file_path)" fi - _create_nvmet_subsystem "${def_subsysnqn}" "${blkdev}" \ - "${def_subsys_uuid}" + _create_nvmet_subsystem "${subsysnqn}" "${blkdev}" \ + "${subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ + _add_nvmet_subsys_to_port "${port}" "${subsysnqn}" + _create_nvmet_host "${subsysnqn}" "${def_hostnqn}" \ "${hostkey}" "${ctrlkey}" }
@@ -859,14 +869,28 @@ _nvmet_target_cleanup() { local ports local port local blkdev + local subsysnqn="${def_subsysnqn}" + + while [[ $# -gt 0 ]]; do + case $1 in + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + *) + echo "WARNING: unknown argument: $1" + shift + ;; + esac + done _get_nvmet_ports "${def_subsysnqn}" ports for port in "${ports[@]}"; do - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}" _remove_nvmet_port "${port}" done - _remove_nvmet_subsystem "${def_subsysnqn}" + _remove_nvmet_subsystem "${subsysnqn}" _remove_nvmet_host "${def_hostnqn}" _cleanup_blkdev
Signature · 1 line
2.44.0
Re: [PATCH blktests v1 02/18] nvme/rc: silence fcloop cleanup failures
In reply to Daniel WagnerQuoted 19 lines · Daniel Wagner
When the ctl file is missing we are logging
tests/nvme/rc: line 265:
/sys/class/fcloop/ctl/del_target_port: No such file or directory tests/nvme/rc: line 257:/sys/class/fcloop/ctl/del_local_port: No such file or directory tests/nvme/rc: line 249:/sys/class/fcloop/ctl/del_remote_port: No such file or directorybecause the first redirect operator fails. Thus first check if the ctl file exists.
Signed-off-by Daniel Wagner <[email protected]>--- tests/nvme/rc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)tests/nvme/rc +0
-0
tests/nvme/rc _nvme_fcloop_del_rport() { · line 237
Quoted 5 lines
tests/nvme/rc +1
-1@@ -234,7 +234,10 @@ _nvme_fcloop_del_rport() { local remote_wwpn="$4" local loopctl=/sys/class/fcloop/ctl - echo "wwnn=${remote_wwnn},wwpn=${remote_wwpn}" > ${loopctl}/del_remote_port 2> /dev/null + if [[ ! -f "${loopctrl}" ]]; then
This should be ${loopctl}, obviously. Same for the other changes.
Re: [PATCH blktests v1 17/18] nvme: don't assume namespace id
In reply to Daniel WagnerOn Thu, Mar 21, 2024 at 10:47:26AM +0100, Daniel Wagner wrote:
--- a/tests/nvme/029
Quoted 19 lines
+++ b/tests/nvme/029
tests/nvme/029 +0
-4@@ -53,16 +53,12 @@ test() { _setup_nvmet - local nvmedev local reset_nr_hugepages=false _nvmet_target_setup _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" - # nvme-cli may fail to allocate linear memory for rather large IO buffers. # Increase nr_hugepages to allow nvme-cli to try the linear memory allocation # from HugeTLB pool.
tests/nvme/029 test() { · line 71
Quoted 5 lines
tests/nvme/029 +1
-1@@ -72,7 +68,7 @@ test() { reset_nr_hugepages=true fi - local dev="/dev/${nvmedev}n1" + local dev="/dev/$(_find_nvme_ns "${def_subsys_uuid}")"
make check complains here, the declaration and assignment should be a separate step. I've fixed this up
Quoted 4 lines
tests/nvme/rc +4
-0+_find_nvme_ns() { + local subsys_uuid=$1 + local uuid + local ns
tests/nvme/rc _find_nvme_dev() { · line 813
Quoted 10 lines
tests/nvme/rc +10
-0+ + for ns in "/sys/block/nvme"* ; do + # ignore nvme channel block devices + if ! [[ "${ns}" =~ nvme[0-9]+n[0-9]+ ]]; then + continue + fi + [ -e "${ns}/uuid" ] || continue + uuid=$(cat "${ns}/uuid") + if [[ "${subsys_uuid}" == "${uuid}" ]]; then + echo "$(basename ${ns})"
The echo is not necessary, I've dropped it.
Re: [PATCH blktests v1 02/18] nvme/rc: silence fcloop cleanup failures
In reply to Daniel WagnerQuoted 23 lines · Daniel Wagner
Quoted 22 lines · Daniel Wagner
When the ctl file is missing we are logging
tests/nvme/rc: line 265:
/sys/class/fcloop/ctl/del_target_port: No such file or directory tests/nvme/rc: line 257:/sys/class/fcloop/ctl/del_local_port: No such file or directory tests/nvme/rc: line 249:/sys/class/fcloop/ctl/del_remote_port: No such file or directorybecause the first redirect operator fails. Thus first check if the ctl file exists.
Signed-off-by Daniel Wagner <[email protected]>--- tests/nvme/rc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)tests/nvme/rc +0
-0@@ -234,7 +234,10 @@ _nvme_fcloop_del_rport() { local remote_wwpn="$4" local loopctl=/sys/class/fcloop/ctl
Quoted 4 lines
tests/nvme/rc _nvme_fcloop_del_rport() { · line 237
Quoted 2 lines
tests/nvme/rc +1
-1- echo "wwnn=${remote_wwnn},wwpn=${remote_wwpn}" > ${loopctl}/del_remote_port 2> /dev/null + if [[ ! -f "${loopctrl}" ]]; thenThis should be ${loopctl}, obviously. Same for the other changes.
I see. BTW, I think the "-f" above should be "-d", since I think ${loopctl} is a directory.
Re: [PATCH blktests v1 09/18] nvme/rc: add nqn/uuid args to target setup/cleanup helper
In reply to Daniel WagnerQuoted 62 lines · Daniel Wagner
Make these helper a bit more flexible, so that the caller can setup not just the default subsysnqn.
Signed-off-by Daniel Wagner <[email protected]>--- tests/nvme/rc | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-)tests/nvme/rc +20
-4@@ -817,6 +817,8 @@ _nvmet_target_setup() { local blkdev local ctrlkey="" local hostkey="" + local subsysnqn="${def_subsysnqn}" + local subsys_uuid="${def_subsys_uuid}" local port while [[ $# -gt 0 ]]; do@@ -833,6 +835,14 @@ _nvmet_target_setup() { hostkey="$2" shift 2 ;; + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + --subsys-uuid) + subsys_uuid="$2" + shift 2 + ;; *) echo "WARNING: unknown argument: $1" shift@@ -847,11 +857,11 @@ _nvmet_target_setup() { blkdev="$(_nvme_def_file_path)" fi - _create_nvmet_subsystem "${def_subsysnqn}" "${blkdev}" \ - "${def_subsys_uuid}" + _create_nvmet_subsystem "${subsysnqn}" "${blkdev}" \ + "${subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ + _add_nvmet_subsys_to_port "${port}" "${subsysnqn}" + _create_nvmet_host "${subsysnqn}" "${def_hostnqn}" \ "${hostkey}" "${ctrlkey}" }@@ -859,14 +869,28 @@ _nvmet_target_cleanup() { local ports local port local blkdev + local subsysnqn="${def_subsysnqn}" + + while [[ $# -gt 0 ]]; do + case $1 in + --subsysnqn) + subsysnqn="$2"
tests/nvme/rc _nvmet_target_cleanup() { · line 887
Quoted 10 lines
tests/nvme/rc +8
-0+ shift 2 + ;; + *) + echo "WARNING: unknown argument: $1" + shift + ;; + esac + done _get_nvmet_ports "${def_subsysnqn}" ports
Don't we need to replace the def_subsysnqn above with subsysnqn?
Quoted 14 lines
tests/nvme/rc +2
-2for port in "${ports[@]}"; do - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}" _remove_nvmet_port "${port}" done - _remove_nvmet_subsystem "${def_subsysnqn}" + _remove_nvmet_subsystem "${subsysnqn}" _remove_nvmet_host "${def_hostnqn}" _cleanup_blkdevSignature · 1 line
2.44.0
Re: [PATCH blktests v1 11/18] nvme/rc: remove correct port from target
In reply to Daniel WagnerQuoted 3 lines · Daniel Wagner
Remove the port from the subsystem the test wants to remove.
Fixes a12281b8320f ("nvme: introduce nvmet_target_{setup/cleanup} common code")
I'm not sure if this Fixes tag is correct. IIUC, the change in this patch is a missed hank in the 9th patch.
Quoted 21 lines
Signed-off-by Daniel Wagner <[email protected]>--- tests/nvme/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tests/nvme/rc +1
-1@@ -869,7 +869,7 @@ _nvmet_target_cleanup() { esac done - _get_nvmet_ports "${def_subsysnqn}" ports + _get_nvmet_ports "${subsysnqn}" ports for port in "${ports[@]}"; do _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}"Signature · 1 line
2.44.0
Re: [PATCH blktests v1 13/18] nvme/{rc,031}: do not cleanup external managed loop device
In reply to Daniel WagnerQuoted 2 lines · Daniel Wagner
If the test setups a loop device itself (not created by
_nvmet_target_create), do not cleanup automatically.
I couldn't find _nvmet_target_create(). Do you mean _nvmet_target_setup()?
This patch looks fixing an issue caused by the previous patch. If this guess is correct, it might be a bit better to reorder this patch and the previous one.
Quoted 53 lines
Signed-off-by Daniel Wagner <[email protected]>--- tests/nvme/031 | 2 +- tests/nvme/rc | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-)tests/nvme/031 +1
-1@@ -45,7 +45,7 @@ test() { _nvme_connect_subsys "${nvme_trtype}" "${subsys}$i" _nvme_disconnect_subsys "${subsys}$i" >> "${FULL}" 2>&1 - _nvmet_target_cleanup --subsysnqn "${subsys}$i" + _nvmet_target_cleanup --subsysnqn "${subsys}$i" --blkdev "${loop_dev}" done _remove_nvmet_port "${port}"tests/nvme/rc +8
-1@@ -855,9 +855,14 @@ _nvmet_target_cleanup() { local port local blkdev local subsysnqn="${def_subsysnqn}" + local blkdev_type="" while [[ $# -gt 0 ]]; do case $1 in + --blkdev) + blkdev_type="$2" + shift 2 + ;; --subsysnqn) subsysnqn="$2" shift 2@@ -878,7 +883,9 @@ _nvmet_target_cleanup() { _remove_nvmet_subsystem "${subsysnqn}" _remove_nvmet_host "${def_hostnqn}" - _cleanup_blkdev + if [[ "${blkdev_type}" == "device" ]]; then + _cleanup_blkdev + fi } _nvmet_passthru_target_setup() {Signature · 1 line
2.44.0
Re: [PATCH blktests v1 14/18] nvme: drop default trtype argument for _nvmet_connect_subsys
In reply to Daniel WagnerQuoted 4 lines · Daniel Wagner
Every invocation of
_nvmet_connect_subsyspasses in the defaultnvme_trtypeargument. nvme/rc also assumes the test is always usingnvme_trtypefor trtype (e.g. cleanup code paths), thus just drop this argument.
It looks one _nvme_connect_subsys() call in _nvmet_passthru_target_connect() in tests/nvme/rc is left as it is.
Re: [PATCH blktests v1 15/18] nvme: drop default subsysnqn argument from _nvme_{connect|disconnect}_subsys
In reply to Daniel WagnerQuoted 3 lines · Daniel Wagner
Remove the last positional argument for
_nvme_connect_subsyswhich most test pass in the default subsysnqn anyway. There is little point in cluttering all the test textual noise.
Same comment as the previous patch. One _nvme_connect_subsys() call in nvme/rc looks missing the modification.
Re: [PATCH blktests v1 17/18] nvme: don't assume namespace id
In reply to Daniel WagnerQuoted 38 lines · Daniel Wagner
The tests assume that the namespace id is always 1. This might not be correct in future (e.g. running real targets), thus harden the test by using the uuid to lookup the correct namespace id.
The passthru test already do this, so it makes also sense to update the other tests as well.
Signed-off-by Daniel Wagner <[email protected]>--- tests/nvme/010 | 7 +++---- tests/nvme/011 | 7 +++---- tests/nvme/012 | 7 +++---- tests/nvme/013 | 7 +++---- tests/nvme/014 | 13 ++++++------- tests/nvme/015 | 13 ++++++------- tests/nvme/018 | 15 +++++++-------- tests/nvme/019 | 8 +++----- tests/nvme/020 | 7 +++---- tests/nvme/021 | 7 +++---- tests/nvme/023 | 8 +++----- tests/nvme/024 | 9 ++++----- tests/nvme/025 | 7 +++---- tests/nvme/026 | 8 +++----- tests/nvme/029 | 6 +----- tests/nvme/040 | 4 +++- tests/nvme/045 | 5 +++-- tests/nvme/047 | 10 +++++----- tests/nvme/rc | 18 ++++++++++++++++++ 19 files changed, 83 insertions(+), 83 deletions(-)tests/nvme/010 +0
-0@@ -20,17 +20,16 @@ test() { _setup_nvmet
tests/nvme/010 test() { · line 29
Quoted 10 lines
tests/nvme/010 +2
-3- local nvmedev + local ns _nvmet_target_setup _nvme_connect_subsys - nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}")
Currently, _check_uuid() compares the uuid with wwid. On the other hand, the modified _find_nvme_ns() does not refer wwid. This looks a relax of test condition. Do you think this relax is fine?
Quoted 7 lines
tests/nvme/010 +1
-1_run_fio_verify_io --size="${nvme_img_size}" \ - --filename="/dev/${nvmedev}n1" + --filename="/dev/${ns}" _nvme_disconnect_subsys
[...]
Quoted 16 lines
tests/nvme/047 +1
-1@@ -22,7 +22,7 @@ test() { _setup_nvmet - local nvmedev + local ns local rand_io_size _nvmet_target_setup@@ -30,18 +30,18 @@ test() { _nvme_connect_subsys \ --nr-write-queues 1 || echo FAIL
tests/nvme/047 test() { · line 38
Quoted 10 lines
tests/nvme/047 +3
-3- nvmedev=$(_find_nvme_dev "${def_subsysnqn}") + ns=$(_find_nvme_ns "${def_subsys_uuid}") rand_io_size="$(_nvme_calc_rand_io_size 4M)" - _run_fio_rand_io --filename="/dev/${nvmedev}n1" --size="${rand_io_size}" + _run_fio_rand_io --filename="/dev/${ns}" --size="${rand_io_size}" - _nvme_disconnect_subsys "${def_subsysnqn}" >> "$FULL" 2>&1 + _nvme_disconnect_subsys >> "$FULL" 2>&1
This change above looks different from the purpose of this patch. It should move to one of the previous patches, probably.
Quoted 3 lines · Daniel Wagner
While working on two new features I collected a bunch of patches which I think make sense to review and merge them indepenedly. And I got a few more ideas for refactoring and cleanups. But one step after the other.
Overall, the patches in this series look reasonable for me. Most of them are part of the RFC series for the real target support, so it's good to have this series for separate review.
I made some nit review comments on the patches. I will do trial runs after v2 comes out. Thanks!
Re: [PATCH blktests v1 17/18] nvme: don't assume namespace id
In reply to Shinichiro KawasakiQuoted 13 lines · Shinichiro Kawasaki
--- a/tests/nvme/010
Quoted 12 lines
+++ b/tests/nvme/010
tests/nvme/010 +1
-1@@ -20,17 +20,16 @@ test() { _setup_nvmet - local nvmedev + local ns _nvmet_target_setup _nvme_connect_subsys
Quoted 7 lines
tests/nvme/010 test() { · line 29
Quoted 3 lines
tests/nvme/010 +1
-2- nvmedev=$(_find_nvme_dev "${def_subsysnqn}") - _check_uuid "${nvmedev}" + ns=$(_find_nvme_ns "${def_subsys_uuid}")Currently,
_check_uuid()compares the uuid with wwid. On the other hand, the modified_find_nvme_ns()does not refer wwid. This looks a relax of test condition. Do you think this relax is fine?
We still have the _check_uuid in nvme/008 and nvme/009, so while drop this part here it is still tested. I think we should try to make the tests as slim as possible, which includes the removal duplicate tests snippets. I think it is important to keep an eye on the runtime of each test.
Quoted 11 lines · Shinichiro Kawasaki
Quoted 3 lines · Daniel Wagner
While working on two new features I collected a bunch of patches which I think make sense to review and merge them indepenedly. And I got a few more ideas for refactoring and cleanups. But one step after the other.
Overall, the patches in this series look reasonable for me. Most of them are part of the RFC series for the real target support, so it's good to have this series for separate review.
I made some nit review comments on the patches. I will do trial runs after v2 comes out. Thanks!
Thanks for reviewing. I'm updating the series according your feedback. I avoid sending 'ok' to every point you made, because you are right every single time :)