5 testdir
=$
(readlink
-f $
(dirname $0))
6 rootdir
=$
(readlink
-f $testdir/..
/..
)
7 rpc_py
=$rootdir/scripts
/rpc.py
9 source $rootdir/test
/common
/autotest_common.sh
11 mount_dir
=$
(mktemp
-d)
16 if mount |
grep $mount_dir; then
20 rm -f $testdir/testfile.md5
21 rm -f $testdir/config
/ftl.json
23 $rpc_py delete_ftl_bdev
-b nvme0
28 trap "restore_kill; exit 1" SIGINT SIGTERM EXIT
30 $rootdir/test
/app
/bdev_svc
/bdev_svc
& svcpid
=$
!
31 # Wait until bdev_svc starts
34 if [ -n "$uuid" ]; then
35 $rpc_py construct_ftl_bdev
-b nvme0
-a $device -l 0-3 -u $uuid
37 $rpc_py construct_ftl_bdev
-b nvme0
-a $device -l 0-3
42 $rpc_py start_nbd_disk nvme0
/dev
/nbd0
45 $rpc_py save_config
> $testdir/config
/ftl.json
47 # Prepare the disk by creating ext4 fs and putting a file on it
48 mkfs.ext4
-F /dev
/nbd0
49 mount
/dev
/nbd0
$mount_dir
50 dd if=/dev
/urandom of
=$mount_dir/testfile bs
=4K count
=256K
52 mount
-o remount
/dev
/nbd0
$mount_dir
53 md5sum $mount_dir/testfile
> $testdir/testfile.md5
55 # Kill bdev service and start it again
59 $rootdir/test
/app
/bdev_svc
/bdev_svc
& svcpid
=$
!
60 # Wait until bdev_svc starts
63 $rpc_py load_config
< $testdir/config
/ftl.json
65 mount
/dev
/nbd0
$mount_dir
66 md5sum -c $testdir/testfile.md5
68 report_test_completion occsd_restore
70 trap - SIGINT SIGTERM EXIT