Re: [PATCH v4 3/7] nvme: make tests transport type agnostic
From: Logan Gunthorpe <logang@deltatee.com>
Date: 2020-08-14 16:24:33
Also in:
linux-nvme
From: Logan Gunthorpe <logang@deltatee.com>
Date: 2020-08-14 16:24:33
Also in:
linux-nvme
On 2020-08-14 12:18 a.m., Sagi Grimberg wrote:
_nvme_disconnect_ctrl() {@@ -112,20 +121,33 @@ _nvme_disconnect_subsys() { _nvme_connect_subsys() { local trtype="$1" local subsysnqn="$2" + local traddr="${3:-$def_traddr}" + local trsvcid="${4:-$def_trsvcid}" cmd="nvme connect -t ${trtype} -n ${subsysnqn}" + if [[ "${trtype}" != "loop" ]]; then + cmd=$cmd" -a ${traddr} -s ${trsvcid}" + fi eval $cmd }
I think this pattern would be done better with a bash array instead of
an eval, which will get the quoting correct:
ARGS=(-t "${trtype}" -n "${subsysnqn}")
if [[ "${trtype}" != "loop" ]]; then
ARGS+=(-a "${traddr}" -s "${trsvcid}")
fi
nvme connect "${ARGS[@]}"