From 8a0eceb529a83f57a7f2a28a46c67bbaa647adef Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Mon, 15 Apr 2024 22:36:09 -0400 Subject: [PATCH] qa: test that ceph.dir.subvolume is replicated properly Signed-off-by: Patrick Donnelly --- .../fs/volumes/tasks/volumes/test/basic.yaml | 2 +- qa/tasks/cephfs/test_subvolume.py | 38 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml b/qa/suites/fs/volumes/tasks/volumes/test/basic.yaml index b4c65cfc58f..2c026097dba 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 1ebb137dda9..b6aa273dde7 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 @@ -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']) -- 2.39.5