test/vhost: Fio tests for vhost initiator.
Change-Id: Iad11eef12c0f7f80c26264f65a38df798eae1a27 Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com> Reviewed-on: https://review.gerrithub.io/378071 Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
parent
ad9e7060ed
commit
96bd19093b
@ -129,6 +129,10 @@ if [ $SPDK_TEST_VHOST -eq 1 ]; then
|
||||
timing_exit vhost
|
||||
fi
|
||||
|
||||
if [ $SPDK_TEST_VHOST_INIT -eq 1 ]; then
|
||||
run_test ./test/vhost/initiator/blockdev.sh
|
||||
fi
|
||||
|
||||
timing_enter cleanup
|
||||
rbd_cleanup
|
||||
./scripts/setup.sh reset
|
||||
|
@ -363,6 +363,7 @@ function discover_bdevs()
|
||||
{
|
||||
local rootdir=$1
|
||||
local config_file=$2
|
||||
local rpc_port=$3
|
||||
|
||||
if [ ! -e $config_file ]; then
|
||||
echo "Invalid Configuration File: $config_file"
|
||||
@ -371,14 +372,18 @@ function discover_bdevs()
|
||||
|
||||
# Start the bdev service to query for the list of available
|
||||
# bdevs.
|
||||
$rootdir/test/app/bdev_svc/bdev_svc -i 0 -c $config_file &>/dev/null &
|
||||
$rootdir/test/app/bdev_svc/bdev_svc -i 0 -s 1024 -c $config_file &>/dev/null &
|
||||
stubpid=$!
|
||||
while ! [ -e /var/run/spdk_bdev0 ]; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Get all of the bdevs
|
||||
$rootdir/scripts/rpc.py get_bdevs
|
||||
if [ -z "$rpc_port" ]; then
|
||||
$rootdir/scripts/rpc.py get_bdevs
|
||||
else
|
||||
$rootdir/scripts/rpc.py -p $rpc_port get_bdevs
|
||||
fi
|
||||
|
||||
# Shut down the bdev service
|
||||
kill $stubpid
|
||||
|
9
test/vhost/common/fio_jobs/default_initiator.job
Normal file
9
test/vhost/common/fio_jobs/default_initiator.job
Normal file
@ -0,0 +1,9 @@
|
||||
[global]
|
||||
thread=1
|
||||
group_reporting=1
|
||||
direct=1
|
||||
norandommap=1
|
||||
time_based=1
|
||||
do_verify=1
|
||||
verify=md5
|
||||
verify_backlog=1024
|
9
test/vhost/initiator/bdev.conf.in
Normal file
9
test/vhost/initiator/bdev.conf.in
Normal file
@ -0,0 +1,9 @@
|
||||
[Virtio]
|
||||
Dev User /tmp/vhost.0
|
||||
|
||||
[Rpc]
|
||||
Enable Yes
|
||||
Listen 127.0.0.1:5261
|
||||
|
||||
[Ioat]
|
||||
Disable Yes
|
95
test/vhost/initiator/blockdev.sh
Executable file
95
test/vhost/initiator/blockdev.sh
Executable file
@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
testdir=$(readlink -f $(dirname $0))
|
||||
rootdir=$(readlink -f $testdir/../../..)
|
||||
plugindir=$rootdir/examples/bdev/fio_plugin
|
||||
rpc_py="$rootdir/scripts/rpc.py"
|
||||
|
||||
function run_fio()
|
||||
{
|
||||
LD_PRELOAD=$plugindir/fio_plugin /usr/src/fio/fio --ioengine=spdk_bdev --iodepth=128 --bs=4k --runtime=10 $testdir/bdev.fio "$@" --spdk_mem=1024
|
||||
fio_status=$?
|
||||
if [ $fio_status != 0 ]; then
|
||||
spdk_vhost_kill
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
source $rootdir/test/vhost/common/common.sh
|
||||
$rootdir/scripts/gen_nvme.sh
|
||||
spdk_vhost_run $testdir
|
||||
$rpc_py construct_malloc_bdev 128 512
|
||||
$rpc_py construct_malloc_bdev 128 4096
|
||||
$rpc_py add_vhost_scsi_lun vhost.0 0 Nvme0n1
|
||||
$rpc_py add_vhost_scsi_lun vhost.1 0 Malloc0
|
||||
$rpc_py add_vhost_scsi_lun vhost.2 0 Malloc1
|
||||
$rpc_py get_bdevs
|
||||
bdevs=$($rpc_py get_bdevs | jq -r '.[] | .name')
|
||||
|
||||
for bdev in $bdevs; do
|
||||
timing_enter bdev
|
||||
|
||||
cp $testdir/bdev.conf.in $testdir/bdev.conf
|
||||
if [ $bdev == "Nvme0n1" ]; then
|
||||
sed -i "s|/tmp/vhost.0|$rootdir/../vhost/vhost.0|g" $testdir/bdev.conf
|
||||
elif [ $bdev == "Malloc0" ]; then
|
||||
sed -i "s|/tmp/vhost.0|$rootdir/../vhost/vhost.1|g" $testdir/bdev.conf
|
||||
else
|
||||
sed -i "s|/tmp/vhost.0|$rootdir/../vhost/vhost.2|g" $testdir/bdev.conf
|
||||
fi
|
||||
|
||||
timing_enter bounds
|
||||
$rootdir/test/lib/bdev/bdevio/bdevio $testdir/bdev.conf
|
||||
timing_exit bounds
|
||||
|
||||
timing_enter bdev_svc
|
||||
bdevs=$(discover_bdevs $rootdir $testdir/bdev.conf 5261 | jq -r '.[] | select(.claimed == false)')
|
||||
timing_exit bdev_svc
|
||||
|
||||
if [ -d /usr/src/fio ]; then
|
||||
timing_enter fio
|
||||
if [ $RUN_NIGHTLY -eq 1 ]; then
|
||||
fio_rw=("write" "read" "randwrite" "randread" "rw" "randrw")
|
||||
else
|
||||
fio_rw=("write" "read")
|
||||
fi
|
||||
for rw in "${fio_rw[@]}"; do
|
||||
timing_enter fio_rw_verify
|
||||
cp $testdir/../common/fio_jobs/default_initiator.job $testdir/bdev.fio
|
||||
if [ $rw == "read" ] || [ $rw == "randread" ]; then
|
||||
echo "size=100m" >> $testdir/bdev.fio
|
||||
echo "io_size=400m" >> $testdir/bdev.fio
|
||||
echo "[job_write]" >> $testdir/bdev.fio
|
||||
echo "stonewall" >> $testdir/bdev.fio
|
||||
echo "rw=write" >> $testdir/bdev.fio
|
||||
echo "do_verify=0" >> $testdir/bdev.fio
|
||||
echo -n "filename=" >> $testdir/bdev.fio
|
||||
for b in $(echo $bdevs | jq -r '.name'); do
|
||||
echo -n "$b:" >> $testdir/bdev.fio
|
||||
done
|
||||
echo "" >> $testdir/bdev.fio
|
||||
fi
|
||||
echo "[job_$rw]" >> $testdir/bdev.fio
|
||||
echo "stonewall" >> $testdir/bdev.fio
|
||||
echo "rw=$rw" >> $testdir/bdev.fio
|
||||
echo -n "filename=" >> $testdir/bdev.fio
|
||||
for b in $(echo $bdevs | jq -r '.name'); do
|
||||
echo -n "$b:" >> $testdir/bdev.fio
|
||||
done
|
||||
|
||||
run_fio --spdk_conf=$testdir/bdev.conf
|
||||
|
||||
rm -f *.state
|
||||
rm -f $testdir/bdev.fio
|
||||
timing_exit fio_rw_verify
|
||||
done
|
||||
|
||||
timing_exit fio
|
||||
fi
|
||||
|
||||
rm -f $testdir/bdev.conf
|
||||
timing_exit bdev
|
||||
done
|
||||
spdk_vhost_kill
|
14
test/vhost/initiator/vhost.conf.in
Normal file
14
test/vhost/initiator/vhost.conf.in
Normal file
@ -0,0 +1,14 @@
|
||||
[Rpc]
|
||||
Enable Yes
|
||||
|
||||
[Ioat]
|
||||
Disable Yes
|
||||
|
||||
[VhostScsi0]
|
||||
Name vhost.0
|
||||
|
||||
[VhostScsi1]
|
||||
Name vhost.1
|
||||
|
||||
[VhostScsi2]
|
||||
Name vhost.2
|
Loading…
Reference in New Issue
Block a user