]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/workunits/fs/snaps: allow tests to be run
authorRamana Raja <rraja@redhat.com>
Wed, 18 Nov 2020 10:28:39 +0000 (15:58 +0530)
committerRamana Raja <rraja@redhat.com>
Fri, 20 Nov 2020 07:53:21 +0000 (13:23 +0530)
... 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>
21 files changed:
qa/tasks/cephfs/test_snapshots.py
qa/workunits/fs/snaps/snap-rm-diff.sh
qa/workunits/fs/snaps/snaptest-0.sh [deleted file]
qa/workunits/fs/snaps/snaptest-1.sh
qa/workunits/fs/snaps/snaptest-2.sh
qa/workunits/fs/snaps/snaptest-authwb.sh
qa/workunits/fs/snaps/snaptest-capwb.sh
qa/workunits/fs/snaps/snaptest-dir-rename.sh
qa/workunits/fs/snaps/snaptest-double-null.sh
qa/workunits/fs/snaps/snaptest-estale.sh
qa/workunits/fs/snaps/snaptest-git-ceph.sh
qa/workunits/fs/snaps/snaptest-hardlink.sh
qa/workunits/fs/snaps/snaptest-intodir.sh
qa/workunits/fs/snaps/snaptest-multiple-capsnaps.sh
qa/workunits/fs/snaps/snaptest-parents.sh
qa/workunits/fs/snaps/snaptest-realm-split.sh
qa/workunits/fs/snaps/snaptest-snap-rename.sh
qa/workunits/fs/snaps/snaptest-snap-rm-cmp.sh
qa/workunits/fs/snaps/snaptest-upchildrealms.sh
qa/workunits/fs/snaps/snaptest-xattrwb.sh
qa/workunits/fs/snaps/untar_snap_rm.sh

index a036ec4a63f8d32ccf33ec3651437e6be8dfab35..fa4d9431fefdfab4a3dfe03898439874d3bf95d9 100644 (file)
@@ -1,3 +1,4 @@
+import errno
 import logging
 import signal
 from textwrap import dedent
@@ -38,6 +39,25 @@ class TestSnapshots(CephFSTestCase):
     def _get_pending_snap_destroy(self, rank=0, status=None):
         return self._get_snapserver_dump(rank,status=status)["pending_destroy"]
 
