Commit 3c2d18ce authored by Kamil Godzwon's avatar Kamil Godzwon Committed by Tomasz Zawadzki
Browse files

test/filesystem: nvme device storage size verifying



Added a check before any of the parted calls to
confirm the size is what is expected.

Fixes #2388

Signed-off-by: default avatarKamil Godzwon <kamilx.godzwon@intel.com>
Change-Id: I18720c66d70da82b8943d3231348a4015108a598
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11820


Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPawel Piatek <pawelx.piatek@intel.com>
Reviewed-by: default avatarMichal Berger <michallinuxstuff@gmail.com>
Reviewed-by: default avatarKarol Latecki <karol.latecki@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent a6e02246
Loading
Loading
Loading
Loading
+14 −3
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/setup/common.sh
source $rootdir/test/iscsi_tgt/common.sh
source $rootdir/scripts/common.sh

@@ -55,13 +56,15 @@ fi
# "1:2" ==> map PortalGroup1 to InitiatorGroup2
# "256" ==> iSCSI queue depth 256
# "-d" ==> disable CHAP authentication
$rpc_py iscsi_create_target_node Target1 Target1_alias 'lvs_0/lbd_0:0' $PORTAL_TAG:$INITIATOR_TAG 256 -d
lvol_name="lvs_0/lbd_0"
$rpc_py iscsi_create_target_node Target1 Target1_alias ${lvol_name}:0 $PORTAL_TAG:$INITIATOR_TAG 256 -d
sleep 1

iscsiadm -m discovery -t sendtargets -p $TARGET_IP:$ISCSI_PORT
iscsiadm -m node --login -p $TARGET_IP:$ISCSI_PORT
waitforiscsidevices 1

lvol_size=$(($(get_bdev_size $lvol_name) * 1024 * 1024))
trap 'iscsicleanup; remove_backends; umount /mnt/device; rm -rf /mnt/device; killprocess $pid; iscsitestfini; exit 1' SIGINT SIGTERM EXIT

mkdir -p /mnt/device
@@ -69,8 +72,16 @@ mkdir -p /mnt/device
dev=$(iscsiadm -m session -P 3 | grep "Attached scsi disk" | awk '{print $4}')

waitforfile /dev/$dev

dev_size=$(sec_size_to_bytes $dev)

if ((lvol_size == dev_size)); then
	parted -s /dev/$dev mklabel gpt mkpart SPDK_TEST '0%' '100%'
	sleep 1
else
	echo "ERR: device size is not as expected"
	exit 1
fi

function filesystem_test() {
	fstype=$1
+15 −5
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

testdir=$(readlink -f $(dirname $0))
rootdir=$(readlink -f $testdir/../../..)
source $rootdir/test/setup/common.sh
source $rootdir/test/common/autotest_common.sh
source $rootdir/test/nvmf/common.sh

@@ -45,22 +46,31 @@ function nvmf_filesystem_part() {
	in_capsule=$1

	nvmfappstart -m 0xF
	malloc_name=Malloc1

	$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192 -c $in_capsule
	$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc1
	$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b $malloc_name
	$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s $NVMF_SERIAL
	$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc1
	$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 $malloc_name
	$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT

	malloc_size=$(($(get_bdev_size $malloc_name) * 1024 * 1024))

	nvme connect -t $TEST_TRANSPORT -n "nqn.2016-06.io.spdk:cnode1" -a "$NVMF_FIRST_TARGET_IP" -s "$NVMF_PORT"

	waitforserial "$NVMF_SERIAL"
	nvme_name=$(lsblk -l -o NAME,SERIAL | grep -oP "([\w]*)(?=\s+${NVMF_SERIAL})")
	nvme_size=$(sec_size_to_bytes $nvme_name)

	mkdir -p /mnt/device
	if ((nvme_size == malloc_size)); then
		parted -s /dev/${nvme_name} mklabel gpt mkpart SPDK_TEST '0%' '100%'
		partprobe
		sleep 1
	else
		echo "ERR: Created dev size is not as expected"
		exit 1
	fi

	if [ $in_capsule -eq 0 ]; then
		run_test "filesystem_ext4" nvmf_filesystem_create "ext4" ${nvme_name}