test/vhost: don't call vm_setup.sh helper script to setup VM

vm_setup.sh is a proxy script for vm_setup function which should
be called directly.

Change-Id: If9cd70a9bf67a743144142ea75887dfbd539b38a
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-on: https://review.gerrithub.io/393160
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Pawel Wodkowski 2017-12-28 17:00:44 +01:00 committed by Jim Harris
parent c39eb080b3
commit e6e2fc5b07
6 changed files with 24 additions and 36 deletions

View File

@ -515,13 +515,11 @@ function vm_setup()
cmd+="-drive file=$os,if=none,id=os_disk ${eol}"
cmd+="-device ide-hd,drive=os_disk,bootindex=0 ${eol}"
IFS=':'
if ( [[ $disks == '' ]] && [[ $disk_type == virtio* ]] ); then
disks=1
fi
for disk in $disks; do
for disk in ${disks//:/ }; do
case $disk_type in
virtio)
local raw_name="RAWSCSI"

View File

@ -97,7 +97,6 @@ rpc_py="python $SPDK_BUILD_DIR/scripts/rpc.py "
for vm_conf in ${vms[@]}; do
IFS=',' read -ra conf <<< "$vm_conf"
setup_cmd="$COMMON_DIR/vm_setup.sh $x --work-dir=$TEST_DIR --test-type=$test_type"
if [[ x"${conf[0]}" == x"" ]] || ! assert_number ${conf[0]}; then
fail "invalid VM configuration syntax $vm_conf"
fi
@ -109,10 +108,7 @@ for vm_conf in ${vms[@]}; do
fi
done
setup_cmd+=" -f ${conf[0]}"
used_vms+=" ${conf[0]}"
[[ x"${conf[1]}" != x"" ]] && setup_cmd+=" --os=${conf[1]}"
[[ x"${conf[2]}" != x"" ]] && setup_cmd+=" --disk=${conf[2]}"
if [[ $test_type =~ "spdk_vhost" ]]; then
@ -191,6 +187,11 @@ for vm_conf in ${vms[@]}; do
unset IFS;
$rpc_py get_vhost_controllers
fi
setup_cmd="vm_setup --force=${conf[0]} --disk-type=$test_type"
[[ x"${conf[1]}" != x"" ]] && setup_cmd+=" --os=${conf[1]}"
[[ x"${conf[2]}" != x"" ]] && setup_cmd+=" --disks=${conf[2]}"
$setup_cmd
done

View File

