numam-spdk/test/vhost/fiotest/vm_shutdown.sh
Piotr Pelplinski 1dbf53eebf vhost: add a library and app for userspace vhost-scsi processing
This patch adds a library, application and test scripts for extending
SPDK to present virtio-scsi controllers to QEMU-based VMs and
process I/O submitted to devices attached to those controllers.
This functionality is dependent on QEMU patches to enable
vhost-scsi in userspace - those patches are currently working their
way through the QEMU mailing list, but temporary patches to enable
this functionality in QEMU will be made available shortly through the
SPDK github repository.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Krzysztof Jakimiak <krzysztof.jakimiak@intel.com>
Signed-off-by: Michal Kosciowski <michal.kosciowski@intel.com>
Signed-off-by: Karol Latecki <karolx.latecki@intel.com>
Signed-off-by: Piotr Pelplinski <piotr.pelplinski@intel.com>
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Signed-off-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>

Signed-off-by: Krzysztof Jakimiak <krzysztof.jakimiak@intel.com>
Change-Id: I138e4021f0ac4b1cd9a6e4041783cdf06e6f0efb
2017-03-06 12:44:35 -07:00

66 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
BASE_DIR=$(readlink -f $(dirname $0))
[[ -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
. $BASE_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
echo 'INFO: killing all VMs'
vm_kill_all
else
echo 'INFO: shutting down all VMs'
vm_shutdown_all
fi
else
shift $((OPTIND-1))
if do_kill; then
echo 'INFO: killing VMs: $@'
for vm in $@; do
vm_kill $vm
done
else
echo 'INFO: shutting down all VMs'
vm_shutdown_all
fi
fi