+    def test_allow_new_snaps_config(self):
+        """
+        Check whether 'allow_new_snaps' setting works
+        """
+        self.mount_a.run_shell(["mkdir", "test-allow-snaps"])
+
+        self.fs.set_allow_new_snaps(False);
+        try:
+            self.mount_a.run_shell(["mkdir", "test-allow-snaps/.snap/snap00"])
+        except CommandFailedError as ce:
+            self.assertEqual(ce.exitstatus, errno.EPERM, "expected EPERM")
+        else:
+            self.fail("expected snap creatiion to fail")
+
+        self.fs.set_allow_new_snaps(True);
+        self.mount_a.run_shell(["mkdir", "test-allow-snaps/.snap/snap00"])
+        self.mount_a.run_shell(["rmdir", "test-allow-snaps/.snap/snap00"])
+        self.mount_a.run_shell(["rmdir", "test-allow-snaps"])
+
     def test_kill_mdstable(self):
         """
         check snaptable transcation
index 63f642878bee957b48deca2a8fad6c81933ca382..30ffa9113a5d63e9f7832c50dd7ce8e89c550287 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh -ex
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
 wget -q http://download.ceph.com/qa/linux-2.6.33.tar.bz2
 mkdir foo
 cp linux* foo
diff --git a/qa/workunits/fs/snaps/snaptest-0.sh b/qa/workunits/fs/snaps/snaptest-0.sh
deleted file mode 100755 (executable)
index 791caf9..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh -x
-
-expect_failure() {
-       if "$@"; then return 1; else return 0; fi
-}
-set -e
-
-ceph fs set cephfs allow_new_snaps false
-expect_failure mkdir .snap/foo
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
-echo asdf > foo
-mkdir .snap/foo
-grep asdf .snap/foo/foo
-rmdir .snap/foo
-
-echo asdf > bar
-mkdir .snap/bar
-rm bar
-grep asdf .snap/bar/bar
-rmdir .snap/bar
-rm foo
-
-ceph fs set cephfs allow_new_snaps false
-expect_failure mkdir .snap/baz
-
-echo OK
index 476531fc4d8fb14eafc89f123cf47ef02abc80ea..431e83387899d8866574870cdbaf4d01eef3b4a1 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -ex
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 echo 1 > file1
 echo 2 > file2
 echo 3 > file3
index 6ded7b66990d2b2a17c4620b2563e5505bb0b4e1..11fe9316ae8d796472d645834c2a1db28014392f 100755 (executable)
@@ -1,7 +1,5 @@
 #!/usr/bin/env bash
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 echo "Create dir 100 to 199 ..."
 for i in $(seq 100 199); do
        echo "    create dir $i"
index 2c53e2a6117cb0eb7bbadcee9c860fdd58ebea22..965ee851273fd22a31a08324bc3c00b3dcfad424 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 touch foo
 chmod +x foo
 mkdir .snap/s
@@ -11,4 +9,4 @@ find .snap/s/foo -executable | grep foo
 rmdir .snap/s
 rm foo
 
-echo OK
\ No newline at end of file
+echo OK
index f36d38ab5c056c2d0317b753f14e27dbf8b7c410..d26f324b61479aa6fa3c4185b6cfeffcf9ae5be3 100755 (executable)
@@ -4,8 +4,6 @@ set -e
 
 mkdir foo
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 # make sure mds handles it when the client does not send flushsnap
 echo x > foo/x
 sync
@@ -32,4 +30,4 @@ rmdir foo/.snap/s
 
 rm -r foo
 
-echo OK
\ No newline at end of file
+echo OK
index 85b929a25b07c9ab0b854567e6279a6d474a26c8..3bbd9a11ef83f9c6470e6e93ad3587454118b524 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 #
 # make sure we keep an existing dn's seq
 #
@@ -16,4 +14,4 @@ rmdir a
 stat .snap/bar/a
 rmdir .snap/bar
 
-echo OK
\ No newline at end of file
+echo OK
index 49a1b271c50ff798b35b4de7dad279a3dae5dd65..cdf32e4f0ef6af40cff1e4eda9f4ac80b73aa49f 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 # multiple intervening snapshots with no modifications, and thus no
 # snapflush client_caps messages.  make sure the mds can handle this.
 
index e005b9a820bdfb89b454ccae5334b47e845a64d0..a4fb94368d4c1f349bdf73466cb2eeae0be3979c 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/sh -x
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 mkdir .snap/foo
 
 echo "We want ENOENT, not ESTALE, here."
index 50b854a5583d8839b1e007a0ef066f6ce137da60..0d11efedb73d46ba309bbf178a9e6510db01d97e 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 git clone git://git.ceph.com/ceph.git
 cd ceph
 
index 9848a01981e1042e5dcc8cb51f2152f363fa0d22..90f3583b19ec63d91a357838cfb538e29439e14b 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 mkdir 1 2
 echo asdf >1/file1
 echo asdf >1/file2
index 94af442278bbfaf050c20271dc6eea29acce5087..d6a220f73bfeeee74db23ed211cf35f458d2203f 100755 (executable)
@@ -1,7 +1,5 @@
 #!/bin/sh -ex
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 # this tests fix for #1399
 mkdir foo
 mkdir foo/.snap/one
@@ -21,4 +19,4 @@ rmdir foo/baz/.snap/two
 rmdir foo/.snap/one
 rm -r foo
 
-echo OK
\ No newline at end of file
+echo OK
index 56ceaa8a95e10c19e7c5db2afcbc65f90ac5a9f9..5ebc852cf6c75b618598f6620abd0323d095ef49 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 echo asdf > a
 mkdir .snap/1
 chmod 777 a
index a66a977fd572442fb7af67f84da107b52fc594df..7ab1ba7cf2d1749bab3c47a5f11f5cfa5969fae1 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 echo "making directory tree and files"
 mkdir -p 1/a/b/c/
 echo "i'm file1" > 1/a/file1
index 3f01fd54dee7ae6dbb2a7c1c64cd52866c7f437b..300cca21de513e1c86b55563f9fe645d38f904f3 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 mkdir -p 1/a
 exec 3<> 1/a/file1
 
index 9301a2963775ea7956efdc3abea6693d9fa622ea..aa7325b92ea3429316c565d4a5b084215a5b05af 100755 (executable)
@@ -5,8 +5,6 @@ expect_failure() {
 }
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 mkdir -p d1/d2
 mkdir -p d1/d3
 mkdir d1/.snap/foo
index c5bd65e9a8f7e308de0710dbe6b7f4995089064f..88a0e8ae54a1ee7d5ad425d30b37842247cec762 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 file=linux-2.6.33.tar.bz2
 wget -q http://download.ceph.com/qa/$file
 
index a4cc9ab304b69cfe5e54918467585d14a7c6c1f9..4e531a966521f961e544db2e964c1bd67b829031 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 #
 # verify that a snap update on a parent realm will induce
 # snap cap writeback for inodes child realms
@@ -27,4 +25,4 @@ rmdir a/.snap/a1
 rmdir a/.snap/a2
 rm -r a
 
-echo "OK"
\ No newline at end of file
+echo "OK"
index 09398878092fa8715558a0e0ab7c1e5507e65308..e503aed77b4ef1090178999d3887ec3eb445f979 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 echo "testing simple xattr wb"
 touch x
 setfattr -n user.foo x
@@ -28,4 +26,4 @@ getfattr -n user.foo a/.snap/s/b | grep user.foo  # should be there, too!
 rmdir a/.snap/s
 rm -r a
 
-echo OK
\ No newline at end of file
+echo OK
index 928e8911ba846a6eddaee124fc5e1aeae2527caf..8a8412e665923d3bb12a9c42c5123e5f426efcff 100755 (executable)
@@ -2,8 +2,6 @@
 
 set -e
 
-ceph fs set cephfs allow_new_snaps true --yes-i-really-mean-it
-
 do_tarball() {
     wget http://download.ceph.com/qa/$1
     tar xvf$2 $1