numam-spdk/test/nvmf/lvol/nvmf_lvol.sh
Ben Walker e086dba5af test/nvmf: Use bdevperf in lvol test instead of fio
This is much, much faster to set up and tear down than
the kernel initiator plus fio.

Change-Id: I9532b734123556d6e2055e4f3acf2ad4887784c3
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/432085
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
2018-11-07 17:06:11 +00:00

113 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
MALLOC_BDEV_SIZE=64
MALLOC_BLOCK_SIZE=512
LVOL_BDEV_SIZE=10
SUBSYS_NR=2
LVOL_BDEVS_NR=6
rpc_py="$rootdir/scripts/rpc.py"
function disconnect_nvmf()
{
for i in `seq 1 $SUBSYS_NR`; do
nvme disconnect -n "nqn.2016-06.io.spdk:cnode${i}" || true
done
}
set -e
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
# e.g. sudo ./nvmf_lvol.sh iso
nvmftestinit $1
RDMA_IP_LIST=$(get_available_rdma_ips)
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
if [ -z $NVMF_FIRST_TARGET_IP ]; then
echo "no NIC for nvmf test"
exit 0
fi
# SoftRoce does not have enough queues available for
# multiconnection tests. Detect if we're using software RDMA.
# If so - lower the number of subsystems for test.
if check_ip_is_soft_roce $NVMF_FIRST_TARGET_IP; then
echo "Using software RDMA, lowering number of NVMeOF subsystems."
SUBSYS_NR=1
fi
timing_enter lvol_integrity
timing_enter start_nvmf_tgt
# Start up the NVMf target in another process
$NVMF_APP -m 0xF &
pid=$!
trap "process_shm --id $NVMF_APP_SHM_ID; disconnect_nvmf; killprocess $pid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
waitforlisten $pid
$rpc_py nvmf_create_transport -t RDMA -u 8192 -p 4
timing_exit start_nvmf_tgt
modprobe -v nvme-rdma
touch $testdir/bdevperf.conf
echo "[Nvme]" > $testdir/bdevperf.conf
lvol_stores=()
lvol_bdevs=()
for i in `seq 1 $SUBSYS_NR`; do
if [ $i -eq 1 ]; then
# construct RAID bdev and put its name in $bdev
malloc_bdevs="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE) "
malloc_bdevs+="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
$rpc_py construct_raid_bdev -n raid0 -s 64 -r 0 -b "$malloc_bdevs"
bdev="raid0"
else
# construct malloc bdev and put its name in $bdev
bdev="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
fi
ls_guid="$($rpc_py construct_lvol_store $bdev lvs_$i -c 524288)"
lvol_stores+=("$ls_guid")
# 1 NVMe-OF subsystem per malloc bdev / lvol store / 10 lvol bdevs
ns_bdevs=""
# Create lvol bdevs on each lvol store
for j in `seq 1 $LVOL_BDEVS_NR`; do
lb_name="$($rpc_py construct_lvol_bdev -u $ls_guid lbd_$j $LVOL_BDEV_SIZE)"
lvol_bdevs+=("$lb_name")
ns_bdevs+="$lb_name "
done
$rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode$i -a -s SPDK$i
for bdev in $ns_bdevs; do
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode$i $bdev
done
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode$i -t rdma -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
echo " TransportID \"trtype:RDMA adrfam:IPv4 subnqn:nqn.2016-06.io.spdk:cnode$i traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT\" Nvme$i" >> $testdir/bdevperf.conf
done
$rootdir/test/bdev/bdevperf/bdevperf -c $testdir/bdevperf.conf -q 64 -o 65536 -w verify -t 10
rm -rf $testdir/bdevperf.conf
sync
for i in `seq 1 $SUBSYS_NR`; do
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode$i
done
rm -f ./local-job*
trap - SIGINT SIGTERM EXIT
nvmfcleanup
killprocess $pid
nvmftestfini $1
timing_exit lvol_integrity