]>
git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/vhost/fiotest/vm_setup.sh
3 BASE_DIR
=$
(readlink
-f $
(dirname $0))
4 [[ -z "$TEST_DIR" ]] && TEST_DIR
="$(cd $BASE_DIR/../../../../ && pwd)"
8 [[ ! -z $2 ]] && ( echo "$2"; echo ""; )
9 echo "Shortcut script for setting up VMs for tests"
10 echo "Usage: $(basename $1) [OPTIONS] VM_NUM"
12 echo "-h, --help print help and exit"
13 echo "-f VM_NUM Force VM_NUM reconfiguration if already exist"
14 echo " --work-dir=WORK_DIR Where to find build file. Must exit. (default: $TEST_DIR)"
15 echo " --test-type=TYPE Perform specified test:"
16 echo " virtio - test host virtio-scsi-pci using file as disk image"
17 echo " kernel_vhost - use kernel driver vhost-scsi"
18 echo " spdk_vhost - use spdk vhost"
19 echo " ---cache=CACHE Use CACHE for virtio test: "
20 echo " writethrough, writeback, none, unsafe or directsyns"
21 echo " Default is writethrough"
22 echo " --disk=PATH Disk to use in test. test specific meaning:"
23 echo " virtio - disk path (file or block device ex: /dev/nvme0n1)"
24 echo " kernel_vhost - the WWN number to be used"
25 echo " spdk_vhost - the socket path. Default is WORK_DIR/vhost/usvhost"
26 echo " --os=OS_QCOW2 Custom OS qcow2 image file"
27 echo " --os-mode=MODE MODE how to use provided image: default: backing"
28 echo " backing - create new image but use provided backing file"
29 echo " copy - copy provided image and use a copy"
30 echo " orginal - use file directly. Will modify the provided file"
31 echo "-x Turn on script debug (set -x)"
38 while getopts 'xf:h-:' optchar
; do
43 work-dir
=*) TEST_DIR
="${OPTARG#*=}" ;;
44 raw-cache
=*) raw_cache
="--raw-cache=${OPTARG#*=}" ;;
45 test-type
=*) test_type
="${OPTARG#*=}" ;;
46 disk
=*) disk
="${OPTARG#*=}" ;;
47 os
=*) os
="${OPTARG#*=}"
48 if [[ ! -r "$os" ]]; then
49 echo "ERROR: can't read '$os'"
52 os
="$(readlink -f $os)"
54 os-mode
=*) os_mode
="--os-mode=${OPTARG#*=}" ;;
55 *) usage
$0 "Invalid argument '$OPTARG'" ;;
60 f
) force_vm_num
="--force=${OPTARG#*=}" ;;
61 *) usage
$0 "Invalid argument '$OPTARG'" ;;
67 [[ -z "$os" ]] && os
="$TEST_DIR/debian.qcow2"
68 [[ $test_type == "spdk_vhost" ]] && [[ -z "$disk" ]] && disk
="$SPDK_VHOST_SCSI_TEST_DIR/usvhost"
69 if [[ $test_type == "kernel_vhost" ]] && [[ -z "$disk" ]]; then
70 echo "ERROR: for $test_type '--disk=WWN' is mandatory"
76 --disk-type=$test_type \
78 $wwn $raw_cache $force_vm_num $os_mode