diff --git a/autotest.sh b/autotest.sh index 378b454ac5..1ce4fad893 100755 --- a/autotest.sh +++ b/autotest.sh @@ -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 diff --git a/test/vhost/common/common.sh b/test/vhost/common/common.sh index fb001c31e4..4b50cd64c8 100644 --- a/test/vhost/common/common.sh +++ b/test/vhost/common/common.sh @@ -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 diff --git a/test/vhost/common/vm_setup.sh b/test/vhost/common/vm_setup.sh index 04925da229..7e3599fd0d 100755 --- a/test/vhost/common/vm_setup.sh +++ b/test/vhost/common/vm_setup.sh @@ -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 diff --git a/test/vhost/readonly/readonly.sh b/test/vhost/readonly/readonly.sh index d42212ce8a..bd273e85dc 100755 --- a/test/vhost/readonly/readonly.sh +++ b/test/vhost/readonly/readonly.sh @@ -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