Commit d08a33f5 authored by Changpeng Liu's avatar Changpeng Liu Committed by Daniel Verkamp
Browse files

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: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/408266


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
parent a8884c5b
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -164,9 +164,7 @@ if [ $SPDK_TEST_VHOST -eq 1 ]; then
		timing_enter vhost_migration
		run_test ./test/vhost/spdk_vhost.sh --migration
		timing_exit vhost_migration
	fi

	if [ $RUN_NIGHTLY_FAILING -eq 1 ]; then
		timing_enter readonly
		run_test ./test/vhost/spdk_vhost.sh --readonly
		timing_exit readonly
+3 −1
Original line number Diff line number Diff line
@@ -508,6 +508,7 @@ function vm_setup()
	local os_mode=""
	local qemu_args=""
	local disk_type_g=NOT_DEFINED
	local read_only="false"
	local disks=""
	local raw_cache=""
	local vm_incoming=""
@@ -524,6 +525,7 @@ function vm_setup()
				os-mode=*) local os_mode="${OPTARG#*=}" ;;
				qemu-args=*) local qemu_args="${qemu_args} ${OPTARG#*=}" ;;
				disk-type=*) local disk_type_g="${OPTARG#*=}" ;;
				read-only=*) local read_only="${OPTARG#*=}" ;;
				disks=*) local disks="${OPTARG#*=}" ;;
				raw-cache=*) local raw_cache=",cache${OPTARG#*=}" ;;
				force=*) local force_vm=${OPTARG#*=} ;;
@@ -713,7 +715,7 @@ function vm_setup()
			spdk_vhost_blk)
				notice "using socket $vhost_dir/naa.$disk.$vm_num"
				cmd+="-chardev socket,id=char_$disk,path=$vhost_dir/naa.$disk.$vm_num ${eol}"
				cmd+="-device vhost-user-blk-pci,num-queues=$queue_number,chardev=char_$disk ${eol}"
				cmd+="-device vhost-user-blk-pci,num-queues=$queue_number,chardev=char_$disk,config-ro=$read_only ${eol}"
				;;
			kernel_vhost)
				if [[ -z $disk ]]; then
+2 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ function usage()
	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:"
@@ -55,6 +56,7 @@ for param in "$@"; do
		--force=*) ;;
		--incoming=*) ;;
		--migrate-to=*) ;;
		--read-only=*) ;;
		-x)
			set -x
			continue
+1 −1
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ function blk_ro_tc1()
	notice "Creating vhost_blk controller"
	vhost_blk_name="naa.$disk_name.$vm_no"
	$rpc_py construct_vhost_blk_controller $vhost_blk_name $disk_name
	vm_setup --disk-type=spdk_vhost_blk --force=$vm_no --os=$vm_img --disks=$disk
	vm_setup --disk-type=spdk_vhost_blk --force=$vm_no --os=$vm_img --disks=$disk --read-only=true

	vm_run $vm_no
	vm_wait_for_boot 600 $vm_no