]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/test/nvmf/filesystem/filesystem.sh
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / spdk / test / nvmf / filesystem / filesystem.sh
1 #!/usr/bin/env bash
2
3 testdir=$(readlink -f $(dirname $0))
4 rootdir=$(readlink -f $testdir/../../..)
5 source $rootdir/scripts/autotest_common.sh
6 source $rootdir/test/nvmf/common.sh
7
8 MALLOC_BDEV_SIZE=64
9 MALLOC_BLOCK_SIZE=512
10
11 rpc_py="python $rootdir/scripts/rpc.py"
12
13 set -e
14
15 if ! rdma_nic_available; then
16 echo "no NIC for nvmf test"
17 exit 0
18 fi
19
20 timing_enter fs_test
21
22 # Start up the NVMf target in another process
23 $rootdir/app/nvmf_tgt/nvmf_tgt -c $testdir/../nvmf.conf &
24 nvmfpid=$!
25
26 trap "killprocess $nvmfpid; exit 1" SIGINT SIGTERM EXIT
27
28 waitforlisten $nvmfpid ${RPC_PORT}
29
30 bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
31 bdevs="$bdevs $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
32
33 modprobe -v nvme-rdma
34
35 $rpc_py construct_nvmf_subsystem Direct nqn.2016-06.io.spdk:cnode1 'transport:RDMA traddr:192.168.100.8 trsvcid:4420' '' -p "*"
36 $rpc_py construct_nvmf_subsystem Virtual nqn.2016-06.io.spdk:cnode2 'transport:RDMA traddr:192.168.100.8 trsvcid:4420' '' -s SPDK00000000000001 -n "$bdevs"
37
38 nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
39 nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode2" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
40
41 mkdir -p /mnt/device
42
43 devs=`lsblk -l -o NAME | grep nvme`
44
45 for dev in $devs; do
46 timing_enter parted
47 parted -s /dev/$dev mklabel msdos mkpart primary '0%' '100%'
48 timing_exit parted
49 sleep 1
50
51 for fstype in "ext4" "btrfs" "xfs"; do
52 timing_enter $fstype
53 if [ $fstype = ext4 ]; then
54 force=-F
55 else
56 force=-f
57 fi
58
59 mkfs.${fstype} $force /dev/${dev}p1
60
61 mount /dev/${dev}p1 /mnt/device
62 touch /mnt/device/aaa
63 sync
64 rm /mnt/device/aaa
65 sync
66 umount /mnt/device
67 timing_exit $fstype
68 done
69
70 parted -s /dev/$dev rm 1
71 done
72
73 sync
74 nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true
75 nvme disconnect -n "nqn.2016-06.io.spdk:cnode2" || true
76
77 $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
78 $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode2
79
80 trap - SIGINT SIGTERM EXIT
81
82 nvmfcleanup
83 killprocess $nvmfpid
84 timing_exit fs_test