Skip to content

Commit b9a2d05

Browse files
author
neeraj pratap singh
committed
qa: adding test for preventing scrub when mds is inactive
Fixes: https://tracker.ceph.com/issues/62537 Signed-off-by: Neeraj Pratap Singh <[email protected]>
1 parent 525a3be commit b9a2d05

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

qa/tasks/cephfs/test_scrub_checks.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,40 @@ def promoted():
177177

178178
self._check_task_status_na()
179179

180+
def test_scrub_when_mds_is_inactive(self):
181+
test_dir = "scrub_control_test_path"
182+
abs_test_path = f"/{test_dir}"
183+
184+
self.create_scrub_data(test_dir)
185+
186+
# allow standby-replay
187+
self.fs.set_max_mds(1)
188+
self.fs.set_allow_standby_replay(True)
189+
status = self.fs.wait_for_daemons()
190+
sr_mds_id = self.fs.get_daemon_names('up:standby-replay', status=status)[0]
191+
192+
# start the scrub and verify
193+
with self.assertRaises(CommandFailedError) as ce:
194+
self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub',
195+
'start', abs_test_path, 'recursive')
196+
self.assertEqual(ce.exception.exitstatus, errno.EINVAL)
197+
198+
# pause and verify
199+
with self.assertRaises(CommandFailedError) as ce:
200+
self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', 'pause')
201+
self.assertEqual(ce.exception.exitstatus, errno.EINVAL)
202+
203+
# abort and verify
204+
with self.assertRaises(CommandFailedError) as ce:
205+
self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', 'abort')
206+
self.assertEqual(ce.exception.exitstatus, errno.EINVAL)
207+
208+
# resume and verify
209+
with self.assertRaises(CommandFailedError) as ce:
210+
self.run_ceph_cmd('tell', f'mds.{sr_mds_id}', 'scrub', 'resume')
211+
self.assertEqual(ce.exception.exitstatus, errno.EINVAL)
212+
213+
180214
class TestScrubChecks(CephFSTestCase):
181215
"""
182216
Run flush and scrub commands on the specified files in the filesystem. This

0 commit comments

Comments
 (0)