From: Patrick Donnelly Date: Tue, 16 Apr 2024 02:36:09 +0000 (-0400) Subject: qa: test that ceph.dir.subvolume is replicated properly X-Git-Tag: v18.2.5~142^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ef009c335695579453c1f0250909f10811794f86;p=ceph.git qa: test that ceph.dir.subvolume is replicated properly Signed-off-by: Patrick Donnelly (cherry picked from commit 8a0eceb529a83f57a7f2a28a46c67bbaa647adef) --- diff --git a/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml b/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml index b4c65cfc58ffb..2c026097dba3b 100644 --- a/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml +++ b/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml @@ -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 diff --git a/qa/tasks/cephfs/test_subvolume.py b/qa/tasks/cephfs/test_subvolume.py index d77fd1915d521..04a26585f0812 100644 --- a/qa/tasks/cephfs/test_subvolume.py +++ b/qa/tasks/cephfs/test_subvolume.py @@ -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'])