[PATCH blktests v2 11/13] common/nvme, nvme/003: specify "--port none" to _nvme_connect_subsys()
Daniel Wagner
dwagner at suse.de
Thu Oct 31 09:09:01 PDT 2024
On Wed, Oct 30, 2024 at 03:51:47PM GMT, Shin'ichiro Kawasaki wrote:
> Commit "nvme: pass in port parameter to _nvme_connect_subsys()"
> introduced the --port argument to _nvme_connect_subsys(). If the option
> is not specified, _nvme_connect_subsys() automatically finds the port
> for the specified subsysnqn. However, this does not work for the test
> case nvme/003, since the test case connects to the subsys for discovery,
> then, the port of the created subsysnqn is not to be used. This causes
> the failure of the test case.
>
> To avoid the failure, modify _nvme_connect_subsys() to take the special
> value "none" for the --port option. When "--port none" is specified,
> _nvme_connect_subsys() skips the steps to obtain port dependent
> parameters and just use default parameters.
>
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
> ---
> common/nvme | 41 ++++++++++++++++++++++++++++++-----------
> tests/nvme/003 | 3 ++-
> 2 files changed, 32 insertions(+), 12 deletions(-)
>
> diff --git a/common/nvme b/common/nvme
> index 6513205..3a2bb35 100644
> --- a/common/nvme
> +++ b/common/nvme
> @@ -690,22 +690,41 @@ _get_nvmet_port_params() {
> local port="$1"
> local -n args="$2"
> local cfs_path="${NVMET_CFS}/ports/${port}"
> - local trtype
> - local traddr
> - local trsvcid
> + local trtype="${nvme_trtype}"
> + local traddr="${def_traddr}"
> + local trsvcid="${def_trsvcid}"
>
> - [[ -d "${cfs_path}" ]] || exit 1
> - trtype=$(cat "${cfs_path}/addr_trtype")
> + # When port is specified, get port dependent parameter values
> + if [[ $port != none ]]; then
> + [[ -d "${cfs_path}" ]] || exit 1
> + trtype=$(cat "${cfs_path}/addr_trtype")
> + traddr=$(cat "${cfs_path}/addr_traddr")
> + args+=(--traddr "${traddr}")
> + if [[ "${trtype}" == "tcp" ]] || [[ "${trtype}" == "rdma" ]]; then
> + trsvcid=$(cat "${cfs_path}/addr_trsvcid")
> + fi
> + fi
> +
> + # Prepare parameter options
> args+=(--transport "${trtype}")
> - traddr=$(cat "${cfs_path}/addr_traddr")
> - args+=(--traddr "${traddr}")
> - if [[ "${trtype}" == "tcp" ]] || [[ "${trtype}" == "rdma" ]]; then
> - trsvcid=$(cat "${cfs_path}/addr_trsvcid")
> + case ${trtype} in
> + loop)
> + ;;
> + rdma | tcp)
> + if [[ $port == none ]]; then
> + args+=(--traddr "${traddr}")
Maybe make this one explicit: args+=(--traddr "${def_traddr}")
Rest looks good!
Reviewed-by: Daniel Wagner <dwagner at suse.de>
More information about the Linux-nvme
mailing list