[PATCH blktests 04/15] nvme: introduce wwnn/wwpn helper functions

Daniel Wagner dwagner at suse.de
Fri Oct 25 07:22:13 PDT 2024


On Thu, Oct 24, 2024 at 10:00:14AM GMT, Shin'ichiro Kawasaki wrote:
> Commit "nvme: sanitize transport parameter in _create_nvmet_port()"
> modified the wwnn and wwpn names for fc transport to calculate from the
> port ID. It also moved the timing to set the global variable
> def_host_traddr based on the wwnn and wwpn from _setup_nvmet() to
> _create_nvmet_port(). This move made _nvme_connect_subsys() fail
> to refer to the def_host_traddr variable, and caused nvme/003 test case
> failure.
> 
> To avoid the failure, do the wwnn and wwpn calculations both in
> _create_nvmet_port() and _nvme_connect_subsys(). Introduce helper
> functions to calculate wwnn and wwpn.
> 
> Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki at wdc.com>
> ---
>  common/nvme | 63 +++++++++++++++++++++++++++++++++++++----------------
>  1 file changed, 44 insertions(+), 19 deletions(-)
> 
> diff --git a/common/nvme b/common/nvme
> index 46dfb51..3e388c2 100644
> --- a/common/nvme
> +++ b/common/nvme
> @@ -331,7 +331,15 @@ _nvme_connect_subsys() {
>  
>  	ARGS=(--transport "${nvme_trtype}" --nqn "${subsysnqn}")
>  	if [[ "${nvme_trtype}" == "fc" ]] ; then
> -		ARGS+=(--traddr "${def_traddr}" --host-traddr "${def_host_traddr}")
> +		local ports
> +		_get_nvmet_ports "${subsysnqn}" ports
> +		if ((${#ports[@]} != 1)); then
> +			echo only one port is supported at this moment...

Maybe prefix the error message with 'FAIL', so that it pops up in the
logs a bit more.

Rest looks good.

Reviewed-by: Daniel Wagner <dwagner at suse.de>



More information about the Linux-nvme mailing list