Commit da415ae9 authored by xuhuagen's avatar xuhuagen Committed by Jim Harris
Browse files

autotest: update iscsi_filesystem_test



Use nvme bdev with lvol to replace malloc bdev to test filesystem.

Change-Id: I74243675dd65d9f007a6eef1444b73f251afe95f
Signed-off-by: default avatarxuhuagen <huagenx.xu@intel.com>
Reviewed-on: https://review.gerrithub.io/403167


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 87f7533a
Loading
Loading
Loading
Loading
+27 −7
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/iscsi_tgt/common.sh
source $rootdir/scripts/common.sh

timing_enter filesystem

@@ -12,10 +13,18 @@ PORT=3260
INITIATOR_TAG=2
INITIATOR_NAME=ANY
NETMASK=$INITIATOR_IP/32
MALLOC_BDEV_SIZE=256
MALLOC_BLOCK_SIZE=512

rpc_py="python $rootdir/scripts/rpc.py"
# Remove lvol bdevs and stores.
function remove_backends()
{
	echo "INFO: Removing lvol bdev"
	$rpc_py delete_bdev "lvs_0/lbd_0"

	echo "INFO: Removing lvol stores"
	$rpc_py destroy_lvol_store -l lvs_0
	return 0
}

timing_enter start_iscsi_tgt

@@ -30,20 +39,30 @@ echo "iscsi_tgt is listening. Running tests..."

timing_exit start_iscsi_tgt

bdf=`iter_pci_class_code 01 08 02 | head -1`
$rpc_py add_portal_group 1 $TARGET_IP:$PORT
$rpc_py add_initiator_group $INITIATOR_TAG $INITIATOR_NAME $NETMASK
$rpc_py construct_malloc_bdev $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE
# "Malloc0:0" ==> use Malloc0 blockdev for LUN0
$rpc_py construct_nvme_bdev -b "Nvme0" -t "pcie" -a $bdf

ls_guid=$($rpc_py construct_lvol_store Nvme0n1 lvs_0)
free_mb=$(get_lvs_free_mb "$ls_guid")
# Using maximum 2048MiB to reduce the test time
if [ $free_mb -gt 2048 ]; then
	$rpc_py construct_lvol_bdev -u $ls_guid lbd_0 2048
else
	$rpc_py construct_lvol_bdev -u $ls_guid lbd_0 $free_mb
fi
# "lvs_0/lbd_0:0" ==> use lvs_0/lbd_0 blockdev for LUN0
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
# "64" ==> iSCSI queue depth 64
# "256" ==> iSCSI queue depth 256
# "-d" ==> disable CHAP authentication
$rpc_py construct_target_node Target3 Target3_alias 'Malloc0:0' '1:2' 256 -d
$rpc_py construct_target_node Target1 Target1_alias 'lvs_0/lbd_0:0' '1:2' 256 -d
sleep 1

iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$PORT
iscsiadm -m node --login -p $TARGET_IP:$PORT

trap "umount /mnt/device; rm -rf /mnt/device; iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT
trap "remove_backends; umount /mnt/device; rm -rf /mnt/device; iscsicleanup; killprocess $pid; exit 1" SIGINT SIGTERM EXIT

sleep 1

@@ -88,6 +107,7 @@ rm -rf /mnt/device

trap - SIGINT SIGTERM EXIT

remove_backends
iscsicleanup
killprocess $pid
timing_exit filesystem