Commit e0edd0a2 authored by Vitaliy Mysak's avatar Vitaliy Mysak Committed by Ben Walker
Browse files

test/ocf: add persistent metadata tests



We check if get_ocf_bdevs after shutdown is the same as before,
  which shows that state for all vbdevs wes correctly restored from metadata.

Change-Id: I9089642aeb840fc940b07908aa39c8193887432f
Signed-off-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/455424


Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 1e0e0ea1
Loading
Loading
Loading
Loading
+66 −0
Original line number Diff line number Diff line
#!/usr/bin/env bash

curdir=$(dirname $(readlink -f "$BASH_SOURCE"))
rootdir=$(readlink -f $curdir/../../..)
source $rootdir/test/common/autotest_common.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

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

$rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config &
spdk_pid=$!

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

# Sorting bdevs because we dont guarantee that they are going to be
# in the same order after shutdown
($rpc_py get_ocf_bdevs | jq '(.. | arrays) |= sort') > ./ocf_bdevs

trap - SIGINT SIGTERM EXIT

killprocess $spdk_pid

# Check for ocf persistency after restart
$rootdir/app/iscsi_tgt/iscsi_tgt -c $curdir/config &
spdk_pid=$!

trap "killprocess $spdk_pid; exit 1" SIGINT SIGTERM EXIT

waitforlisten $spdk_pid

# OCF should be loaded now as well

($rpc_py get_ocf_bdevs | jq '(.. | arrays) |= sort') > ./ocf_bdevs_verify

diff ocf_bdevs ocf_bdevs_verify

trap - SIGINT SIGTERM EXIT

killprocess $spdk_pid
rm -f aio* $curdir/config ocf_bdevs ocf_bdevs_verify
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +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"
suite "$testdir/management/persistent-metadata.sh"

timing_exit ocf
report_test_completion "ocf"