test/vhost: Export default VM_IMAGE from common.sh

Also, construct this path by grabbing the home directory
of the current user.

Change-Id: Ia8d5cc2be40c0c3ac693c80a3132b970f7124183
Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456704
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Ben Walker 2019-06-03 15:16:21 -07:00 committed by Darek Stojaczyk
parent 421a736b36
commit 4a770fa9f1
8 changed files with 9 additions and 14 deletions

View File

@ -152,7 +152,7 @@ parser.add_argument('-d', '--max-disks', default=0, type=int,
each virtual machine gets it's own bdev to work on.")
parser.add_argument('-v', '--vm-count', default=1, type=int,
help="How many VMs to run in test. Default: 1")
parser.add_argument('-i', '--vm-image', default="/home/sys_sgsw/vhost_vm_image.qcow2",
parser.add_argument('-i', '--vm-image', default="$HOME/vhost_vm_image.qcow2",
type=str, help="VM image to use for running VMs.")
subparsers = parser.add_subparsers()

View File

@ -20,7 +20,6 @@ NVMF_RPC="$rootdir/scripts/rpc.py -s $NVMF_SOCK"
VHOST_SOCK="/tmp/vhost_rpc.sock"
VHOST_APP="$rootdir/app/vhost/vhost -p 0 -r $VHOST_SOCK -u"
VHOST_RPC="$rootdir/scripts/rpc.py -s $VHOST_SOCK"
vm_image="/home/sys_sgsw/vhost_vm_image.qcow2"
timing_enter nvmf_vhost
nvmftestinit
@ -54,7 +53,7 @@ $VHOST_RPC construct_vhost_scsi_controller naa.VhostScsi0.3
$VHOST_RPC add_vhost_scsi_lun naa.VhostScsi0.3 0 "Nvme0n1"
# start qemu based VM.
vm_setup --os="$vm_image" --disk-type=spdk_vhost_scsi --disks="VhostScsi0" --force=3 --vhost-num=3
vm_setup --os="$VM_IMAGE" --disk-type=spdk_vhost_scsi --disks="VhostScsi0" --force=3 --vhost-num=3
vm_run 3

View File

@ -1,5 +1,6 @@
: ${SPDK_VHOST_VERBOSE=false}
: ${QEMU_PREFIX="/usr/local/qemu/spdk-3.0.0"}
: ${VM_IMAGE="$HOME/vhost_vm_image.qcow2"}
TEST_DIR=$(readlink -f $rootdir/..)

View File

@ -78,7 +78,7 @@ fi
# Set up and run VM
setup_cmd="vm_setup --disk-type=$ctrl_type --force=0"
setup_cmd+=" --os=/home/sys_sgsw/vhost_vm_image.qcow2"
setup_cmd+=" --os=$VM_IMAGE"
setup_cmd+=" --disks=Nvme0n1"
$setup_cmd

View File

@ -187,7 +187,7 @@ for (( i=0; i<$vm_count; i++)); do
if [[ $i%2 -ne 0 ]] && [[ $multi_os ]]; then
setup_cmd+=" --os=/home/sys_sgsw/spdk_vhost_CentOS_vm_image.qcow2"
else
setup_cmd+=" --os=/home/sys_sgsw/vhost_vm_image.qcow2"
setup_cmd+=" --os=$VM_IMAGE"
fi
# Create single SCSI controller or multiple BLK controllers for this VM

View File

@ -5,7 +5,6 @@ rootdir=$(readlink -f $testdir/../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/vhost/common.sh
DEFAULT_VM_IMAGE="/home/sys_sgsw/vhost_vm_image.qcow2"
CENTOS_VM_IMAGE="/home/sys_sgsw/spdk_vhost_CentOS_vm_image.qcow2"
DEFAULT_FIO_BIN="/home/sys_sgsw/fio_ubuntu"
CENTOS_FIO_BIN="/home/sys_sgsw/fio_ubuntu_bak"
@ -22,7 +21,7 @@ case $1 in
echo " -h |--help prints this message"
echo ""
echo "Environment:"
echo " VM_IMAGE path to QCOW2 VM image used during test (default: $DEFAULT_VM_IMAGE)"
echo " VM_IMAGE path to QCOW2 VM image used during test (default: $HOME/vhost_vm_image.qcow2)"
echo ""
echo "Tests are performed only on Linux machine. For other OS no action is performed."
echo ""
@ -38,7 +37,6 @@ if [[ $(uname -s) != Linux ]]; then
exit 0
fi
: ${VM_IMAGE="$DEFAULT_VM_IMAGE"}
: ${FIO_BIN="$DEFAULT_FIO_BIN"}
if [[ ! -r "${VM_IMAGE}" ]]; then

View File

@ -7,7 +7,6 @@ source $rootdir/test/vhost/common.sh
vm_count=1
vm_memory=2048
vm_image="/home/sys_sgsw/vhost_vm_image.qcow2"
vm_sar_enable=false
vm_sar_delay="0"
vm_sar_interval="1"
@ -46,7 +45,7 @@ function usage()
echo " --vm-memory=INT Amount of RAM memory (in MB) to pass to a single VM."
echo " Default: 2048 MB"
echo " --vm-image=PATH OS image to use for running the VMs."
echo " Default: /home/sys_sgsw/vhost_vm_image.qcow2"
echo " Default: \$HOME/vhost_vm_image.qcow2"
echo " --vm-sar-enable Measure CPU utilization on VM using sar."
echo " --vm-sar-delay=INT Wait for X seconds before sarting SAR measurement on VMs. Default: 0."
echo " --vm-sar-interval=INT Interval (seconds) argument for SAR. Default: 1s."
@ -117,7 +116,7 @@ while getopts 'xh-:' optchar; do
fio-iterations=*) fio_iterations="${OPTARG#*=}" ;;
vm-count=*) vm_count="${OPTARG#*=}" ;;
vm-memory=*) vm_memory="${OPTARG#*=}" ;;
vm-image=*) vm_image="${OPTARG#*=}" ;;
vm-image=*) VM_IMAGE="${OPTARG#*=}" ;;
vm-sar-enable) vm_sar_enable=true ;;
vm-sar-delay=*) vm_sar_delay="${OPTARG#*=}" ;;
vm-sar-interval=*) vm_sar_interval="${OPTARG#*=}" ;;
@ -282,7 +281,7 @@ for (( i=0; i<$vm_count; i++)); do
vm="vm_$i"
setup_cmd="vm_setup --disk-type=$ctrl_type --force=$i --memory=$vm_memory"
setup_cmd+=" --os=$vm_image"
setup_cmd+=" --os=$VM_IMAGE"
if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
$rpc_py construct_vhost_scsi_controller naa.0.$i

View File

@ -12,12 +12,10 @@ if [[ $(uname -s) != Linux ]]; then
exit 0
fi
DEFAULT_VM_IMAGE="/home/sys_sgsw/vhost_vm_image.qcow2"
CENTOS_VM_IMAGE="/home/sys_sgsw/spdk_vhost_CentOS_vm_image.qcow2"
DEFAULT_FIO_BIN="/home/sys_sgsw/fio_ubuntu"
CENTOS_FIO_BIN="/home/sys_sgsw/fio_ubuntu_bak"
: ${VM_IMAGE="$DEFAULT_VM_IMAGE"}
: ${FIO_BIN="$DEFAULT_FIO_BIN"}
if [[ ! -r "${VM_IMAGE}" ]]; then