2016-06-07 15:49:44 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
testdir=$(readlink -f $(dirname $0))
|
2016-07-06 16:56:03 +00:00
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
2018-02-27 22:14:08 +00:00
|
|
|
source $rootdir/test/common/autotest_common.sh
|
2016-06-08 01:47:02 +00:00
|
|
|
source $rootdir/test/nvmf/common.sh
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2016-10-17 09:38:26 +00:00
|
|
|
MALLOC_BDEV_SIZE=64
|
|
|
|
MALLOC_BLOCK_SIZE=512
|
|
|
|
|
2016-09-27 00:38:36 +00:00
|
|
|
rpc_py="python $rootdir/scripts/rpc.py"
|
|
|
|
|
2016-07-08 21:06:26 +00:00
|
|
|
set -e
|
|
|
|
|
2018-08-14 18:05:15 +00:00
|
|
|
# pass the parameter 'iso' to this script when running it in isolation to trigger rdma device initialization.
|
|
|
|
# e.g. sudo ./filesystem.sh iso
|
|
|
|
nvmftestinit $1
|
|
|
|
|
2017-07-25 15:39:51 +00:00
|
|
|
RDMA_IP_LIST=$(get_available_rdma_ips)
|
|
|
|
NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
|
|
|
|
if [ -z $NVMF_FIRST_TARGET_IP ]; then
|
2016-07-08 21:19:11 +00:00
|
|
|
echo "no NIC for nvmf test"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2016-06-07 15:49:44 +00:00
|
|
|
timing_enter fs_test
|
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
for incapsule in 0 4096; do
|
|
|
|
# Start up the NVMf target in another process
|
2018-08-10 10:20:25 +00:00
|
|
|
$NVMF_APP -m 0xF --wait-for-rpc &
|
2018-07-09 18:11:00 +00:00
|
|
|
nvmfpid=$!
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2018-08-14 18:05:15 +00:00
|
|
|
trap "killprocess $nvmfpid; nvmftestfini $1; exit 1" SIGINT SIGTERM EXIT
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
waitforlisten $nvmfpid
|
2018-07-11 20:28:56 +00:00
|
|
|
$rpc_py set_nvmf_target_options -u 8192 -p 4 -c $incapsule
|
|
|
|
$rpc_py start_subsystem_init
|
2016-10-17 09:38:26 +00:00
|
|
|
|
2018-07-26 05:34:52 +00:00
|
|
|
bdevs="$($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
|
|
|
|
bdevs+=" $($rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE)"
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
modprobe -v nvme-rdma
|
2016-09-27 00:38:36 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
$rpc_py construct_nvmf_subsystem nqn.2016-06.io.spdk:cnode1 "trtype:RDMA traddr:$NVMF_FIRST_TARGET_IP trsvcid:4420" "" -a -s SPDK00000000000001 -n "$bdevs"
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
nvme connect -t rdma -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
|
2018-04-16 20:28:16 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
waitforblk "nvme0n1"
|
|
|
|
waitforblk "nvme0n2"
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
mkdir -p /mnt/device
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
devs=`lsblk -l -o NAME | grep nvme`
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
for dev in $devs; do
|
|
|
|
timing_enter parted
|
|
|
|
parted -s /dev/$dev mklabel msdos mkpart primary '0%' '100%'
|
|
|
|
timing_exit parted
|
|
|
|
sleep 1
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
for fstype in "ext4" "btrfs" "xfs"; do
|
|
|
|
timing_enter $fstype
|
|
|
|
if [ $fstype = ext4 ]; then
|
|
|
|
force=-F
|
|
|
|
else
|
|
|
|
force=-f
|
|
|
|
fi
|
2016-07-08 22:43:07 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
mkfs.${fstype} $force /dev/${dev}p1
|
|
|
|
|
|
|
|
mount /dev/${dev}p1 /mnt/device
|
|
|
|
touch /mnt/device/aaa
|
|
|
|
sync
|
|
|
|
rm /mnt/device/aaa
|
|
|
|
sync
|
|
|
|
umount /mnt/device
|
|
|
|
timing_exit $fstype
|
|
|
|
done
|
|
|
|
|
|
|
|
parted -s /dev/$dev rm 1
|
2016-07-08 22:43:07 +00:00
|
|
|
done
|
2016-07-21 22:54:23 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
sync
|
|
|
|
nvme disconnect -n "nqn.2016-06.io.spdk:cnode1" || true
|
2016-06-07 15:49:44 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
$rpc_py delete_nvmf_subsystem nqn.2016-06.io.spdk:cnode1
|
2016-07-25 15:20:11 +00:00
|
|
|
|
2018-07-09 18:11:00 +00:00
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
|
|
|
nvmfcleanup
|
|
|
|
killprocess $nvmfpid
|
|
|
|
done
|
2016-09-27 00:38:36 +00:00
|
|
|
|
2018-08-14 18:05:15 +00:00
|
|
|
nvmftestfini $1
|
2016-06-07 15:49:44 +00:00
|
|
|
timing_exit fs_test
|