ceph: remove one extra mon per health check

If the number of desired mons is reduced, for example from 5 down to 3,
the extra mons will be removed by the next health check. Only a single
mon can be removed per health check to ensure that other mons do not
become unhealthy at the same time as removing an extra mon, and so the
list of healthy mons can be refreshed. If multiple mons are removed in
a single health check, we risk removing too many mons and losing quorum.

Signed-off-by: Travis Nielsen <tnielsen@redhat.com>
This commit is contained in:
Travis Nielsen committed 2021-05-27 14:34:09 -06:00
1 parent b281859602
commit 9e982a0eff
1 file changed
+8 -7
+8 -7
View File
@@ -166,14 +166,15 @@ func (c *Cluster) checkHealth() error {
if err := c.removeMon(mon.Name); err != nil {
logger.Warningf("failed to remove mon %q. %v", mon.Name, err)
}
} else {
logger.Warningf(
"mon %q not in source of truth and not in quorum, not enough mons to remove now (wanted: %d, current: %d)",
mon.Name,
desiredMonCount,
len(quorumStatus.MonMap.Mons),
)
// only remove one extra mon per health check
return nil
}
logger.Warningf(
"mon %q not in source of truth and not in quorum, not enough mons to remove now (wanted: %d, current: %d)",
mon.Name,
desiredMonCount,
len(quorumStatus.MonMap.Mons),
)
}
if inQuorum {