diff --git a/test/ocf/management/persistent-metadata.sh b/test/ocf/management/persistent-metadata.sh index ea8c7c1b7..ea41974b9 100755 --- a/test/ocf/management/persistent-metadata.sh +++ b/test/ocf/management/persistent-metadata.sh @@ -2,29 +2,40 @@ curdir=$(dirname $(readlink -f "$BASH_SOURCE")) rootdir=$(readlink -f $curdir/../../..) +source $rootdir/scripts/common.sh source $rootdir/test/common/autotest_common.sh +function clear_nvme() +{ + # Clear metadata on NVMe device + $rootdir/scripts/setup.sh reset + sleep 1 + name=$(get_nvme_name_from_bdf $1) + mountpoints=$(lsblk /dev/$blkname --output MOUNTPOINT -n | wc -w) + if [ "$mountpoints" != "0" ]; then + $rootdir/scripts/setup.sh + exit 1 + fi + dd if=/dev/zero of=/dev/$name bs=1M count=1000 oflag=direct + $rootdir/scripts/setup.sh +} + rpc_py=$rootdir/scripts/rpc.py -rm -f aio* -truncate -s 128M aio0 -truncate -s 128M aio1 -truncate -s 128M aio2 -truncate -s 128M aio3 -truncate -s 128M aio4 -truncate -s 128M aio5 -truncate -s 128M aio6 +nvme_cfg=$($rootdir/scripts/gen_nvme.sh) -echo " -[AIO] - AIO ./aio0 aio0 512 - AIO ./aio1 aio1 512 - AIO ./aio2 aio2 512 - AIO ./aio3 aio3 512 - AIO ./aio4 aio4 512 - AIO ./aio5 aio5 512 - AIO ./aio6 aio6 512 -" > $curdir/config +config=" +$nvme_cfg + +[Split] + Split Nvme0n1 7 128 +" +echo "$config" > $curdir/config + +# Clear only nvme device which we will use in test +bdf=$($rootdir/scripts/gen_nvme.sh --json | jq '.config[0].params.traddr' | sed s/\"//g) + +clear_nvme $bdf $rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config & spdk_pid=$! @@ -33,10 +44,10 @@ waitforlisten $spdk_pid # Create ocf on persistent storage -$rpc_py construct_ocf_bdev ocfWT wt aio0 aio1 -$rpc_py construct_ocf_bdev ocfPT pt aio2 aio3 -$rpc_py construct_ocf_bdev ocfWB0 wb aio4 aio5 -$rpc_py construct_ocf_bdev ocfWB1 wb aio4 aio6 +$rpc_py construct_ocf_bdev ocfWT wt Nvme0n1p0 Nvme0n1p1 +$rpc_py construct_ocf_bdev ocfPT pt Nvme0n1p2 Nvme0n1p3 +$rpc_py construct_ocf_bdev ocfWB0 wb Nvme0n1p4 Nvme0n1p5 +$rpc_py construct_ocf_bdev ocfWB1 wb Nvme0n1p4 Nvme0n1p6 # Sorting bdevs because we dont guarantee that they are going to be # in the same order after shutdown @@ -50,7 +61,7 @@ killprocess $spdk_pid $rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config & spdk_pid=$! -trap 'killprocess $spdk_pid; exit 1' SIGINT SIGTERM EXIT +trap 'killprocess $spdk_pid; rm -f $curdir/config ocf_bdevs ocf_bdevs_verify; exit 1' SIGINT SIGTERM EXIT waitforlisten $spdk_pid @@ -63,4 +74,6 @@ diff ocf_bdevs ocf_bdevs_verify trap - SIGINT SIGTERM EXIT killprocess $spdk_pid -rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify +rm -f $curdir/config ocf_bdevs ocf_bdevs_verify + +clear_nvme $bdf diff --git a/test/ocf/ocf.sh b/test/ocf/ocf.sh index d7716a30b..6498d1c26 100755 --- a/test/ocf/ocf.sh +++ b/test/ocf/ocf.sh @@ -18,8 +18,7 @@ suite "$testdir/integrity/fio-modes.sh" suite "$testdir/integrity/bdevperf-iotypes.sh" suite "$testdir/management/create-destruct.sh" suite "$testdir/management/multicore.sh" -# disabled due to intermittent failures. See github isssue #815 -#suite "$testdir/management/persistent-metadata.sh" +suite "$testdir/management/persistent-metadata.sh" timing_exit ocf report_test_completion "ocf"