2017-09-07 10:34:34 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2017-09-07 10:34:34 +00:00
|
|
|
source $rootdir/test/nvmf/common.sh
|
|
|
|
|
2018-08-09 01:04:43 +00:00
|
|
|
MALLOC_BDEV_SIZE=64
|
2017-09-07 10:34:34 +00:00
|
|
|
MALLOC_BLOCK_SIZE=512
|
2019-04-25 21:45:45 +00:00
|
|
|
LVOL_BDEV_INIT_SIZE=20
|
|
|
|
LVOL_BDEV_FINAL_SIZE=30
|
2017-09-07 10:34:34 +00:00
|
|
|
|
2018-09-11 13:26:14 +00:00
|
|
|
rpc_py="$rootdir/scripts/rpc.py"
|
2017-09-07 10:34:34 +00:00
|
|
|
|
2019-05-13 19:11:00 +00:00
|
|
|
timing_enter lvol_integrity
|
2019-05-16 19:38:53 +00:00
|
|
|
nvmftestinit
|
2019-05-13 19:11:00 +00:00
|
|
|
nvmfappstart "-m 0x7"
|
2017-09-07 10:34:34 +00:00
|
|
|
|
2017-09-27 13:25:44 +00:00
|
|
|
# SoftRoce does not have enough queues available for
|
|
|
|
# multiconnection tests. Detect if we're using software RDMA.
|
|
|
|
# If so - lower the number of subsystems for test.
|
|
|
|
if check_ip_is_soft_roce $NVMF_FIRST_TARGET_IP; then
|
|
|
|
echo "Using software RDMA, lowering number of NVMeOF subsystems."
|
|
|
|
SUBSYS_NR=1
|
|
|
|
fi
|
|
|
|
|
2019-07-15 04:42:41 +00:00
|
|
|
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
|
2017-09-07 10:34:34 +00:00
|
|
|
|
2019-04-25 21:45:45 +00:00
|
|
|
# Construct a RAID volume for the logical volume store
|
2019-08-09 11:15:35 +00:00
|
|
|
base_bdevs="$($rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE) "
|
|
|
|
base_bdevs+=$($rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)
|
2019-04-25 21:45:45 +00:00
|
|
|
$rpc_py construct_raid_bdev -n raid0 -z 64 -r 0 -b "$base_bdevs"
|
|
|
|
|
|
|
|
# Create the logical volume store on the RAID volume
|
|
|
|
lvs=$($rpc_py construct_lvol_store raid0 lvs)
|
|
|
|
|
|
|
|
# Create a logical volume on the logical volume store
|
|
|
|
lvol=$($rpc_py construct_lvol_bdev -u $lvs lvol $LVOL_BDEV_INIT_SIZE)
|
|
|
|
|
|
|
|
# Create an NVMe-oF subsystem and add the logical volume as a namespace
|
|
|
|
$rpc_py nvmf_subsystem_create nqn.2016-06.io.spdk:cnode0 -a -s SPDK0
|
|
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode0 $lvol
|
2019-06-03 16:34:31 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode0 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
|
2019-04-25 21:45:45 +00:00
|
|
|
|
|
|
|
# Start random writes in the background
|
2019-06-03 16:34:31 +00:00
|
|
|
$rootdir/examples/nvme/perf/perf -r "trtype:$TEST_TRANSPORT adrfam:IPv4 traddr:$NVMF_FIRST_TARGET_IP trsvcid:$NVMF_PORT" -o 4096 -q 128 -s 512 -w randwrite -t 10 -c 0x18 &
|
2019-04-25 21:45:45 +00:00
|
|
|
perf_pid=$!
|
|
|
|
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# Perform some operations on the logical volume
|
2019-08-29 09:40:39 +00:00
|
|
|
snapshot=$($rpc_py bdev_lvol_snapshot $lvol "MY_SNAPSHOT")
|
2019-08-26 13:06:42 +00:00
|
|
|
$rpc_py bdev_lvol_resize $lvol $LVOL_BDEV_FINAL_SIZE
|
2019-08-23 09:35:34 +00:00
|
|
|
clone=$($rpc_py bdev_lvol_clone $snapshot "MY_CLONE")
|
2019-08-29 09:25:48 +00:00
|
|
|
$rpc_py bdev_lvol_inflate $clone
|
2019-04-25 21:45:45 +00:00
|
|
|
|
|
|
|
# Wait for I/O to complete
|
|
|
|
wait $perf_pid
|
|
|
|
|
|
|
|
# Clean up
|
|
|
|
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode0
|
|
|
|
$rpc_py destroy_lvol_bdev $lvol
|
|
|
|
$rpc_py destroy_lvol_store -u $lvs
|
2019-01-21 14:30:06 +00:00
|
|
|
|
2017-09-07 10:34:34 +00:00
|
|
|
rm -f ./local-job*
|
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
2019-05-16 19:38:53 +00:00
|
|
|
nvmftestfini
|
2017-09-07 10:34:34 +00:00
|
|
|
timing_exit lvol_integrity
|