test/nvmf: confirm kernel finds NVMe-oF namespaces

In Fedora 27 the nvme program returns before the kernel has loaded the
namespces associated with the subsystem. This patch ensures that those
namespaces can be enumerated by the kernel before we run any tests on
them.

Change-Id: I77505ed5cd5b1118a841650851fa5ecaf76f5619
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/407829
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Seth Howell 2018-04-16 13:28:16 -07:00 committed by Daniel Verkamp
parent b332897a04
commit e3263286d3
6 changed files with 35 additions and 0 deletions

View File

@ -468,6 +468,22 @@ function discover_bdevs()
rm -f /var/run/spdk_bdev0 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() function fio_config_gen()
{ {
local config_file=$1 local config_file=$1

View File

@ -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" 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 mkdir -p /mnt/device
devs=`lsblk -l -o NAME | grep nvme` devs=`lsblk -l -o NAME | grep nvme`

View File

@ -43,6 +43,9 @@ done
nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT" 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 write 1 verify
$testdir/nvmf_fio.py 4096 1 randwrite 1 verify $testdir/nvmf_fio.py 4096 1 randwrite 1 verify
$testdir/nvmf_fio.py 4096 128 write 1 verify $testdir/nvmf_fio.py 4096 128 write 1 verify

View File

@ -71,7 +71,12 @@ for i in `seq 1 $SUBSYS_NR`; do
done done
for i in `seq 1 $SUBSYS_NR`; do 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" 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 done
$testdir/../fio/nvmf_fio.py 262144 64 randwrite 10 verify $testdir/../fio/nvmf_fio.py 262144 64 randwrite 10 verify

View File

@ -48,7 +48,12 @@ do
done done
for i in `seq 1 $NVMF_SUBSYS`; do 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" 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 done
$testdir/../fio/nvmf_fio.py 262144 64 read 10 $testdir/../fio/nvmf_fio.py 262144 64 read 10

View File

@ -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" 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 nvme list
for ctrl in /dev/nvme?; do for ctrl in /dev/nvme?; do