test/vfio_user: Restart vm, check if memory region register/unregister failed

Signed-off-by: Jun Wen <junx.wen@intel.com>
Change-Id: Ib18e8c3971da53f91de5352eaa476b4acd0ce4db
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10377
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Michal Berger <michalx.berger@intel.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
junwenx 2021-11-24 17:28:24 +08:00 committed by Tomasz Zawadzki
parent a0d255ac02
commit f9c496b8e2
2 changed files with 52 additions and 0 deletions

View File

@ -10,5 +10,6 @@ echo "Running SPDK vfio-user fio autotest..."
vhosttestinit
run_test "vfio_user_fio" $WORKDIR/vfio_user_fio/vfio_user_fio.sh
run_test "vfio_user_restart_vm" $WORKDIR/vfio_user_restart_vm/vfio_user_restart_vm.sh
vhosttestfini

View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/vhost/common.sh
source $rootdir/test/vfio_user/common.sh
bdfs=($(get_nvme_bdfs))
rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
trap 'clean_vfio_user "${FUNCNAME}" "${LINENO}"' ERR EXIT
vhosttestinit
vfio_user_run 0
vm_muser_dir="$VM_DIR/1/muser"
rm -rf $vm_muser_dir
mkdir -p $vm_muser_dir/domain/muser1/1
$rpc_py bdev_nvme_attach_controller -b Nvme0 -t pcie -a ${bdfs[0]}
$rpc_py nvmf_create_subsystem nqn.2019-07.io.spdk:cnode1 -s SPDK001 -a
$rpc_py nvmf_subsystem_add_ns nqn.2019-07.io.spdk:cnode1 Nvme0n1
$rpc_py nvmf_subsystem_add_listener nqn.2019-07.io.spdk:cnode1 -t VFIOUSER -a $vm_muser_dir/domain/muser1/1 -s 0
vm_setup --disk-type=vfio_user --force=1 --os=$VM_IMAGE --disks="1"
vm_run 1
vm_wait_for_boot 60 1
vm_exec 1 "lsblk"
# execute "poweroff" for vm 1
vm_shutdown_all
# re-launch the vm to see if memory region register / unregister will failed
vm_setup --disk-type=vfio_user --force=1 --os=$VM_IMAGE --disks="1"
vm_run 1
vm_wait_for_boot 60 1
vm_exec 1 "lsblk"
vm_shutdown_all
$rpc_py nvmf_subsystem_remove_listener nqn.2019-07.io.spdk:cnode1 -t vfiouser -a $vm_muser_dir/domain/muser1/1 -s 0
$rpc_py nvmf_delete_subsystem nqn.2019-07.io.spdk:cnode1
$rpc_py bdev_nvme_detach_controller Nvme0
vhost_kill 0
trap - ERR EXIT
vhosttestfini