ceph/qa/workunits/fs/snaps/snaptest-snap-rename.sh
Ramana Raja a232d273c1 qa/workunits/fs/snaps: allow tests to be run
... filesystems other than 'cephfs'.

It is not required to set  'allow_new_snaps' to True to allow snapshot
to be created on a filesystem. Remove that setting.

Remove 'fs/snaps/snaptest-0.sh' that is racy when running in parallel on
an another client that mounted the same file system. Include a similar
test in qa/tasks/cephfs/test_snapshots.py

Signed-off-by: Ramana Raja <rraja@redhat.com>
2020-11-20 13:23:21 +05:30

34 lines
893 B
Bash
Executable File

#!/bin/sh -x
expect_failure() {
if "$@"; then return 1; else return 0; fi
}
set -e
mkdir -p d1/d2
mkdir -p d1/d3
mkdir d1/.snap/foo
mkdir d1/d2/.snap/foo
mkdir d1/d3/.snap/foo
mkdir d1/d3/.snap/bar
mv d1/d2/.snap/foo d1/d2/.snap/bar
# snapshot name can't start with _
expect_failure mv d1/d2/.snap/bar d1/d2/.snap/_bar
# can't rename parent snapshot
expect_failure mv d1/d2/.snap/_foo_* d1/d2/.snap/foo
expect_failure mv d1/d2/.snap/_foo_* d1/d2/.snap/_foo_1
# can't rename snapshot to different directroy
expect_failure mv d1/d2/.snap/bar d1/.snap/
# can't overwrite existing snapshot
expect_failure python3 -c "import os; os.rename('d1/d3/.snap/foo', 'd1/d3/.snap/bar')"
# can't move snaphost out of snapdir
expect_failure python3 -c "import os; os.rename('d1/.snap/foo', 'd1/foo')"
rmdir d1/.snap/foo
rmdir d1/d2/.snap/bar
rmdir d1/d3/.snap/foo
rmdir d1/d3/.snap/bar
rm -rf d1
echo OK