@ -90,7 +90,6 @@ function run_vhost() {
function vms_setup() {
for vm_conf in ${vms[@]}; do
IFS=',' read -ra conf <<< "$vm_conf"
setup_cmd="$BASE_DIR/../common/vm_setup.sh $x --work-dir=$TEST_DIR --test-type=$test_type"
if [[ x"${conf[0]}" == x"" ]] || ! assert_number ${conf[0]}; then
fail "invalid VM configuration syntax $vm_conf"
fi
@ -102,11 +101,11 @@ function vms_setup() {
fi
done
setup_cmd+=" -f ${conf[0]}"
used_vms+=" ${conf[0]}"
[[ x"${conf[1]}" != x"" ]] && setup_cmd+=" --os=${conf[1]}"
[[ x"${conf[2]}" != x"" ]] && setup_cmd+=" --disk=${conf[2]}"
setup_cmd="vm_setup --disk-type=$test_type --force=${conf[0]}"
[[ x"${conf[1]}" != x"" ]] && setup_cmd+=" --os=${conf[1]}"
[[ x"${conf[2]}" != x"" ]] && setup_cmd+=" --disks=${conf[2]}"
$setup_cmd
done
}

View File

@ -13,7 +13,7 @@ rpc_py="python $SPDK_BUILD_DIR/scripts/rpc.py "
vm_count=1
max_disks=""
ctrl_type="vhost_scsi"
ctrl_type="spdk_vhost_scsi"
use_fs=false
nested_lvol=false
distribute_cores=false
@ -32,8 +32,8 @@ function usage()
echo " --max-disks=INT Maximum number of NVMe drives to use in test."
echo " Default: will use all available NVMes."
echo " --ctrl-type=TYPE Controller type to use for test:"
echo " vhost_scsi - use spdk vhost scsi"
echo " vhost_blk - use spdk vhost block"
echo " spdk_vhost_scsi - use spdk vhost scsi"
echo " spdk_vhost_blk - use spdk vhost block"
echo " --nested-lvol If enabled will create additional lvol bdev"
echo " on each NVMe for use as base device for next"
echo " lvol store and lvol bdevs."
@ -178,13 +178,7 @@ for (( i=0; i<$vm_count; i++)); do
select(.name | contains(\"$vm\")) | .name) | join(\" \")" <<< "$bdev_info")
bdevs=($bdevs)
setup_cmd="$COMMON_DIR/vm_setup.sh $x --work-dir=$TEST_DIR"
if [[ "$ctrl_type" == "vhost_scsi" ]]; then
setup_cmd+=" --test-type=spdk_vhost_scsi"
elif [[ "$ctrl_type" == "vhost_blk" ]]; then
setup_cmd+=" --test-type=spdk_vhost_blk"
fi
setup_cmd+=" -f $i"
setup_cmd="vm_setup --disk-type=$ctrl_type --force=$i"
setup_cmd+=" --os=/home/sys_sgsw/vhost_vm_image.qcow2"
# Create single SCSI controller or multiple BLK controllers for this VM
@ -193,13 +187,13 @@ for (( i=0; i<$vm_count; i++)); do
mask_arg="--cpumask ${!mask}"
fi
if [[ "$ctrl_type" == "vhost_scsi" ]]; then
if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
$rpc_py construct_vhost_scsi_controller naa.0.$i $mask_arg
for (( j=0; j<${#bdevs[@]}; j++)); do
$rpc_py add_vhost_scsi_lun naa.0.$i $j ${bdevs[$j]}
done
setup_cmd+=" --disk=0"
elif [[ "$ctrl_type" == "vhost_blk" ]]; then
setup_cmd+=" --disks=0"
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
disk=""
for (( j=0; j<${#bdevs[@]}; j++)); do
blk_dev_size=$(get_bdev_size "${bdevs[$j]}")
@ -208,7 +202,7 @@ for (( i=0; i<$vm_count; i++)); do
disk+="${j}_size_${blk_dev_size}M:"
done
disk="${disk::-1}"
setup_cmd+=" --disk=$disk"
setup_cmd+=" --disks=$disk"
fi
$setup_cmd
@ -232,9 +226,9 @@ for vm_num in $used_vms; do
vm_ssh $vm_num "hostname $host_name"
vm_start_fio_server $fio_bin $vm_num
if [[ "$ctrl_type" == "vhost_scsi" ]]; then
if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
vm_check_scsi_location $vm_num
elif [[ "$ctrl_type" == "vhost_blk" ]]; then
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
vm_check_blk_location $vm_num
fi
@ -249,7 +243,7 @@ vm_shutdown_all
sleep 2
notice "Cleaning up vhost - remove LUNs, controllers, lvol bdevs and lvol stores"
if [[ "$ctrl_type" == "vhost_scsi" ]]; then
if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
for (( i=0; i<$vm_count; i++)); do
notice "Removing devices from vhost SCSI controller naa.0.$i"
for (( j=0; j<${#bdevs[@]}; j++)); do
@ -259,7 +253,7 @@ if [[ "$ctrl_type" == "vhost_scsi" ]]; then
notice "Removing vhost SCSI controller naa.0.$i"
$rpc_py remove_vhost_controller naa.0.$i
done
elif [[ "$ctrl_type" == "vhost_blk" ]]; then
elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
for (( i=0; i<$vm_count; i++)); do
for (( j=0; j<${#bdevs[@]}; j++)); do
notice "Removing vhost BLK controller naa.$j.$i"

View File

@ -86,11 +86,7 @@ function blk_ro_tc1()
notice "Creating vhost_blk controller"
vhost_blk_name="naa.$disk_name.$vm_no"
$rpc_py construct_vhost_blk_controller $vhost_blk_name $disk_name
setup_cmd="$COMMON_DIR/vm_setup.sh $x --work-dir=$TEST_DIR --test-type=spdk_vhost_blk"
setup_cmd+=" -f $vm_no"
setup_cmd+=" --os=$vm_img"
setup_cmd+=" --disk=$disk"
$setup_cmd
vm_setup --disk-type=spdk_vhost_blk --force=$vm_no --os=$vm_img --disks=$disk"
vm_run $vm_no
vm_wait_for_boot 600 $vm_no

View File

@ -95,12 +95,12 @@ case $1 in
-ils|--integrity-lvol-scsi)
echo 'Running lvol integrity suite...'
./lvol/lvol_test.sh -x --fio-bin=$FIO_BIN \
--ctrl-type=vhost_scsi
--ctrl-type=spdk_vhost_scsi
;;
-ilb|--integrity-lvol-blk)
echo 'Running lvol integrity suite...'
./lvol/lvol_test.sh -x --fio-bin=$FIO_BIN \
--ctrl-type=vhost_blk
--ctrl-type=spdk_vhost_blk
;;
-hp|--hotplug)
echo 'Running hotplug tests suite...'