Merge PR #21536 into master

* refs/pull/21536/head:
	qa: check old_max_mds is not wiped by marked down twice
	MDSMonitor: do not wipe old_max_mds when marked down twice

Reviewed-by: Douglas Fuller <dfuller@redhat.com>
This commit is contained in:
Patrick Donnelly 2018-04-23 21:27:55 -07:00
commit 613d3b72cf
No known key found for this signature in database
GPG Key ID: 3A2A7E25BEA8AADB
2 changed files with 21 additions and 5 deletions

View File

@ -88,18 +88,32 @@ class TestClusterResize(CephFSTestCase):
self.shrink(2)
self.wait_for_health_clear(30)
def test_down_twice(self):
"""
That marking a FS down twice does not wipe old_max_mds.
"""
self.grow(2)
self.fs.set_down()
self.wait_for_health("MDS_ALL_DOWN", 30)
self.fs.set_down(False)
mdsmap = self.fs.get_mds_map()
self.assertTrue(mdsmap["max_mds"] == 2)
self.fs.wait_for_daemons(timeout=60)
def test_all_down(self):
"""
That a health error is generated when FS has no active MDS.
That a health error is generated when FS has no active MDS and cleared
when actives come back online.
"""
self.fs.set_down()
self.wait_for_health("MDS_ALL_DOWN", 30)
self.fs.set_down(False)
self.wait_for_health_clear(30)
self.fs.set_down()
self.fs.set_down(True)
self.wait_for_health("MDS_ALL_DOWN", 30)
self.grow(1)
self.grow(2)
self.wait_for_health_clear(30)
def test_hole(self):

View File

@ -389,8 +389,10 @@ public:
[is_down](std::shared_ptr<Filesystem> fs)
{
if (is_down) {
fs->mds_map.set_old_max_mds();
fs->mds_map.set_max_mds(0);
if (fs->mds_map.get_max_mds() > 0) {
fs->mds_map.set_old_max_mds();
fs->mds_map.set_max_mds(0);
} /* else already down! */
} else {
mds_rank_t oldmax = fs->mds_map.get_old_max_mds();
fs->mds_map.set_max_mds(oldmax ? oldmax : 1);