]> 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@ibm.com>
Thu, 9 Jan 2025 19:50:56 +0000 (14:50 -0500)
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 8a0eceb529a83f57a7f2a28a46c67bbaa647adef)

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 d77fd1915d521c858d618345ddfd85ab6a07706e..04a26585f081254c933d3bc006b53d048c7050d4 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
@@ -195,3 +196,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'])