From af50db111fb0f6d4716d8704d82ed82b536da6eb Mon Sep 17 00:00:00 2001 From: neeraj pratap singh Date: Tue, 10 Oct 2023 11:25:31 +0530 Subject: [PATCH] qa: adding test for preventing scrub when mds is inactive Fixes: https://tracker.ceph.com/issues/62537 Signed-off-by: Neeraj Pratap Singh (cherry picked from commit b9a2d0571f784b671a64ba4404b12f89a3bf1686) --- qa/tasks/cephfs/test_scrub_checks.py | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/qa/tasks/cephfs/test_scrub_checks.py b/qa/tasks/cephfs/test_scrub_checks.py index a33bc0111aede..d4f095adad12f 100644 --- a/qa/tasks/cephfs/test_scrub_checks.py +++ b/qa/tasks/cephfs/test_scrub_checks.py @@ -177,6 +177,40 @@ done self._check_task_status_na() + def test_scrub_when_mds_is_inactive(self): + test_dir = "scrub_control_test_path" + abs_test_path = f"/{test_dir}" + + self.create_scrub_data(test_dir) + + # allow standby-replay + self.fs.set_max_mds(1) + self.fs.set_allow_standby_replay(True) + status = self.fs.wait_for_daemons() + sr_mds_id = self.fs.get_daemon_names('up:standby-replay', status=status)[0] + + # start the scrub and verify + with self.assertRaises(CommandFailedError) as ce: + self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', + 'start', abs_test_path, 'recursive') + self.assertEqual(ce.exception.exitstatus, errno.EINVAL) + + # pause and verify + with self.assertRaises(CommandFailedError) as ce: + self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', 'pause') + self.assertEqual(ce.exception.exitstatus, errno.EINVAL) + + # abort and verify + with self.assertRaises(CommandFailedError) as ce: + self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', 'abort') + self.assertEqual(ce.exception.exitstatus, errno.EINVAL) + + # resume and verify + with self.assertRaises(CommandFailedError) as ce: + self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', 'resume') + self.assertEqual(ce.exception.exitstatus, errno.EINVAL) + + class TestScrubChecks(CephFSTestCase): """ Run flush and scrub commands on the specified files in the filesystem. This -- 2.39.5