From 9e982a0effeb75a09351cae32fe04376a54d9ddc Mon Sep 17 00:00:00 2001 From: Travis Nielsen Date: Thu, 27 May 2021 14:34:09 -0600 Subject: [PATCH] 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 --- pkg/operator/ceph/cluster/mon/health.go | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pkg/operator/ceph/cluster/mon/health.go b/pkg/operator/ceph/cluster/mon/health.go index a170763e1..da53443f6 100644 --- a/pkg/operator/ceph/cluster/mon/health.go +++ b/pkg/operator/ceph/cluster/mon/health.go @@ -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 {