From: Jos Collin Date: Thu, 9 Oct 2025 13:10:06 +0000 (+0530) Subject: Merge PR #60397 into wip-jcollin-testing-20251009.130945-reef X-Git-Tag: testing/wip-jcollin-testing-20251009.130945-reef X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fheads%2Fwip-jcollin-testing-20251009.130945-reef;p=ceph-ci.git Merge PR #60397 into wip-jcollin-testing-20251009.130945-reef * refs/pull/60397/head: PendingReleaseNotes: add a release note about confirm flag for max_mds doc/cephfs: update about changing max_mds FS setting variable qa/cephfs: add tests for confirmationn required to change max_mds mon,cephfs: require confirmation when changing max_mds on unhealthy cluster --- 311c267afdcf72d1ed1069ec1fa8221f63742a4c diff --cc qa/tasks/cephfs/test_admin.py index 795fc9df99f,e0323a30204..d00129d27de --- a/qa/tasks/cephfs/test_admin.py +++ b/qa/tasks/cephfs/test_admin.py @@@ -2273,27 -2144,86 +2273,84 @@@ class TestMDSFail(TestAdminCommands) ''' health_warn = 'MDS_CACHE_OVERSIZED' self.fs.set_max_mds(2) - self.gen_health_warn_mds_cache_oversized() - mds1_id, mds2_id = self.fs.get_active_names() + + self.mount_a.run_shell_payload("mkdir dir1") + self.mount_a.setfattr("dir1", "ceph.dir.pin", "0") + self._wait_subtrees([('/dir1', 0)], rank=0) + + mds0_id, mds1_id = self.fs.get_active_names() + self.gen_health_warn_mds_cache_oversized(mds_id=mds0_id, path="dir1") # MDS ID for which health warning has been generated. - hw_mds_id = self._get_unhealthy_mds_id(health_warn) - if mds1_id == hw_mds_id: - non_hw_mds_id = mds2_id - elif mds2_id == hw_mds_id: - non_hw_mds_id = mds1_id - else: - raise RuntimeError('There are only 2 MDSs right now but apparently' - 'health warning was raised for an MDS other ' - 'than these two. This is definitely an error.') + count, hw_mds_id = self._get_unhealthy_mds_id(health_warn) + # Validate the warning is raised on only one mds + self.assertEqual(count, 1) + self.assertEqual(hw_mds_id, mds0_id) # actual testing begins now... - self.negtest_ceph_cmd(args=f'mds fail {non_hw_mds_id}', retval=1, - errmsgs=health_warn) - self.negtest_ceph_cmd(args=f'mds fail {hw_mds_id}', retval=1, + self.negtest_ceph_cmd(args=f'mds fail {mds0_id}', retval=1, errmsgs=health_warn) - self.run_ceph_cmd(f'mds fail {mds1_id} --yes-i-really-mean-it') - self.run_ceph_cmd(f'mds fail {mds2_id} --yes-i-really-mean-it') + self.run_ceph_cmd(f'mds fail {mds1_id}') + self.run_ceph_cmd(f'mds fail {mds0_id} --yes-i-really-mean-it') + class TestFSSetMaxMDS(TestAdminCommands): + + def test_when_unhealthy_without_confirm(self): + ''' + Test that command "ceph fs set max_mds " without the + confirmation flag (--yes-i-really-mean-it) fails when cluster is + unhealthy. + ''' + self.gen_health_warn_mds_cache_oversized() + + with self.assertRaises(CommandFailedError) as cfe: + self.fs.set_max_mds(2, confirm=False) + self.assertEqual(cfe.exception.exitstatus, errno.EPERM) + + def test_when_unhealthy_with_confirm(self): + ''' + Test that command "ceph fs set max_mds + --yes-i-really-mean-it" runs successfully when cluster is unhealthy. + ''' + self.gen_health_warn_mds_cache_oversized() + + self.fs.set_max_mds(2, confirm=True) + self.assertEqual(self.fs.get_var('max_mds'), 2) + + def test_when_mds_trim_without_confirm(self): + ''' + Test that command "ceph fs set max_mds " without the + confirmation flag (--yes-i-really-mean-it) fails when cluster has + MDS_TRIM health warning. + ''' + self.gen_health_warn_mds_trim() + + with self.assertRaises(CommandFailedError) as cfe: + self.fs.set_max_mds(2, confirm=False) + self.assertEqual(cfe.exception.exitstatus, errno.EPERM) + + def test_when_mds_trim_when_with_confirm(self): + ''' + Test that command "ceph fs set max_mds + --yes-i-really-mean-it" runs successfully when cluster has MDS_TRIM + health warning. + ''' + self.gen_health_warn_mds_trim() + + self.fs.set_max_mds(2, confirm=True) + self.assertEqual(self.fs.get_var('max_mds'), 2) + + def test_when_healthy_with_confirm(self): + ''' + Test that command "ceph fs set max_mds + --yes-i-really-mean-it" runs successfully also when cluster is + healthy. + ''' + self.fs.set_max_mds(2, confirm=True) + self.assertEqual(self.fs.get_var('max_mds'), 2) + + class TestToggleVolumes(CephFSTestCase): ''' Contains code for enabling/disabling mgr/volumes plugin.