]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa: test that ceph.dir.subvolume is replicated properly
authorPatrick Donnelly <pdonnell@redhat.com>
Tue, 16 Apr 2024 02:36:09 +0000 (22:36 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Mon, 22 Apr 2024 19:01:34 +0000 (15:01 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
qa/suites/fs/volumes/tasks/volumes/test/basic.yaml
qa/tasks/cephfs/test_subvolume.py

index b4c65cfc58ffb3a2564af572c49f86a737630794..2c026097dba3bbc19c3917b311e950b3e852d1fe 100644 (file)
@@ -5,4 +5,4 @@ tasks:
         - tasks.cephfs.test_volumes.TestVolumes
         - tasks.cephfs.test_volumes.TestSubvolumeGroups
         - tasks.cephfs.test_volumes.TestSubvolumes
-        - tasks.cephfs.test_subvolume.TestSubvolume
+        - tasks.cephfs.test_subvolume
index 1ebb137dda93e52d92e3a2c8f24f254d03d7fd90..b6aa273dde7f3679db270739cafbc1bd3015ca8a 100644 (file)
@@ -1,4 +1,5 @@
 import logging
+from time import sleep
 
 from tasks.cephfs.cephfs_test_case import CephFSTestCase
 from teuthology.exceptions import CommandFailedError
@@ -168,3 +169,40 @@ class TestSubvolume(CephFSTestCase):
 
         # clean up
         self.mount_a.run_shell(['rmdir', 'group/subvol2/dir/.snap/s2'])
+
+
+class TestSubvolumeReplicated(CephFSTestCase):
+    CLIENTS_REQUIRED = 1
+    MDSS_REQUIRED = 2
+
+    def test_subvolume_replicated(self):
+        """
+        That a replica sees the subvolume flag on a directory.
+        """
+
+
+        self.mount_a.run_shell_payload("mkdir -p dir1/dir2/dir3/dir4")
+
+        self.fs.set_max_mds(2)
+        status = self.fs.wait_for_daemons()
+
+        self.mount_a.setfattr("dir1", "ceph.dir.pin", "1")
+        self.mount_a.setfattr("dir1/dir2/dir3", "ceph.dir.pin", "0") # force dir2 to be replicated
+        status = self._wait_subtrees([("/dir1", 1), ("/dir1/dir2/dir3", 0)], status=status, rank=1)
+
+        op = self.fs.rank_tell("lock", "path", "/dir1/dir2", "snap:r", rank=1)
+        p = self.mount_a.setfattr("dir1/dir2", "ceph.dir.subvolume", "1", wait=False)
+        sleep(2)
+        reqid = self._reqid_tostr(op['op']['reqid'])
+        self.fs.kill_op(reqid, rank=1)
+        p.wait()
+
+        ino1 = self.fs.read_cache("/dir1/dir2", depth=0, rank=1)[0]
+        self.assertTrue(ino1['is_subvolume'])
+        self.assertTrue(ino1['is_auth'])
+        replicas = ino1['auth_state']['replicas']
+        self.assertIn("0", replicas)
+
+        ino0 = self.fs.read_cache("/dir1/dir2", depth=0, rank=0)[0]
+        self.assertFalse(ino0['is_auth'])
+        self.assertTrue(ino0['is_subvolume'])