2018-07-23 06:53:41 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-11-02 15:49:40 +00:00
|
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
# Copyright (C) 2018 Intel Corporation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
2018-07-23 06:53:41 +00:00
|
|
|
testdir=$(readlink -f $(dirname $0))
|
|
|
|
rootdir=$(readlink -f $testdir/../../..)
|
|
|
|
source $rootdir/test/common/autotest_common.sh
|
|
|
|
source $rootdir/test/nvmf/common.sh
|
|
|
|
|
2019-05-15 23:20:10 +00:00
|
|
|
MALLOC_BDEV_SIZE=64
|
2018-07-23 06:53:41 +00:00
|
|
|
MALLOC_BLOCK_SIZE=512
|
|
|
|
|
2019-05-16 19:38:53 +00:00
|
|
|
nvmftestinit
|
2020-04-28 15:08:33 +00:00
|
|
|
nvmfappstart -m 0xF
|
2018-07-23 06:53:41 +00:00
|
|
|
|
2019-07-15 04:42:41 +00:00
|
|
|
$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
|
2018-07-23 06:53:41 +00:00
|
|
|
|
|
|
|
# Create subsystems
|
2019-08-09 11:15:35 +00:00
|
|
|
$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0
|
2019-12-19 14:17:49 +00:00
|
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s $NVMF_SERIAL
|
2019-05-02 21:14:19 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0
|
2019-06-03 16:34:31 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"
|
2018-07-23 06:53:41 +00:00
|
|
|
|
|
|
|
echo "test case1: single bdev can't be used in multiple subsystems"
|
2019-09-20 10:22:44 +00:00
|
|
|
$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode2 -a -s SPDK2
|
2019-06-03 16:34:31 +00:00
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode2 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s "$NVMF_PORT"
|
2019-06-10 07:20:45 +00:00
|
|
|
nmic_status=0
|
|
|
|
$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode2 Malloc0 || nmic_status=$?
|
2019-05-02 21:14:19 +00:00
|
|
|
|
|
|
|
if [ $nmic_status -eq 0 ]; then
|
|
|
|
echo " Adding namespace passed - failure expected."
|
2019-05-13 19:11:00 +00:00
|
|
|
nvmftestfini
|
2019-05-02 21:14:19 +00:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo " Adding namespace failed - expected result."
|
|
|
|
fi
|
2018-07-23 06:53:41 +00:00
|
|
|
|
2020-08-13 10:29:29 +00:00
|
|
|
echo "test case2: host connect to nvmf target in multiple paths"
|
|
|
|
$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s "$NVMF_SECOND_PORT"
|
2022-11-22 12:48:37 +00:00
|
|
|
$NVME_CONNECT -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"
|
|
|
|
$NVME_CONNECT -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_SECOND_PORT"
|
2018-07-23 06:53:41 +00:00
|
|
|
|
2020-08-10 15:15:22 +00:00
|
|
|
waitforserial "$NVMF_SERIAL"
|
2018-07-23 06:53:41 +00:00
|
|
|
|
2021-04-29 13:29:46 +00:00
|
|
|
$rootdir/scripts/fio-wrapper -p nvmf -i 4096 -d 1 -t write -r 1 -v
|
2018-07-23 06:53:41 +00:00
|
|
|
|
2020-08-10 15:15:22 +00:00
|
|
|
nvme disconnect -n "nqn.2016-06.io.spdk:cnode1"
|
2021-08-26 19:39:07 +00:00
|
|
|
waitforserial_disconnect "$NVMF_SERIAL"
|
2018-07-23 06:53:41 +00:00
|
|
|
|
|
|
|
trap - SIGINT SIGTERM EXIT
|
|
|
|
|
2019-05-16 19:38:53 +00:00
|
|
|
nvmftestfini
|