test/vhost: test multiple connections to a single vhost device

Two fio instancess will try to do simultaneous I/O
to a single vhost block device.

The test uses default_initiator.job as a fio config,
which apparently wasn't used anywhere and had to be
slightly adjusted to work. Specificaly, we had to
specify an empty job in the config file, as specifying
it from the command line wouldn't make it inherit
any options from the [global] section in the file.

Change-Id: I2c2a96a709c567f5c910715a5b3d85a4e28bcb97
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/419066
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Pawel Kaminski 2018-07-12 10:22:17 -04:00 committed by Jim Harris
parent 1d0a8e1cec
commit 766b1f62d9
4 changed files with 38 additions and 0 deletions

View File

@ -179,6 +179,7 @@ if [ $SPDK_TEST_VHOST_INIT -eq 1 ]; then
timing_enter vhost_initiator
run_test suite ./test/vhost/initiator/blockdev.sh
run_test suite ./test/spdkcli/virtio.sh
run_test suite ./test/vhost/shared/shared.sh
report_test_completion "vhost_initiator"
timing_exit vhost_initiator
fi

View File

@ -7,3 +7,5 @@ do_verify=1
verify=md5
verify_backlog=1024
fsync_on_close=1
iodepth=32
[job0]

View File

@ -0,0 +1,5 @@
[VirtioUser0]
Path Malloc.0
Queues 2
Type Blk
Name VirtioBlk0

30
test/vhost/shared/shared.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
set -e
SHARED_DIR=$(readlink -f $(dirname $0))
[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $SHARED_DIR/../common && pwd)"
ROOT_DIR=$(readlink -f $SHARED_DIR/../../..)
source $COMMON_DIR/common.sh
PLUGIN_DIR=$ROOT_DIR/examples/bdev/fio_plugin
FIO_PATH="/usr/src/fio"
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
function run_spdk_fio() {
LD_PRELOAD=$PLUGIN_DIR/fio_plugin $FIO_PATH/fio --ioengine=spdk_bdev \
"$COMMON_DIR/fio_jobs/default_initiator.job" --runtime=10 --rw=randrw \
--spdk_mem=1024 --spdk_single_seg=1 --spdk_conf=$SHARED_DIR/bdev.conf "$@"
}
trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR SIGTERM SIGABRT
spdk_vhost_run
$rpc_py construct_malloc_bdev -b Malloc 124 4096
$rpc_py construct_vhost_blk_controller Malloc.0 Malloc
run_spdk_fio --size=50% --offset=0 --filename=VirtioBlk0 &
run_fio_pid=$!
sleep 1
run_spdk_fio --size=50% --offset=50% --filename=VirtioBlk0
wait $run_fio_pid
spdk_vhost_kill