@@ -2659,3 +2659,60 @@ def test_with_health_warn_with_2_active_MDSs(self):
26592659 errmsgs = health_warn )
26602660 self .run_ceph_cmd (f'mds fail { mds1_id } --yes-i-really-mean-it' )
26612661 self .run_ceph_cmd (f'mds fail { mds2_id } --yes-i-really-mean-it' )
2662+
2663+
2664+ class TestFSSetMaxMDS (TestAdminCommands ):
2665+
2666+ def test_when_unhealthy_without_confirm (self ):
2667+ '''
2668+ Test that command "ceph fs set <fsname> max_mds <num>" without the
2669+ confirmation flag (--yes-i-really-mean-it) fails when cluster is
2670+ unhealthy.
2671+ '''
2672+ self .gen_health_warn_mds_cache_oversized ()
2673+
2674+ with self .assertRaises (CommandFailedError ) as cfe :
2675+ self .fs .set_max_mds (2 , confirm = False )
2676+ self .assertEqual (cfe .exception .exitstatus , errno .EPERM )
2677+
2678+ def test_when_unhealthy_with_confirm (self ):
2679+ '''
2680+ Test that command "ceph fs set <fsname> max_mds <num>
2681+ --yes-i-really-mean-it" runs successfully when cluster is unhealthy.
2682+ '''
2683+ self .gen_health_warn_mds_cache_oversized ()
2684+
2685+ self .fs .set_max_mds (2 , confirm = True )
2686+ self .assertEqual (self .fs .get_var ('max_mds' ), 2 )
2687+
2688+ def test_when_mds_trim_without_confirm (self ):
2689+ '''
2690+ Test that command "ceph fs set <fsname> max_mds <num>" without the
2691+ confirmation flag (--yes-i-really-mean-it) fails when cluster has
2692+ MDS_TRIM health warning.
2693+ '''
2694+ self .gen_health_warn_mds_trim ()
2695+
2696+ with self .assertRaises (CommandFailedError ) as cfe :
2697+ self .fs .set_max_mds (2 , confirm = False )
2698+ self .assertEqual (cfe .exception .exitstatus , errno .EPERM )
2699+
2700+ def test_when_mds_trim_when_with_confirm (self ):
2701+ '''
2702+ Test that command "ceph fs set <fsname> max_mds <num>
2703+ --yes-i-really-mean-it" runs successfully when cluster has MDS_TRIM
2704+ health warning.
2705+ '''
2706+ self .gen_health_warn_mds_trim ()
2707+
2708+ self .fs .set_max_mds (2 , confirm = True )
2709+ self .assertEqual (self .fs .get_var ('max_mds' ), 2 )
2710+
2711+ def test_when_healthy_with_confirm (self ):
2712+ '''
2713+ Test that command "ceph fs set <fsname> max_mds <num>
2714+ --yes-i-really-mean-it" runs successfully also when cluster is
2715+ healthy.
2716+ '''
2717+ self .fs .set_max_mds (2 , confirm = True )
2718+ self .assertEqual (self .fs .get_var ('max_mds' ), 2 )
0 commit comments