From 766b1f62d935a2e34f4ee67399bee78517f8ad16 Mon Sep 17 00:00:00 2001 From: Pawel Kaminski Date: Thu, 12 Jul 2018 10:22:17 -0400 Subject: [PATCH] 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 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/419066 Tested-by: SPDK CI Jenkins Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Jim Harris Reviewed-by: Pawel Wodkowski Reviewed-by: Tomasz Zawadzki --- autotest.sh | 1 + .../common/fio_jobs/default_initiator.job | 2 ++ test/vhost/shared/bdev.conf | 5 ++++ test/vhost/shared/shared.sh | 30 +++++++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 test/vhost/shared/bdev.conf create mode 100755 test/vhost/shared/shared.sh diff --git a/autotest.sh b/autotest.sh index c37fdef67..43814ca34 100755 --- a/autotest.sh +++ b/autotest.sh @@ -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 diff --git a/test/vhost/common/fio_jobs/default_initiator.job b/test/vhost/common/fio_jobs/default_initiator.job index 43c1404b0..32c993bd2 100644 --- a/test/vhost/common/fio_jobs/default_initiator.job +++ b/test/vhost/common/fio_jobs/default_initiator.job @@ -7,3 +7,5 @@ do_verify=1 verify=md5 verify_backlog=1024 fsync_on_close=1 +iodepth=32 +[job0] diff --git a/test/vhost/shared/bdev.conf b/test/vhost/shared/bdev.conf new file mode 100644 index 000000000..95e8af514 --- /dev/null +++ b/test/vhost/shared/bdev.conf @@ -0,0 +1,5 @@ +[VirtioUser0] + Path Malloc.0 + Queues 2 + Type Blk + Name VirtioBlk0 diff --git a/test/vhost/shared/shared.sh b/test/vhost/shared/shared.sh new file mode 100755 index 000000000..939fe1111 --- /dev/null +++ b/test/vhost/shared/shared.sh @@ -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