Commit 0372f2b3 authored by Seth Howell's avatar Seth Howell Committed by Darek Stojaczyk
Browse files

create nvmf+vhost test.



This will allow us to verify functionality between the nvmf target and
the vhost target and test extra code paths within the nvmf target
including multi-sgl stuff.

Change-Id: I3f5e9351c11ab896b75cd7bba7a69d95c1d031be
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/451993


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
parent 5904abae
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ fi
run_test suite test/nvmf/target/nvmf_lvol.sh
#TODO: disabled due to intermittent failures. Need to triage.
# run_test suite test/nvmf/target/srq_overwhelm.sh
run_test suite test/nvmf/target/nvmf_vhost.sh
run_test suite test/nvmf/target/shutdown.sh
run_test suite test/nvmf/target/bdev_io_wait.sh
run_test suite test/nvmf/target/create_transport.sh
+81 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

set -e
testdir=$(readlink -f $(dirname $0))
rootdir=$testdir/../../..
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh
source $rootdir/test/vhost/common/common.sh

MALLOC_BDEV_SIZE=128
MALLOC_BLOCK_SIZE=512
NVMF_SOCK="/tmp/nvmf_rpc.sock"
NVMF_RPC="$rootdir/scripts/rpc.py -s $NVMF_SOCK"

VHOST_SOCK="/tmp/vhost_rpc.sock"
VHOST_APP="$rootdir/app/vhost/vhost -p 0 -r $VHOST_SOCK -u"
VHOST_RPC="$rootdir/scripts/rpc.py -s $VHOST_SOCK"
vm_image="/home/sys_sgsw/vhost_vm_image.qcow2"

if [ ! -d $QEMU_PREFIX ]; then
	echo "qemu not installed on this machine. It may be a VM. Skipping nvmf_vhost test."
	exit 0
fi

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

timing_enter nvmf_vhost
# Start Apps
$NVMF_APP -r $NVMF_SOCK &
nvmfpid=$!
waitforlisten $nvmfpid $NVMF_SOCK

trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT

mkdir -p "$(get_vhost_dir 3)"

$VHOST_APP -S "$(get_vhost_dir 3)" &
vhostpid=$!
waitforlisten $vhostpid $NVMF_SOCK

trap "process_shm --id $NVMF_APP_SHM_ID; killprocess $nvmfpid; killprocess $vhostpid nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT

# Configure NVMF tgt on host machine
malloc_bdev="$($NVMF_RPC construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"

$NVMF_RPC nvmf_create_transport -t RDMA -u 8192 -p 4
$NVMF_RPC nvmf_subsystem_create nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
$NVMF_RPC nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 "$malloc_bdev"
$NVMF_RPC nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t rdma -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT

# Configure VHost on host machine
$VHOST_RPC construct_nvme_bdev -b Nvme0 -t rdma -f ipv4 -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT -n nqn.2016-06.io.spdk:cnode1
$VHOST_RPC construct_vhost_scsi_controller naa.VhostScsi0.3
$VHOST_RPC add_vhost_scsi_lun naa.VhostScsi0.3 0 "Nvme0n1"

# start qemu based VM.
vm_setup --os="$vm_image" --disk-type=spdk_vhost_scsi --disks="VhostScsi0"  --force=3 --vhost-num=3

vm_run 3

vm_wait_for_boot 300 3

# Run the fio workload remotely
vm_scp 3 $testdir/nvmf_vhost_fio.job 127.0.0.1:/root/nvmf_vhost_fio.job
vm_ssh 3 "fio /root/nvmf_vhost_fio.job"
vm_shutdown_all

trap - SIGINT SIGTERM EXIT

nvmfcleanup
killprocess $vhostpid
killprocess $nvmfpid
nvmftestfini $1
timing_exit nvmf_vhost
+19 −0
Original line number Diff line number Diff line
[global]
blocksize=4k-512k
iodepth=128
ioengine=libaio
filename=/dev/sdb
group_reporting
thread
numjobs=1
direct=1
do_verify=1
verify=md5
verify_fatal=1
verify_dump=1
verify_backlog=8

[randwrite]
rw=randwrite
runtime=15
time_based