diff --git a/test/common/autotest_common.sh b/test/common/autotest_common.sh index a418fb0e56..b92418f463 100755 --- a/test/common/autotest_common.sh +++ b/test/common/autotest_common.sh @@ -468,6 +468,22 @@ function discover_bdevs() rm -f /var/run/spdk_bdev0 } +function waitforblk() +{ + local i=0 + while ! lsblk -l -o NAME | grep -q -w $1; do + [ $i -lt 15 ] || break + i=$[$i+1] + sleep 1 + done + + if ! lsblk -l -o NAME | grep -q -w $1; then + return 1 + fi + + return 0 +} + function fio_config_gen() { local config_file=$1 diff --git a/test/nvmf/filesystem/filesystem.sh b/test/nvmf/filesystem/filesystem.sh index d3b1ba7023..583adecc43 100755 --- a/test/nvmf/filesystem/filesystem.sh +++ b/test/nvmf/filesystem/filesystem.sh @@ -39,6 +39,9 @@ $rpc_py construct_nvmf_subsystem nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr: nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" +waitforblk "nvme0n1" +waitforblk "nvme0n2" + mkdir -p /mnt/device devs=`lsblk -l -o NAME | grep nvme` diff --git a/test/nvmf/fio/fio.sh b/test/nvmf/fio/fio.sh index 5dc61e0539..b3bd579e74 100755 --- a/test/nvmf/fio/fio.sh +++ b/test/nvmf/fio/fio.sh @@ -43,6 +43,9 @@ done nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" +waitforblk "nvme0n1" +waitforblk "nvme0n2" + $testdir/nvmf_fio.py 4096 1 write 1 verify $testdir/nvmf_fio.py 4096 1 randwrite 1 verify $testdir/nvmf_fio.py 4096 128 write 1 verify diff --git a/test/nvmf/lvol/nvmf_lvol.sh b/test/nvmf/lvol/nvmf_lvol.sh index 78f97a18f5..e24c26086a 100755 --- a/test/nvmf/lvol/nvmf_lvol.sh +++ b/test/nvmf/lvol/nvmf_lvol.sh @@ -71,7 +71,12 @@ for i in `seq 1 $SUBSYS_NR`; do done for i in `seq 1 $SUBSYS_NR`; do + k=$[$i-1] nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" + + for j in `seq 1 10`; do + waitforblk "nvme${k}n${j}" + done done $testdir/../fio/nvmf_fio.py 262144 64 randwrite 10 verify diff --git a/test/nvmf/multiconnection/multiconnection.sh b/test/nvmf/multiconnection/multiconnection.sh index 0ecd2068b8..4f6b688e8c 100755 --- a/test/nvmf/multiconnection/multiconnection.sh +++ b/test/nvmf/multiconnection/multiconnection.sh @@ -48,7 +48,12 @@ do done for i in `seq 1 $NVMF_SUBSYS`; do + k=$[$i-1] nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode${i}" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" + + for j in `seq 1 10`; do + waitforblk "nvme${k}n${j}" + done done $testdir/../fio/nvmf_fio.py 262144 64 read 10 diff --git a/test/nvmf/nvme_cli/nvme_cli.sh b/test/nvmf/nvme_cli/nvme_cli.sh index fbe59f8ac3..8028897c04 100755 --- a/test/nvmf/nvme_cli/nvme_cli.sh +++ b/test/nvmf/nvme_cli/nvme_cli.sh @@ -40,6 +40,9 @@ $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t RDMA -a $NVMF_ nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" +waitforblk "nvme0n1" +waitforblk "nvme0n2" + nvme list for ctrl in /dev/nvme?; do