Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / qa / workunits / fs / snaps / snaptest-parents.sh
1 #!/bin/sh
2
3 set -e
4
5 ceph mds set allow_new_snaps true --yes-i-really-mean-it
6
7 echo "making directory tree and files"
8 mkdir -p 1/a/b/c/
9 echo "i'm file1" > 1/a/file1
10 echo "i'm file2" > 1/a/b/file2
11 echo "i'm file3" > 1/a/b/c/file3
12 echo "snapshotting"
13 mkdir 1/.snap/foosnap1
14 mkdir 2
15 echo "moving tree"
16 mv 1/a 2
17 echo "checking snapshot contains tree..."
18 dir1=`find 1/.snap/foosnap1 | wc -w`
19 dir2=`find 2/ | wc -w`
20 #diff $dir1 $dir2 && echo "Success!"
21 test $dir1==$dir2 && echo "Success!"
22 echo "adding folder and file to tree..."
23 mkdir 2/a/b/c/d
24 echo "i'm file 4!" > 2/a/b/c/d/file4
25 echo "snapshotting tree 2"
26 mkdir 2/.snap/barsnap2
27 echo "comparing snapshots"
28 dir1=`find 1/.snap/foosnap1/ -maxdepth 2 | wc -w`
29 dir2=`find 2/.snap/barsnap2/ -maxdepth 2 | wc -w`
30 #diff $dir1 $dir2 && echo "Success!"
31 test $dir1==$dir2 && echo "Success!"
32 echo "moving subtree to first folder"
33 mv 2/a/b/c 1
34 echo "comparing snapshots and new tree"
35 dir1=`find 1/ | wc -w`
36 dir2=`find 2/.snap/barsnap2/a/b/c | wc -w`
37 #diff $dir1 $dir2 && echo "Success!"
38 test $dir1==$dir2 && echo "Sucess!"
39 rmdir 1/.snap/*
40 rmdir 2/.snap/*
41 echo "OK"