Add support to run against real target
Subsystems (2)
RFC 1/10 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
RFC 2/10 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
RFC 3/10 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
@@ -160,7 +160,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
@@ -408,13 +408,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.*" }
@@ -508,11 +508,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}")
@@ -578,13 +578,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
cover Add support to run against real target
As preperation for the planed discussion during LSFMM on
- running blktest against real hardare/target[1]
I've played a bit around with this idea. It was fairly simple to get it going, because all the NVMEeoF tests use the common setup/cleanup helpers and allow an external script to run instead. I've wrote a simple Python script, which then forwards the setup/cleanup requests to nvmetcli with Hannes' rpc changes [2].
Thus, I still run blktests against a Linux soft target over TCP. This already uncovered an issue with xfs formatted disk. The test passes if the disk formatted with btrfs. It seems worthwhile to extend these tests, as it is able detect new problems:
Running nvme/012
umount: /mnt/blktests: not mounted.
meta-data=/dev/nvme0n1 isize=512 agcount=4, agsize=327680 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=1 bigtime=1 inobtcount=1 nrext64=1
data = bsize=4096 blocks=1310720, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0 Discarding blocks...Done.
mount: /mnt/blktests: mount(2) system call failed: Structure needs cleaning.
dmesg(1) may have more information after failed mount system call.
With btrfs:
Running nvme/012
umount: /mnt/blktests: not mounted. btrfs-progs v6.7
See https://btrfs.readthedocs.io for more information.
Performing full device TRIM /dev/nvme0n1 (5.00GiB) ...
NOTE: several default settings have changed in version 5.15, please make sure
this does not affect your deployments:
- DUP for metadata (-m dup)
- enabled no-holes (-O no-holes)
- enabled free-space-tree (-R free-space-tree)
Label: (null)
UUID: 7f0e210f-907b-4b87-9a98-fab0d9d60c56
Node size: 16384
Sector size: 4096
Filesystem size: 5.00GiB
Block group profiles:
Data: single 8.00MiB
Metadata: DUP 256.00MiB
System: DUP 8.00MiB
SSD detected: yes
Zoned device: no
Incompat features: extref, skinny-metadata, no-holes, free-space-tree
Runtime features: free-space-tree
Checksum: crc32c
Number of devices: 1 Devices:
ID SIZE PATH
1 5.00GiB /dev/nvme0n1
I am still running a bit older verion of the kernel (v6.8-rc3); this might be fixed already.
nvme/002 (create many subsystems and test discovery) [not run]
nvme_trtype=tcp is not supported in this test
nvme/003 (test if we're sending keep-alives to a discovery controller) [passed]
runtime 12.696s ... 12.943s
nvme/004 (test nvme and nvmet UUID NS descriptors) [passed]
runtime 2.895s ... 2.765s
nvme/005 (reset local loopback target) [passed]
runtime 2.961s ... 2.929s
nvme/006 (create an NVMeOF target with a block device-backed ns) [passed]
runtime 1.389s ... 1.324s
nvme/007 (create an NVMeOF target with a file-backed ns) [passed]
runtime 1.338s ... 1.337s
nvme/008 (create an NVMeOF host with a block device-backed ns) [passed]
runtime 2.797s ... 2.764s
nvme/009 (create an NVMeOF host with a file-backed ns) [passed]
runtime 2.804s ... 2.775s
nvme/010 (run data verification fio job on NVMeOF block device-backed ns) [passed]
runtime 21.120s ... 40.042s
nvme/011 (run data verification fio job on NVMeOF file-backed ns) [passed]
runtime 39.702s ... 40.838s
nvme/012 (run mkfs and data verification fio job on NVMeOF block device-backed ns) [failed]
runtime 157.538s ... 3.170s
--- tests/nvme/012.out 2023-11-28 12:59:52.704838920 +0100
+++ /home/wagi/work/blktests/results/nodev/nvme/012.out.bad 2024-03-18 10:04:38.572222634 +0100
@@ -1,3 +1,4 @@
Running nvme/012
+FAIL: fio verify failed
disconnected 1 controller(s)
Test complete[...]
[1] https://lore.kernel.org/linux-nvme/23fhu43orn5yyi6jytsyez3f3d7liocp4cat5gfswtan33m3au@iyxhcwee6wvk/
[2] https://github.com/hreinecke/nvmetcli/tree/rpc
Daniel Wagner (10):
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: remove unused connect options
nvme/rc: add nqn/uuid args to target setup/cleanup helper nvme/031: do not open code target setup/cleanup
nvme/rc: introduce remote target support
nvme/030: only run against kernel soft target
common/xfs | 9 +++- tests/nvme/012 | 4 +- tests/nvme/013 | 4 +- 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/030 | 1 + tests/nvme/031 | 10 ++-- tests/nvme/035 | 4 +- tests/nvme/045 | 6 +-- tests/nvme/046 | 7 +-- tests/nvme/rc | 142 ++++++++++++++++++++++++++++++++++--------------- 17 files changed, 141 insertions(+), 68 deletions(-)
Signature · 1 line
2.44.0
RFC 4/10 nvme/{014,015,018,019,020,023,024,026,045,046}: use long command line option for nvme
The 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 | 6 +++--- tests/nvme/046 | 7 ++++--- 10 files changed, 21 insertions(+), 14 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 +3 -3
@@ -90,7 +90,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}"
@@ -100,7 +100,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}"
@@ -132,7 +132,7 @@ test() { echo "Renew host key on the controller and force reconnect" - 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}"
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
RFC 5/10 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
@@ -440,55 +440,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
RFC 6/10 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
@@ -422,9 +422,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=""
@@ -440,18 +437,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
@@ -510,9 +495,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
RFC 6/10 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
@@ -422,9 +422,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=""
@@ -440,18 +437,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
@@ -510,9 +495,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
RFC 7/10 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
@@ -823,6 +823,8 @@ _nvmet_target_setup() { local blkdev local ctrlkey="" local hostkey="" + local subsysnqn="${def_subsysnqn}" + local subsys_uuid="${def_subsys_uuid}" local port while [[ $# -gt 0 ]]; do
@@ -839,6 +841,14 @@ _nvmet_target_setup() { hostkey="$2" shift 2 ;; + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + --subsys-uuid) + subsys_uuid="$2" + shift 2 + ;; *) echo "WARNING: unknown argument: $1" shift
@@ -853,11 +863,11 @@ _nvmet_target_setup() { blkdev="$(_nvme_def_file_path)" fi - _create_nvmet_subsystem "${def_subsysnqn}" "${blkdev}" \ - "${def_subsys_uuid}" + _create_nvmet_subsystem "${subsysnqn}" "${blkdev}" \ + "${subsys_uuid}" port="$(_create_nvmet_port "${nvme_trtype}")" - _add_nvmet_subsys_to_port "${port}" "${def_subsysnqn}" - _create_nvmet_host "${def_subsysnqn}" "${def_hostnqn}" \ + _add_nvmet_subsys_to_port "${port}" "${subsysnqn}" + _create_nvmet_host "${subsysnqn}" "${def_hostnqn}" \ "${hostkey}" "${ctrlkey}" }
@@ -865,14 +875,28 @@ _nvmet_target_cleanup() { local ports local port local blkdev + local subsysnqn="${def_subsysnqn}" + + while [[ $# -gt 0 ]]; do + case $1 in + --subsysnqn) + subsysnqn="$2" + shift 2 + ;; + *) + echo "WARNING: unknown argument: $1" + shift + ;; + esac + done _get_nvmet_ports "${def_subsysnqn}" ports for port in "${ports[@]}"; do - _remove_nvmet_subsystem_from_port "${port}" "${def_subsysnqn}" + _remove_nvmet_subsystem_from_port "${port}" "${subsysnqn}" _remove_nvmet_port "${port}" done - _remove_nvmet_subsystem "${def_subsysnqn}" + _remove_nvmet_subsystem "${subsysnqn}" _remove_nvmet_host "${def_hostnqn}" _cleanup_blkdev
Signature · 1 line
2.44.0
RFC 8/10 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
RFC 9/10 nvme/rc: introduce remote target support
In reply to Daniel WagnerMost of the NVMEeoF tests are exercising the host code of the nvme subsystem. There is no real reason not to run these against a real target. We just have to skip the soft target setup and make it possible to setup a remote target.
Because all tests use now the common setup/cleanup helpers we just need to intercept this call and forward it to an external component.
As we already have various nvme variables to setup the target, extend this part with 'nvme_target_control' which is expected to be script which setups the remote target accordingly.
--- tests/nvme/rc | 49 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-)
tests/nvme/rc +44 -5
@@ -7,9 +7,10 @@ . common/rc . common/multipath-over-rdma -def_traddr="127.0.0.1" +def_traddr="${nvme_traddr:-127.0.0.1}" +def_host_traddr="${nvme_host_traddr:-}" def_adrfam="ipv4" -def_trsvcid="4420" +def_trsvcid="${nvme_trsvcid:-4420}" def_remote_wwnn="0x10001100aa000001" def_remote_wwpn="0x20001100aa000001" def_local_wwnn="0x10001100aa000002"
@@ -19,6 +20,7 @@ def_hostnqn="nqn.2014-08.org.nvmexpress:uuid:${def_hostid}" export def_subsysnqn="blktests-subsystem-1" export def_subsys_uuid="91fdba0d-f87b-4c25-b80f-db7be1418b9e" nvme_trtype=${nvme_trtype:-"loop"} +nvme_target_control="${nvme_target_control:-}" nvme_img_size=${nvme_img_size:-"1G"} nvme_num_iter=${nvme_num_iter:-"1000"}
@@ -325,6 +327,10 @@ _cleanup_nvmet() { fi done + if [[ -n "${nvme_target_control}" ]]; then + return + fi + for port in "${NVMET_CFS}"/ports/*; do name=$(basename "${port}") echo "WARNING: Test did not clean up port: ${name}"
@@ -369,11 +375,19 @@ _cleanup_nvmet() { _setup_nvmet() { _register_test_cleanup _cleanup_nvmet + + if [[ -n "${nvme_target_control}" ]]; then + return + fi + modprobe -q nvmet + if [[ "${nvme_trtype}" != "loop" ]]; then modprobe -q nvmet-"${nvme_trtype}" fi + modprobe -q nvme-"${nvme_trtype}" + if [[ "${nvme_trtype}" == "rdma" ]]; then start_soft_rdma for i in $(rdma_network_interfaces)
@@ -391,6 +405,7 @@ _setup_nvmet() { fi done fi + if [[ "${nvme_trtype}" = "fc" ]]; then modprobe -q nvme-fcloop _setup_fcloop "${def_local_wwnn}" "${def_local_wwpn}" \
@@ -819,12 +834,13 @@ _find_nvme_passthru_loop_dev() { } _nvmet_target_setup() { + local subsys_uuid="${def_subsys_uuid}" + local subsysnqn="${def_subsysnqn}" local blkdev_type="device" - local blkdev + local ARGS=() local ctrlkey="" local hostkey="" - local subsysnqn="${def_subsysnqn}" - local subsys_uuid="${def_subsys_uuid}" + local blkdev local port while [[ $# -gt 0 ]]; do
@@ -856,6 +872,22 @@ _nvmet_target_setup() { esac done + if [[ -n "${hostkey}" ]]; then + ARGS+=(--hostkey "${hostkey}") + fi + if [[ -n "${ctrlkey}" ]]; then + ARGS+=(--ctrkey "${ctrlkey}") + fi + + if [[ -n "${nvme_target_control}" ]]; then + eval "${nvme_target_control}" setup \ + --subsysnqn "${subsysnqn}" \ + --subsys-uuid "${subsys_uuid}" \ + --hostnqn "${def_hostnqn}" \ + "${ARGS[@]}" > /dev/null 2>&1 + return + fi + truncate -s "${nvme_img_size}" "$(_nvme_def_file_path)" if [[ "${blkdev_type}" == "device" ]]; then blkdev="$(losetup -f --show "$(_nvme_def_file_path)")"
@@ -890,6 +922,13 @@ _nvmet_target_cleanup() { esac done + if [[ -n "${nvme_target_control}" ]]; then + eval "${nvme_target_control}" cleanup \ + --subsysnqn "${subsysnqn}" \ + > /dev/null + return + fi + _get_nvmet_ports "${def_subsysnqn}" ports for port in "${ports[@]}"; do
Signature · 1 line
2.44.0
RFC 10/10 nvme/030: only run against kernel soft target
In reply to Daniel WagnerThis tests is exercising the target code and not so much the host side. Thus just skip it when we run against a remote target.
merge
--- tests/nvme/030 | 1 + tests/nvme/rc | 8 ++++++++ 2 files changed, 9 insertions(+)
tests/nvme/030 +1 -0
@@ -13,6 +13,7 @@ requires() { _nvme_requires _have_loop _require_nvme_trtype_is_fabrics + _require_kernel_target } test() {
tests/nvme/rc +8 -0
@@ -185,6 +185,14 @@ _require_kernel_nvme_fabrics_feature() { return 0 } +_require_kernel_target() { + if [[ -n "${nvme_target_control}" ]]; then + SKIP_REASONS+=("Linux kernel soft target not available") + return 1; + fi + return 0 +} + _test_dev_nvme_ctrl() { echo "/dev/char/$(cat "${TEST_DEV_SYSFS}/device/dev")" }
Signature · 1 line
2.44.0
Quoted 2 lines · Daniel Wagner
[1] https://lore.kernel.org/linux-nvme/23fhu43orn5yyi6jytsyez3f3d7liocp4cat5gfswtan33m3au@iyxhcwee6wvk/
[2] https://github.com/hreinecke/nvmetcli/tree/rpc
The series is also available here:
https://github.com/igaw/blktests/commits/ext-hw/
which includes the mentioned Python script. As indicated it's just a WIP:
https://github.com/igaw/blktests/commit/ca1fe59b5ed67198228bcc017cfbbd25b797b868