test/vhost: modify vm_setup() to create setup with mixed disk types
vm_setup was creating setup with only one disk type defined. With this patch it can set disk type per disk by adding disk type after disk name separated by coma e.g. vm_setup --disks="Nvme0n1,spdk_vhost_scsi" Change-Id: Ib89f440210468f4c9082aadcf07ce461e34c4ff8 Signed-off-by: Pawel Niedzwiecki <pawelx.niedzwiecki@intel.com> Reviewed-on: https://review.gerrithub.io/395980 Reviewed-by: Karol Latecki <karol.latecki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
face9eb258
commit
d60c81e250
@ -420,7 +420,7 @@ function vm_setup()
|
|||||||
local os=""
|
local os=""
|
||||||
local os_mode=""
|
local os_mode=""
|
||||||
local qemu_args=""
|
local qemu_args=""
|
||||||
local disk_type=NOT_DEFINED
|
local disk_type_g=NOT_DEFINED
|
||||||
local disks=""
|
local disks=""
|
||||||
local raw_cache=""
|
local raw_cache=""
|
||||||
local vm_incoming=""
|
local vm_incoming=""
|
||||||
@ -435,7 +435,7 @@ function vm_setup()
|
|||||||
os=*) local os="${OPTARG#*=}" ;;
|
os=*) local os="${OPTARG#*=}" ;;
|
||||||
os-mode=*) local os_mode="${OPTARG#*=}" ;;
|
os-mode=*) local os_mode="${OPTARG#*=}" ;;
|
||||||
qemu-args=*) local qemu_args="${qemu_args} ${OPTARG#*=}" ;;
|
qemu-args=*) local qemu_args="${qemu_args} ${OPTARG#*=}" ;;
|
||||||
disk-type=*) local disk_type="${OPTARG#*=}" ;;
|
disk-type=*) local disk_type_g="${OPTARG#*=}" ;;
|
||||||
disks=*) local disks="${OPTARG#*=}" ;;
|
disks=*) local disks="${OPTARG#*=}" ;;
|
||||||
raw-cache=*) local raw_cache=",cache${OPTARG#*=}" ;;
|
raw-cache=*) local raw_cache=",cache${OPTARG#*=}" ;;
|
||||||
force=*) local force_vm=${OPTARG#*=} ;;
|
force=*) local force_vm=${OPTARG#*=} ;;
|
||||||
@ -574,11 +574,18 @@ function vm_setup()
|
|||||||
cmd+="-drive file=$os,if=none,id=os_disk ${eol}"
|
cmd+="-drive file=$os,if=none,id=os_disk ${eol}"
|
||||||
cmd+="-device ide-hd,drive=os_disk,bootindex=0 ${eol}"
|
cmd+="-device ide-hd,drive=os_disk,bootindex=0 ${eol}"
|
||||||
|
|
||||||
if ( [[ $disks == '' ]] && [[ $disk_type == virtio* ]] ); then
|
if ( [[ $disks == '' ]] && [[ $disk_type_g == virtio* ]] ); then
|
||||||
disks=1
|
disks=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for disk in ${disks//:/ }; do
|
for disk in ${disks//:/ }; do
|
||||||
|
if [[ $disk = *","* ]]; then
|
||||||
|
disk_type=${disk#*,}
|
||||||
|
disk=${disk%,*}
|
||||||
|
else
|
||||||
|
disk_type=$disk_type_g
|
||||||
|
fi
|
||||||
|
|
||||||
case $disk_type in
|
case $disk_type in
|
||||||
virtio)
|
virtio)
|
||||||
local raw_name="RAWSCSI"
|
local raw_name="RAWSCSI"
|
||||||
|
@ -10,29 +10,31 @@ function usage()
|
|||||||
echo "Shortcut script for setting up VMs for tests"
|
echo "Shortcut script for setting up VMs for tests"
|
||||||
echo "Usage: $(basename $1) [OPTIONS] VM_NUM"
|
echo "Usage: $(basename $1) [OPTIONS] VM_NUM"
|
||||||
echo
|
echo
|
||||||
echo "-h, --help print help and exit"
|
echo "-h, --help Print help and exit"
|
||||||
echo " --work-dir=WORK_DIR Where to find build file. Must exit. (default: $TEST_DIR)"
|
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 " --force=VM_NUM Force VM_NUM reconfiguration if already exist"
|
||||||
echo " --disk-type=TYPE Perform specified test:"
|
echo " --disk-type=TYPE Perform specified test:"
|
||||||
echo " virtio - test host virtio-scsi-pci using file as disk image"
|
echo " virtio - test host virtio-scsi-pci using file as disk image"
|
||||||
echo " kernel_vhost - use kernel driver vhost-scsi"
|
echo " kernel_vhost - use kernel driver vhost-scsi"
|
||||||
echo " spdk_vhost_scsi - use spdk vhost scsi"
|
echo " spdk_vhost_scsi - use spdk vhost scsi"
|
||||||
echo " spdk_vhost_blk - use spdk vhost block"
|
echo " spdk_vhost_blk - use spdk vhost block"
|
||||||
echo " --raw-cache=CACHE Use CACHE for virtio test: "
|
echo " --raw-cache=CACHE Use CACHE for virtio test: "
|
||||||
echo " writethrough, writeback, none, unsafe or directsyns"
|
echo " writethrough, writeback, none, unsafe or directsyns"
|
||||||
echo " --disk=PATH Disk to use in test. test specific meaning:"
|
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 " virtio - disk path (file or block device ex: /dev/nvme0n1)"
|
||||||
echo " kernel_vhost - the WWN number to be used"
|
echo " kernel_vhost - the WWN number to be used"
|
||||||
echo " spdk_vhost_[scsi|blk] - the socket path."
|
echo " spdk_vhost_[scsi|blk] - the socket path."
|
||||||
echo " --os=OS_QCOW2 Custom OS qcow2 image file"
|
echo " optional disk_type - set disk type for disk (overwrites test-type)"
|
||||||
echo " --os-mode=MODE MODE how to use provided image: default: backing"
|
echo " e.g. /dev/nvme0n1,spdk_vhost_scsi"
|
||||||
echo " backing - create new image but use provided backing file"
|
echo " --os=OS_QCOW2 Custom OS qcow2 image file"
|
||||||
echo " copy - copy provided image and use a copy"
|
echo " --os-mode=MODE MODE how to use provided image: default: backing"
|
||||||
echo " orginal - use file directly. Will modify the provided file"
|
echo " backing - create new image but use provided backing file"
|
||||||
echo " --incoming=VM_NUM Use VM_NUM as source migration VM."
|
echo " copy - copy provided image and use a copy"
|
||||||
echo " --migrate-to=VM_NUM Use VM_NUM as target migration VM."
|
echo " orginal - use file directly. Will modify the provided file"
|
||||||
echo "-x Turn on script debug (set -x)"
|
echo " --incoming=VM_NUM Use VM_NUM as source migration VM."
|
||||||
echo "-v Be more verbose"
|
echo " --migrate-to=VM_NUM Use VM_NUM as target migration VM."
|
||||||
|
echo "-x Turn on script debug (set -x)"
|
||||||
|
echo "-v Be more verbose"
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user