]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/test/nvmf/host/fio.sh
import 15.2.0 Octopus source
[ceph.git] / ceph / src / spdk / test / nvmf / host / fio.sh
CommitLineData
11fdf7f2
TL
1#!/usr/bin/env bash
2
3testdir=$(readlink -f $(dirname $0))
4rootdir=$(readlink -f $testdir/../../..)
5source $rootdir/test/common/autotest_common.sh
6source $rootdir/scripts/common.sh
7source $rootdir/test/nvmf/common.sh
8
9rpc_py="$rootdir/scripts/rpc.py"
10
11set -e
12
9f95a23c 13nvmftestinit
11fdf7f2
TL
14
15if [ ! -d /usr/src/fio ]; then
16 echo "FIO not available"
17 exit 0
18fi
19
20timing_enter fio
21timing_enter start_nvmf_tgt
22
23$NVMF_APP -m 0xF &
24nvmfpid=$!
25
9f95a23c 26trap "process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1" SIGINT SIGTERM EXIT
11fdf7f2
TL
27
28waitforlisten $nvmfpid
9f95a23c 29$rpc_py nvmf_create_transport -t $TEST_TRANSPORT -u 8192
11fdf7f2
TL
30timing_exit start_nvmf_tgt
31
9f95a23c 32$rpc_py construct_malloc_bdev 64 512 -b Malloc1
11fdf7f2 33$rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
9f95a23c
TL
34$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1
35$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
11fdf7f2
TL
36
37PLUGIN_DIR=$rootdir/examples/nvme/fio_plugin
38
39# Test fio_plugin as host with malloc backend
9f95a23c
TL
40fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \
41traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1"
42
43# second test mocking multiple SGL elements
44fio_nvme $PLUGIN_DIR/mock_sgl_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \
45traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1"
11fdf7f2
TL
46$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
47
48if [ $RUN_NIGHTLY -eq 1 ]; then
49 # Test fio_plugin as host with nvme lvol backend
50 bdfs=$(iter_pci_class_code 01 08 02)
9f95a23c
TL
51 $rpc_py construct_nvme_bdev -b Nvme0 -t PCIe -a $(echo $bdfs | awk '{ print $1 }') -i $NVMF_FIRST_TARGET_IP
52 ls_guid=$($rpc_py construct_lvol_store -c 1073741824 Nvme0n1 lvs_0)
11fdf7f2 53 get_lvs_free_mb $ls_guid
9f95a23c 54 $rpc_py construct_lvol_bdev -l lvs_0 lbd_0 $free_mb
11fdf7f2 55 $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode2 -a -s SPDK00000000000001
9f95a23c
TL
56 $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 lvs_0/lbd_0
57 $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode2 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
58 fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \
59 traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1"
11fdf7f2
TL
60 $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode2
61
62 # Test fio_plugin as host with nvme lvol nested backend
9f95a23c 63 ls_nested_guid=$($rpc_py construct_lvol_store --clear-method none lvs_0/lbd_0 lvs_n_0)
11fdf7f2 64 get_lvs_free_mb $ls_nested_guid
9f95a23c 65 $rpc_py construct_lvol_bdev -l lvs_n_0 lbd_nest_0 $free_mb
11fdf7f2 66 $rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode3 -a -s SPDK00000000000001
9f95a23c
TL
67 $rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode3 lvs_n_0/lbd_nest_0
68 $rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode3 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
69 fio_nvme $PLUGIN_DIR/example_config.fio --filename="trtype=$TEST_TRANSPORT adrfam=IPv4 \
70 traddr=$NVMF_FIRST_TARGET_IP trsvcid=$NVMF_PORT ns=1"
11fdf7f2
TL
71 $rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode3
72
73 sync
74 # Delete lvol_bdev and destroy lvol_store.
9f95a23c 75 $rpc_py destroy_lvol_bdev lvs_n_0/lbd_nest_0
11fdf7f2 76 $rpc_py destroy_lvol_store -l lvs_n_0
9f95a23c 77 $rpc_py destroy_lvol_bdev lvs_0/lbd_0
11fdf7f2
TL
78 $rpc_py destroy_lvol_store -l lvs_0
79 $rpc_py delete_nvme_controller Nvme0
80fi
81
82trap - SIGINT SIGTERM EXIT
83
9f95a23c
TL
84rm -f ./local-test-0-verify.state
85nvmftestfini
11fdf7f2 86timing_exit fio