test/hotplug: Fix vhost hotplug tests

Rename BASE_DIR to HOTPLUG_DIR to avoid overriding.
Replace old spdk config with rpcs.

Change-Id: I1ab816f45eb149c68723b26e724db889e86ec14f
Signed-off-by: Pawel Kaminski <pawelx.kaminski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/440950
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Pawel Kaminski 2019-01-17 08:22:33 -05:00 committed by Jim Harris
parent 14e1d0c747
commit e028ae45e2
5 changed files with 31 additions and 51 deletions

View File

@ -1,7 +1,7 @@
dry_run=false
no_shutdown=false
fio_bin="fio"
fio_jobs="$BASE_DIR/fio_jobs/"
fio_jobs="$HOTPLUG_DIR/fio_jobs/"
test_type=spdk_vhost_scsi
reuse_vms=false
vms=()
@ -26,7 +26,6 @@ function usage() {
echo "-x set -x for script debug"
echo " --fio-bin=FIO Use specific fio binary (will be uploaded to VM)"
echo " --fio-jobs= Fio configs to use for tests. Can point to a directory or"
echo " --work-dir=WORK_DIR Where to find build file. Must exist. [default: $TEST_DIR]"
echo " --vm=NUM[,OS][,DISKS] VM configuration. This parameter might be used more than once:"
echo " NUM - VM number (mandatory)"
echo " OS - VM os disk path (optional)"
@ -40,7 +39,6 @@ while getopts 'xh-:' optchar; do
-)
case "$OPTARG" in
help) usage $0 ;;
work-dir=*) TEST_DIR="${OPTARG#*=}" ;;
fio-bin=*) fio_bin="${OPTARG#*=}" ;;
fio-jobs=*) fio_jobs="${OPTARG#*=}" ;;
test-type=*) test_type="${OPTARG#*=}" ;;
@ -58,10 +56,10 @@ while getopts 'xh-:' optchar; do
done
shift $(( OPTIND - 1 ))
fio_job=$BASE_DIR/fio_jobs/default_integrity.job
tmp_attach_job=$BASE_DIR/fio_jobs/fio_attach.job.tmp
tmp_detach_job=$BASE_DIR/fio_jobs/fio_detach.job.tmp
. $BASE_DIR/../common/common.sh
fio_job=$HOTPLUG_DIR/fio_jobs/default_integrity.job
tmp_attach_job=$HOTPLUG_DIR/fio_jobs/fio_attach.job.tmp
tmp_detach_job=$HOTPLUG_DIR/fio_jobs/fio_detach.job.tmp
. $HOTPLUG_DIR/../common/common.sh
rpc_py="$SPDK_BUILD_DIR/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
@ -76,15 +74,6 @@ function print_test_fio_header() {
fi
}
function run_vhost() {
notice "==============="
notice ""
notice "running SPDK"
notice ""
spdk_vhost_run --conf-path=$BASE_DIR
notice ""
}
function vms_setup() {
for vm_conf in ${vms[@]}; do
IFS=',' read -ra conf <<< "$vm_conf"

View File

@ -1,9 +1,8 @@
#!/usr/bin/env bash
set -e
BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)"
HOTPLUG_DIR=$(readlink -f $(dirname $0))
. $BASE_DIR/common.sh
. $HOTPLUG_DIR/common.sh
function prepare_fio_cmd_tc1() {
print_test_fio_header
@ -94,7 +93,6 @@ function cleanup_after_tests() {
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p0.0 1
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p1.0 0
$rpc_py remove_vhost_scsi_target naa.Nvme0n1p2.1 0
$rpc_py delete_nvme_controller Nvme0
}
hotattach_tc1

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash
set -e
BASE_DIR=$(readlink -f $(dirname $0))
[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)"
HOTPLUG_DIR=$(readlink -f $(dirname $0))
. $BASE_DIR/common.sh
. $HOTPLUG_DIR/common.sh
function get_first_disk() {
vm_check_scsi_location $1

View File

@ -1,26 +1,12 @@
#!/usr/bin/env bash
set -e
BASE_DIR=$(readlink -f $(dirname $0))
. $BASE_DIR/common.sh
HOTPLUG_DIR=$(readlink -f $(dirname $0))
. $HOTPLUG_DIR/common.sh
if [[ $scsi_hot_remove_test == 1 ]] && [[ $blk_hot_remove_test == 1 ]]; then
notice "Vhost-scsi and vhost-blk hotremove tests cannot be run together"
fi
# Add split section into vhost config
function gen_config() {
cp $BASE_DIR/vhost.conf.base $BASE_DIR/vhost.conf.in
cat << END_OF_CONFIG >> $BASE_DIR/vhost.conf.in
[Split]
Split Nvme0n1 16
Split Nvme1n1 20
Split HotInNvme0n1 2
Split HotInNvme1n1 2
Split HotInNvme2n1 2
Split HotInNvme3n1 2
END_OF_CONFIG
}
# Run spdk by calling run_vhost from hotplug/common.sh.
# Then prepare vhost with rpc calls and setup and run 4 VMs.
function pre_hot_attach_detach_test_case() {
@ -65,16 +51,28 @@ function clear_vhost_config() {
}
trap 'error_exit "${FUNCNAME}" "${LINENO}"' ERR
gen_config
# Hotremove/hotattach/hotdetach test cases prerequisites
# 1. Run vhost with 2 NVMe disks.
run_vhost
rm $BASE_DIR/vhost.conf.in
# Run vhost with 2 NVMe disks.
notice "==============="
notice ""
notice "running SPDK"
notice ""
spdk_vhost_run
$rpc_py set_bdev_nvme_hotplug -e
$rpc_py construct_split_vbdev Nvme0n1 16
$rpc_py construct_split_vbdev Nvme1n1 4
$rpc_py construct_split_vbdev HotInNvme0n1 2
$rpc_py construct_split_vbdev HotInNvme1n1 2
$rpc_py construct_split_vbdev HotInNvme2n1 2
$rpc_py construct_split_vbdev HotInNvme3n1 2
$rpc_py get_bdevs
if [[ $scsi_hot_remove_test == 0 ]] && [[ $blk_hot_remove_test == 0 ]]; then
pre_hot_attach_detach_test_case
$BASE_DIR/scsi_hotattach.sh --fio-bin=$fio_bin &
$HOTPLUG_DIR/scsi_hotattach.sh --fio-bin=$fio_bin &
first_script=$!
$BASE_DIR/scsi_hotdetach.sh --fio-bin=$fio_bin &
$HOTPLUG_DIR/scsi_hotdetach.sh --fio-bin=$fio_bin &
second_script=$!
wait $first_script
wait $second_script
@ -82,9 +80,9 @@ if [[ $scsi_hot_remove_test == 0 ]] && [[ $blk_hot_remove_test == 0 ]]; then
clear_vhost_config
fi
if [[ $scsi_hot_remove_test == 1 ]]; then
source $BASE_DIR/scsi_hotremove.sh
source $HOTPLUG_DIR/scsi_hotremove.sh
fi
if [[ $blk_hot_remove_test == 1 ]]; then
source $BASE_DIR/blk_hotremove.sh
source $HOTPLUG_DIR/blk_hotremove.sh
fi
post_test_case

View File

@ -1,4 +0,0 @@
[Global]
[Nvme]
HotplugEnable Yes