@@ -2683,3 +2683,60 @@ def test_with_health_warn_with_2_active_MDSs(self):
26832683 errmsgs = health_warn )
26842684 self .run_ceph_cmd (f'mds fail { mds1_id } --yes-i-really-mean-it' )
26852685 self .run_ceph_cmd (f'mds fail { mds2_id } --yes-i-really-mean-it' )
2686+
2687+
2688+ class TestFSSetMaxMDS (TestAdminCommands ):
2689+
2690+ def test_when_unhealthy_without_confirm (self ):
2691+ '''
2692+ Test that command "ceph fs set <fsname> max_mds <num>" without the
2693+ confirmation flag (--yes-i-really-mean-it) fails when cluster is
2694+ unhealthy.
2695+ '''
2696+ self .gen_health_warn_mds_cache_oversized ()
2697+
2698+ with self .assertRaises (CommandFailedError ) as cfe :
2699+ self .fs .set_max_mds (2 , confirm = False )
2700+ self .assertEqual (cfe .exception .exitstatus , errno .EPERM )
2701+
2702+ def test_when_unhealthy_with_confirm (self ):
2703+ '''
2704+ Test that command "ceph fs set <fsname> max_mds <num>
2705+ --yes-i-really-mean-it" runs successfully when cluster is unhealthy.
2706+ '''
2707+ self .gen_health_warn_mds_cache_oversized ()
2708+
2709+ self .fs .set_max_mds (2 , confirm = True )
2710+ self .assertEqual (self .fs .get_var ('max_mds' ), 2 )
2711+
2712+ def test_when_mds_trim_without_confirm (self ):
2713+ '''
2714+ Test that command "ceph fs set <fsname> max_mds <num>" without the
2715+ confirmation flag (--yes-i-really-mean-it) fails when cluster has
2716+ MDS_TRIM health warning.
2717+ '''
2718+ self .gen_health_warn_mds_trim ()
2719+
2720+ with self .assertRaises (CommandFailedError ) as cfe :
2721+ self .fs .set_max_mds (2 , confirm = False )
2722+ self .assertEqual (cfe .exception .exitstatus , errno .EPERM )
2723+
2724+ def test_when_mds_trim_when_with_confirm (self ):
2725+ '''
2726+ Test that command "ceph fs set <fsname> max_mds <num>
2727+ --yes-i-really-mean-it" runs successfully when cluster has MDS_TRIM
2728+ health warning.
2729+ '''
2730+ self .gen_health_warn_mds_trim ()
2731+
2732+ self .fs .set_max_mds (2 , confirm = True )
2733+ self .assertEqual (self .fs .get_var ('max_mds' ), 2 )
2734+
2735+ def test_when_healthy_with_confirm (self ):
2736+ '''
2737+ Test that command "ceph fs set <fsname> max_mds <num>
2738+ --yes-i-really-mean-it" runs successfully also when cluster is
2739+ healthy.
2740+ '''
2741+ self .fs .set_max_mds (2 , confirm = True )
2742+ self .assertEqual (self .fs .get_var ('max_mds' ), 2 )
0 commit comments