]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/spdk/test/vhost/integrity/integrity_start.sh
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / test / vhost / integrity / integrity_start.sh
index 1a6b0c2f92ff14465c0d1c7e8835a18f647fb6f3..ff3e98bda89a6c6ec6e70c3bf0e6abe939ecc904 100755 (executable)
@@ -1,5 +1,4 @@
 #!/usr/bin/env bash
-set -e
 
 testdir=$(readlink -f $(dirname $0))
 rootdir=$(readlink -f $testdir/../../..)
@@ -9,9 +8,11 @@ source $rootdir/test/vhost/common.sh
 ctrl_type="spdk_vhost_scsi"
 vm_fs="ext4"
 
-function usage()
-{
-       [[ ! -z $2 ]] && ( echo "$2"; echo ""; )
+function usage() {
+       [[ -n $2 ]] && (
+               echo "$2"
+               echo ""
+       )
        echo "Shortcut script for doing automated test"
        echo "Usage: $(basename $1) [OPTIONS]"
        echo
@@ -26,34 +27,35 @@ function usage()
        exit 0
 }
 
-function clean_lvol_cfg()
-{
+function clean_lvol_cfg() {
        notice "Removing lvol bdev and lvol store"
-       $rpc_py destroy_lvol_bdev lvol_store/lvol_bdev
-       $rpc_py destroy_lvol_store -l lvol_store
+       $rpc_py bdev_lvol_delete lvol_store/lvol_bdev
+       $rpc_py bdev_lvol_delete_lvstore -l lvol_store
 }
 
 while getopts 'xh-:' optchar; do
        case "$optchar" in
                -)
-               case "$OPTARG" in
-                       help) usage $0 ;;
-                       ctrl-type=*) ctrl_type="${OPTARG#*=}" ;;
-                       fs=*) vm_fs="${OPTARG#*=}" ;;
-                       *) usage $0 "Invalid argument '$OPTARG'" ;;
-               esac
-               ;;
-       h) usage $0 ;;
-       x) set -x
-               x="-x" ;;
-       *) usage $0 "Invalid argument '$OPTARG'"
+                       case "$OPTARG" in
+                               help) usage $0 ;;
+                               ctrl-type=*) ctrl_type="${OPTARG#*=}" ;;
+                               fs=*) vm_fs="${OPTARG#*=}" ;;
+                               *) usage $0 "Invalid argument '$OPTARG'" ;;
+                       esac
+                       ;;
+               h) usage $0 ;;
+               x)
+                       set -x
+                       x="-x"
+                       ;;
+               *) usage $0 "Invalid argument '$OPTARG'" ;;
        esac
 done
 
 vhosttestinit
 
 . $(readlink -e "$(dirname $0)/../common.sh") || exit 1
-rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir)/rpc.sock"
+rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
 
 trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
 
@@ -61,25 +63,25 @@ trap 'error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
 vm_kill_all
 
 notice "Starting SPDK vhost"
-vhost_run
+vhost_run 0
 notice "..."
 
 # Set up lvols and vhost controllers
 trap 'clean_lvol_cfg; error_exit "${FUNCNAME}" "${LINENO}"' SIGTERM SIGABRT ERR
-notice "Constructing lvol store and lvol bdev on top of Nvme0n1"
-lvs_uuid=$($rpc_py construct_lvol_store Nvme0n1 lvol_store)
-$rpc_py construct_lvol_bdev lvol_bdev 10000 -l lvol_store
+notice "Creating lvol store and lvol bdev on top of Nvme0n1"
+lvs_uuid=$($rpc_py bdev_lvol_create_lvstore Nvme0n1 lvol_store)
+$rpc_py bdev_lvol_create lvol_bdev 10000 -l lvol_store
 
 if [[ "$ctrl_type" == "spdk_vhost_scsi" ]]; then
-       $rpc_py construct_vhost_scsi_controller naa.Nvme0n1.0
-       $rpc_py add_vhost_scsi_lun naa.Nvme0n1.0 0 lvol_store/lvol_bdev
+       $rpc_py vhost_create_scsi_controller naa.Nvme0n1.0
+       $rpc_py vhost_scsi_controller_add_target naa.Nvme0n1.0 0 lvol_store/lvol_bdev
 elif [[ "$ctrl_type" == "spdk_vhost_blk" ]]; then
-       $rpc_py construct_vhost_blk_controller naa.Nvme0n1.0 lvol_store/lvol_bdev
+       $rpc_py vhost_create_blk_controller naa.Nvme0n1.0 lvol_store/lvol_bdev
 fi
 
 # Set up and run VM
 setup_cmd="vm_setup --disk-type=$ctrl_type --force=0"
-setup_cmd+=" --os=/home/sys_sgsw/vhost_vm_image.qcow2"
+setup_cmd+=" --os=$VM_IMAGE"
 setup_cmd+=" --disks=Nvme0n1"
 $setup_cmd
 
@@ -89,16 +91,16 @@ vm_wait_for_boot 300 0
 
 # Run tests on VM
 vm_scp 0 $testdir/integrity_vm.sh root@127.0.0.1:/root/integrity_vm.sh
-vm_ssh 0 "~/integrity_vm.sh $ctrl_type \"$vm_fs\""
+vm_exec 0 "/root/integrity_vm.sh $ctrl_type \"$vm_fs\""
 
 notice "Shutting down virtual machine..."
 vm_shutdown_all
 
 clean_lvol_cfg
 
-$rpc_py delete_nvme_controller Nvme0
+$rpc_py bdev_nvme_detach_controller Nvme0
 
 notice "Shutting down SPDK vhost app..."
-vhost_kill
+vhost_kill 0
 
 vhosttestfini