test: fix nvmf connect/disconnect

Add missing wait in test/nvme/shutdown/shutdown.sh
Not waiting after connecting nvme device resulted in undefined behavior.

This patch uses new helper function - nvme_connect

Change-Id: Idb29c7f6b40ae4b3fa0eb68f7b8d5f86d9a4149f
Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/428336
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Seth Howell <seth.howell5141@gmail.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Vitaliy Mysak 2018-10-20 18:20:43 +02:00 committed by Jim Harris
parent c7bb861a85
commit 8cbbdf2ddf
2 changed files with 18 additions and 1 deletions

View File

@ -198,3 +198,20 @@ function check_ip_is_soft_roce()
return 1
fi
}
function nvme_connect()
{
local init_count=$(nvme list | wc -l)
nvme connect $@
if [ $? != 0 ]; then return $?; fi
for i in $(seq 1 10); do
if [ $(nvme list | wc -l) -gt $init_count ]; then
return 0
else
sleep 1s
fi
done
return 1
}

View File

@ -61,7 +61,7 @@ modprobe -v nvme-fabrics
for ((x=0; x<2;x++)); do
# Connect kernel host to subsystems
for i in `seq 1 $num_subsystems`; do
nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
nvme_connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
done
# Disconnect the subsystems in reverse order
for i in `seq $num_subsystems -1 1`; do