@@ -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+
180214class TestScrubChecks (CephFSTestCase ):
181215 """
182216 Run flush and scrub commands on the specified files in the filesystem. This
0 commit comments