numam-spdk/test/vhost/common/vm_setup.sh
Changpeng Liu d08a33f5a3 test/vhost-blk: enable read only test for vhost-blk
The QEMU vhost-user-blk-pci host driver will not negotiate
VIRTIO_BLK_F_RO feature bit by default, users must append
`config-ro=true` to enable it if the backend device can
support read only feature.

Fix the issue #254.

Change-Id: I17dcc1b80bde094dd4873221b681d0c4049abb39
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/408266
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
2018-04-23 20:40:26 +00:00

79 lines
3.0 KiB
Bash
Executable File

#!/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