diff --git a/test/vhost/common/run_vhost.sh b/test/vhost/common/run_vhost.sh deleted file mode 100755 index 2b4940d65..000000000 --- a/test/vhost/common/run_vhost.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env bash - -BASE_DIR=$(readlink -f $(dirname $0)) -[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" -[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" - -vhost_num="" - -function usage() -{ - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) - echo "Shortcut script for running vhost app." - echo "Usage: $(basename $1) [-x] [-h|--help] [--clean-build] [--work-dir=PATH]" - echo "-h, --help print help and exit" - echo "-x Set -x for script debug" - echo " --work-dir=PATH Where to find source/project. [default=$TEST_DIR]" - echo " --conf-dir=PATH Path to directory with configuration for vhost" - echo " --vhost-num=NUM Optional: vhost instance NUM to start. Default: 0" - - exit 0 -} - -run_in_background=false -while getopts 'xh-:' optchar; do - case "$optchar" in - -) - case "$OPTARG" in - help) usage $0 ;; - work-dir=*) TEST_DIR="${OPTARG#*=}" ;; - conf-dir=*) CONF_DIR="${OPTARG#*=}" ;; - vhost-num=*) vhost_num="${OPTARG}" ;; - *) usage $0 echo "Invalid argument '$OPTARG'" ;; - esac - ;; - h) usage $0 ;; - x) set -x ;; - *) usage $0 "Invalid argument '$optchar'" ;; - esac -done - -if [[ $EUID -ne 0 ]]; then - fail "Go away user come back as root" -fi - -notice "$0" -notice "" - -. $COMMON_DIR/../common.sh - -# Starting vhost with valid options -spdk_vhost_run $vhost_num --conf-path=$CONF_DIR diff --git a/test/vhost/common/vm_run.sh b/test/vhost/common/vm_run.sh deleted file mode 100755 index 53937871c..000000000 --- a/test/vhost/common/vm_run.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -BASE_DIR=$(readlink -f $(dirname $0)) -[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" -[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" - -function usage() -{ - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) - echo "Shortcut script for enabling VMs" - echo "Usage: $(basename $1) [OPTIONS] VM..." - echo - echo "-h, --help print help and exit" - echo " --work-dir=WORK_DIR Where to find build file. Must exist. [default: ./..]" - echo "-a Run all VMs in WORK_DIR" - echo "-x set -x for script debug" - exit 0 -} -run_all=false -while getopts 'xah-:' optchar; do - case "$optchar" in - -) - case "$OPTARG" in - help) usage $0 ;; - work-dir=*) TEST_DIR="${OPTARG#*=}" ;; - *) usage $0 "Invalid argument '$OPTARG'" ;; - esac - ;; - h) usage $0 ;; - a) run_all=true ;; - x) set -x ;; - *) usage $0 "Invalid argument '$OPTARG'" - esac -done - -. $COMMON_DIR/../common.sh - -if [[ $EUID -ne 0 ]]; then - fail "Go away user come back as root" -fi - -if $run_all; then - vm_run -a -else - shift $((OPTIND-1)) - notice "running VMs: $@" - vm_run "$@" -fi diff --git a/test/vhost/common/vm_setup.sh b/test/vhost/common/vm_setup.sh deleted file mode 100755 index 06e4731dc..000000000 --- a/test/vhost/common/vm_setup.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env bash - -BASE_DIR=$(readlink -f $(dirname $0)) -[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" -[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" - -function usage() -{ - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) - echo "Shortcut script for setting up VMs for tests" - echo "Usage: $(basename $1) [OPTIONS] VM_NUM" - echo - echo "-h, --help Print help and exit" - echo " --work-dir=WORK_DIR Where to find build file. Must exit. (default: $TEST_DIR)" - echo " --force=VM_NUM Force VM_NUM reconfiguration if already exist" - echo " --disk-type=TYPE Perform specified test:" - echo " virtio - test host virtio-scsi-pci using file as disk image" - echo " kernel_vhost - use kernel driver vhost-scsi" - echo " spdk_vhost_scsi - use spdk vhost scsi" - echo " spdk_vhost_blk - use spdk vhost block" - echo " --read-only=true|false Enable/Disable read only for vhost_blk tests" - echo " --raw-cache=CACHE Use CACHE for virtio test: " - echo " writethrough, writeback, none, unsafe or directsyns" - echo " --disk=PATH[,disk_type] Disk to use in test. test specific meaning:" - echo " virtio - disk path (file or block device ex: /dev/nvme0n1)" - echo " kernel_vhost - the WWN number to be used" - echo " spdk_vhost_[scsi|blk] - the socket path." - echo " optional disk_type - set disk type for disk (overwrites test-type)" - echo " e.g. /dev/nvme0n1,spdk_vhost_scsi" - echo " --os=OS_QCOW2 Custom OS qcow2 image file" - echo " --os-mode=MODE MODE how to use provided image: default: backing" - echo " backing - create new image but use provided backing file" - echo " copy - copy provided image and use a copy" - echo " orginal - use file directly. Will modify the provided file" - echo " --incoming=VM_NUM Use VM_NUM as source migration VM." - echo " --migrate-to=VM_NUM Use VM_NUM as target migration VM." - echo " --vhost-num=NUM Optional: vhost instance NUM to be used by this VM. Default: 0" - echo "-x Turn on script debug (set -x)" - echo "-v Be more verbose" - exit 0 -} - -setup_params=() -for param in "$@"; do - case "$param" in - --help|-h) usage $0 ;; - --work-dir=*) - TEST_DIR="${param#*=}" - continue - ;; - --raw-cache=*) ;; - --disk-type=*) ;; - --disks=*) ;; - --os=*) ;; - --os-mode=*) ;; - --force=*) ;; - --incoming=*) ;; - --migrate-to=*) ;; - --read-only=*) ;; - -x) - set -x - continue - ;; - -v) - SPDK_VHOST_VERBOSE=true - continue - ;; - *) usage $0 "Invalid argument '$param'" ;; - esac - - setup_params+=( "$param" ) -done - -. $COMMON_DIR/../common.sh - -vm_setup ${setup_params[@]} - -trap -- ERR diff --git a/test/vhost/common/vm_shutdown.sh b/test/vhost/common/vm_shutdown.sh deleted file mode 100755 index f8e76298f..000000000 --- a/test/vhost/common/vm_shutdown.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env bash - -BASE_DIR=$(readlink -f $(dirname $0)) -[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" -[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" - -function usage() -{ - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) - echo "Shortcut script for shutting down VMs" - echo "Usage: $(basename $1) [OPTIONS] [VMs]" - echo - echo "-h, --help print help and exit" - echo " --work-dir=WORK_DIR Where to find build file. Must exist. [default: ./..]" - echo "-a kill/shutdown all running VMs" - echo "-k kill instead of shutdown" - exit 0 -} -optspec='akh-:' -do_kill=false -all=false - -while getopts "$optspec" optchar; do - case "$optchar" in - -) - case "$OPTARG" in - help) usage $0 ;; - work-dir=*) TEST_DIR="${OPTARG#*=}" ;; - *) usage $0 "Invalid argument '$OPTARG'" ;; - esac - ;; - h) usage $0 ;; - k) do_kill=true ;; - a) all=true ;; - *) usage $0 "Invalid argument '$OPTARG'" - esac -done - -. $COMMON_DIR/../common.sh - -if $do_kill && [[ $EUID -ne 0 ]]; then - echo "Go away user come back as root" - exit 1 -fi - -if $all; then - if do_kill; then - notice "killing all VMs" - vm_kill_all - else - notice "shutting down all VMs" - vm_shutdown_all - fi -else - shift $((OPTIND-1)) - - if do_kill; then - notice "INFO: killing VMs: $@" - for vm in $@; do - vm_kill $vm - done - else - notice "shutting down all VMs" - vm_shutdown_all - fi -fi diff --git a/test/vhost/common/vm_ssh.sh b/test/vhost/common/vm_ssh.sh deleted file mode 100755 index fa34d2cd1..000000000 --- a/test/vhost/common/vm_ssh.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -BASE_DIR=$(readlink -f $(dirname $0)) -[[ -z "$COMMON_DIR" ]] && COMMON_DIR="$(cd $BASE_DIR/../common && pwd)" -[[ -z "$TEST_DIR" ]] && TEST_DIR="$(cd $BASE_DIR/../../../../ && pwd)" - -function usage() -{ - [[ ! -z $2 ]] && ( echo "$2"; echo ""; ) - echo "Shortcut script for connecting to or executing command on selected VM" - echo "Usage: $(basename $1) [OPTIONS] VM_NUMBER" - echo - echo "-h, --help print help and exit" - echo " --work-dir=WORK_DIR Where to find build file. Must exist. [default: $TEST_DIR]" - echo "-w Don't wait for vm to boot" - echo "-x set -x for script debug" - exit 0 -} - -boot_wait=true -while getopts 'xwh-:' optchar; do - case "$optchar" in - -) - case "$OPTARG" in - help) usage $0 ;; - work-dir=*) TEST_DIR="${OPTARG#*=}" ;; - *) usage $0 "Invalid argument '$OPTARG'" ;; - esac ;; - h) usage $0 ;; - w) boot_wait=false ;; - x) set -x ;; - *) usage $0 "Invalid argument '$OPTARG'" ;; - esac -done - -. $COMMON_DIR/../common.sh - -shift $((OPTIND-1)) -vm_num="$1" -shift - - -if ! vm_num_is_valid $vm_num; then - usage $0 "Invalid VM num $vm_num" - exit 1 -fi - -if $boot_wait; then - while ! vm_os_booted $vm_num; do - if ! vm_is_running $vm_num; then - fail "VM$vm_num is not running" - fi - notice "waiting for VM$vm_num to boot" - sleep 1 - done -fi - -vm_ssh $vm_num "$@"