]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/vhost/windows/windows_scsi_compliance.sh
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / test / vhost / windows / windows_scsi_compliance.sh
1 #!/usr/bin/env bash
2
3 testdir=$(readlink -f $(dirname $0))
4 rootdir=$(readlink -f $testdir/../../..)
5 source $rootdir/test/common/autotest_common.sh
6 source $rootdir/test/vhost/common.sh
7
8 # Tested with windows vm with OS Name: Microsoft Windows Server 2012 R2 Datacenter
9 # and OS Version: 6.3.9600 N/A Build 9600
10 # In order to run this test with windows vm
11 # windows virtio scsi driver must be installed
12 WINDOWS_IMG="/home/sys_sgsw/windows_scsi_compliance/windows_vm_image.qcow2"
13 aio_file="$SPDK_TEST_STORAGE/aio_disk"
14 ssh_pass=""
15 vm_num=1
16 keep_results_dir=false
17 rpc_py="$rootdir/scripts/rpc.py -s $(get_vhost_dir 0)/rpc.sock"
18
19 function usage() {
20 [[ -n $2 ]] && (
21 echo "$2"
22 echo ""
23 )
24 echo "Windows Server scsi compliance test"
25 echo "Usage: $(basename $1) [OPTIONS]"
26 echo " --vm-ssh-pass=PASSWORD Text password for the VM"
27 echo " --vm-image-path Path of windows image"
28 echo " --keep_results Do not delete dir with results"
29
30 exit 0
31 }
32
33 while getopts 'h-:' optchar; do
34 case "$optchar" in
35 -)
36 case "$OPTARG" in
37 help) usage $0 ;;
38 vm-ssh-pass=*) ssh_pass="${OPTARG#*=}" ;;
39 vm-image-path=*) WINDOWS_IMG="${OPTARG#*=}" ;;
40 keep_results*) keep_results_dir=true ;;
41 esac
42 ;;
43 h) usage $0 ;;
44 *) usage $0 "Invalid argument '$OPTARG'" ;;
45 esac
46 done
47
48 trap 'rm -f $aio_file; rm -rf $testdir/results; error_exit' SIGINT SIGTERM ERR
49
50 VM_PASSWORD="$ssh_pass"
51 mkdir -p $testdir/results
52 dd if=/dev/zero of=$aio_file bs=1M count=512
53
54 timing_enter vhost_run
55 vhost_run 0
56 $rpc_py bdev_nvme_set_hotplug -e
57 $rpc_py bdev_malloc_create 256 4096 -b Malloc0
58 $rpc_py bdev_aio_create $aio_file Aio0 512
59 $rpc_py bdev_get_bdevs
60 $rpc_py vhost_create_scsi_controller naa.vhost.1
61 $rpc_py vhost_scsi_controller_add_target naa.vhost.1 0 Nvme0n1
62 $rpc_py vhost_scsi_controller_add_target naa.vhost.1 1 Malloc0
63 # TODO: Currently there is bug for aio device. Disable this test
64 # $rpc_py vhost_scsi_controller_add_target naa.vhost.1 2 Aio0
65 timing_exit vhost_run
66
67 timing_enter start_vm
68 vm_setup --force=1 --disk-type=spdk_vhost_scsi --os=$WINDOWS_IMG --disks=vhost --memory=4096
69 vm_run "1"
70 # Wait until VM goes up
71 vm_wait_for_boot "300" "$vm_num"
72 timing_exit start_vm
73
74 vm_scp "$vm_num" $testdir/windows_scsi_compliance.ps1 127.0.0.1:/cygdrive/c/SCSI/
75 vm_sshpass "$vm_num" "$ssh_pass" "cd /cygdrive/c/SCSI; powershell.exe -file windows_scsi_compliance.ps1"
76 vm_scp "$vm_num" 127.0.0.1:/cygdrive/c/SCSI/WIN_SCSI_* $testdir/results/
77 dos2unix $testdir/results/WIN_SCSI_*.log
78
79 notice "Kill vm 1"
80 vm_kill "$vm_num"
81 notice "Kill spdk"
82 vhost_kill 0
83 notice "Remove $aio_file"
84 rm -f $aio_file
85
86 python3 $testdir/windows_scsi_compliance.py
87 if ! $keep_results_dir; then
88 rm -rf $testdir/results
89 fi