1 # Set -m option is needed to be able to use "suspend" command
2 # as we are usin non-interactive session to connect to remote.
3 # Without -m it would be not possible to suspend the process.
5 source $testdir/autotest.config
9 target_vm_ctrl
=naa.VhostScsi0.
$target_vm
10 rpc
="$rootdir/scripts/rpc.py -s $(get_vhost_dir 1)/rpc.sock"
11 share_dir
=$TEST_DIR/share
13 function host_2_cleanup_vhost
()
15 notice
"Shutting down VM $target_vm"
18 notice
"Removing bdev & controller from vhost 1 on remote server"
19 $rpc delete_nvme_controller Nvme0
20 $rpc remove_vhost_controller
$target_vm_ctrl
22 notice
"Shutting down vhost app"
27 function host_2_start_vhost
()
29 echo "BASE DIR $TEST_DIR"
30 vhost_work_dir
=$TEST_DIR/vhost1
31 mkdir
-p $vhost_work_dir
32 rm -f $vhost_work_dir/*
34 notice
"Starting vhost 1 instance on remote server"
35 trap 'host_2_cleanup_vhost; error_exit "${FUNCNAME}" "${LINENO}"' INT ERR EXIT
36 vhost_run
--vhost-num=1 --no-pci
38 $rpc construct_nvme_bdev
-b Nvme0
-t rdma
-f ipv4
-a $RDMA_TARGET_IP -s 4420 -n "nqn.2018-02.io.spdk:cnode1"
39 $rpc construct_vhost_scsi_controller
$target_vm_ctrl
40 $rpc add_vhost_scsi_lun
$target_vm_ctrl 0 Nvme0n1
42 vm_setup
--os="$os_image" --force=$target_vm --disk-type=spdk_vhost_scsi
--disks=VhostScsi0 \
43 --memory=512 --vhost-num=1 --incoming=$incoming_vm
47 # Use this file as a flag to notify main script
48 # that setup on remote server is done
49 echo "DONE" > $share_dir/DONE
52 echo $$
> $TEST_DIR/tc3b.pid
56 if ! vm_os_booted
$target_vm; then
57 fail
"VM$target_vm is not running!"
60 if ! is_fio_running
$target_vm; then
61 vm_ssh
$target_vm "cat /root/migration-tc3.job.out"
62 error
"FIO is not running on remote server after migration!"
65 notice
"Waiting for FIO to finish on remote server VM"
67 while is_fio_running
$target_vm; do
70 if (( timeout--
== 0 )); then
71 error
"timeout while waiting for FIO!"
75 notice
"FIO result after migration:"
76 vm_ssh
$target_vm "cat /root/migration-tc3.job.out"
79 echo "DONE" > $share_dir/DONE