diff options
author | Patrick Donnelly <pdonnell@redhat.com> | 2021-07-14 14:00:09 -0700 |
---|---|---|
committer | Patrick Donnelly <pdonnell@redhat.com> | 2021-07-29 08:50:15 -0700 |
commit | c22d464599e54af8028d64c4ce62dbd908f59f91 (patch) | |
tree | d1a8973c2098dd0861beba5d1db3cfbf75404cf6 | |
parent | acd6743d403d225d6829aaa42c1ddc2eda89d2e1 (diff) | |
download | ceph-c22d464599e54af8028d64c4ce62dbd908f59f91.tar.gz |
qa: add tests for fs dump of epoch and trimming
Signed-off-by: Patrick Donnelly <pdonnell@redhat.com>
(cherry picked from commit 5ddaa36d17c875a8ab7a6445f5ab0917d9a2dffd)
Conflicts:
qa/tasks/cephfs/test_admin.py: trivial
-rw-r--r-- | qa/tasks/cephfs/test_admin.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/qa/tasks/cephfs/test_admin.py b/qa/tasks/cephfs/test_admin.py index 60198604b39..879dc05687c 100644 --- a/qa/tasks/cephfs/test_admin.py +++ b/qa/tasks/cephfs/test_admin.py @@ -1,4 +1,7 @@ +import errno import json +import logging +import time from teuthology.orchestra.run import CommandFailedError @@ -7,6 +10,7 @@ from tasks.cephfs.fuse_mount import FuseMount from tasks.cephfs.filesystem import FileLayout +log = logging.getLogger(__name__) class TestAdminCommands(CephFSTestCase): """ @@ -169,6 +173,77 @@ class TestAdminCommands(CephFSTestCase): pool_names[i], 'cephfs', keys[i], fs_name) +class TestDump(CephFSTestCase): + CLIENTS_REQUIRED = 0 + MDSS_REQUIRED = 1 + + def test_fs_dump_epoch(self): + """ + That dumping a specific epoch works. + """ + + status1 = self.fs.status() + status2 = self.fs.status(epoch=status1["epoch"]-1) + self.assertEqual(status1["epoch"], status2["epoch"]+1) + + def test_fsmap_trim(self): + """ + That the fsmap is trimmed normally. + """ + + paxos_service_trim_min = 25 + self.config_set('mon', 'paxos_service_trim_min', paxos_service_trim_min) + mon_max_mdsmap_epochs = 20 + self.config_set('mon', 'mon_max_mdsmap_epochs', mon_max_mdsmap_epochs) + + status = self.fs.status() + epoch = status["epoch"] + + # for N mutations + mutations = paxos_service_trim_min + mon_max_mdsmap_epochs + b = False + for i in range(mutations): + self.fs.set_joinable(b) + b = not b + + time.sleep(10) # for tick/compaction + + try: + self.fs.status(epoch=epoch) + except CommandFailedError as e: + self.assertEqual(e.exitstatus, errno.ENOENT, "invalid error code when trying to fetch FSMap that was trimmed") + else: + self.fail("trimming did not occur as expected") + + def test_fsmap_force_trim(self): + """ + That the fsmap is trimmed forcefully. + """ + + status = self.fs.status() + epoch = status["epoch"] + + paxos_service_trim_min = 1 + self.config_set('mon', 'paxos_service_trim_min', paxos_service_trim_min) + mon_mds_force_trim_to = epoch+1 + self.config_set('mon', 'mon_mds_force_trim_to', mon_mds_force_trim_to) + + # force a new fsmap + self.fs.set_joinable(False) + time.sleep(10) # for tick/compaction + + status = self.fs.status() + log.debug(f"new epoch is {status['epoch']}") + self.fs.status(epoch=epoch+1) # epoch+1 is not trimmed, may not == status["epoch"] + + try: + self.fs.status(epoch=epoch) + except CommandFailedError as e: + self.assertEqual(e.exitstatus, errno.ENOENT, "invalid error code when trying to fetch FSMap that was trimmed") + else: + self.fail("trimming did not occur as expected") + + class TestConfigCommands(CephFSTestCase): """ Test that daemons and clients respond to the otherwise rarely-used |