From 4b7f0a054146a73a39e659eca26c8f6b52f445a0 Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Mon, 27 Jun 2022 18:38:36 +0530 Subject: [PATCH] revert: rbd: consider remote image health for primary When the image is force promoted to primary on the cluster the remote image might not be in replaying state because due to the split brain state. This PR reverts back the commit c3c87f2ef33e8d8ad08d7d9f28b59d1aedc4ef31. Which we added to check the remote image status. Signed-off-by: Madhu Rajanna (cherry picked from commit 704cb5c941f7850800286e955c2db1de409ca35b) --- internal/rbd/replicationcontrollerserver.go | 25 ++------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/internal/rbd/replicationcontrollerserver.go b/internal/rbd/replicationcontrollerserver.go index 90c885632..cc036b6fc 100644 --- a/internal/rbd/replicationcontrollerserver.go +++ b/internal/rbd/replicationcontrollerserver.go @@ -615,9 +615,8 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context, } // checkHealthyPrimary checks if the image is a healhty primary or not. -// healthy primary image will be in up+stopped state in local cluster and -// up+replaying in the remote clusters, for states other than this it returns -// an error message. +// healthy primary image will be in up+stopped state, for states other +// than this it returns an error message. func checkHealthyPrimary(ctx context.Context, rbdVol *rbdVolume) error { mirrorStatus, err := rbdVol.getImageMirroringStatus() if err != nil { @@ -641,26 +640,6 @@ func checkHealthyPrimary(ctx context.Context, rbdVol *rbdVolume) error { localStatus.State) } - // Remote image should be in up+replaying state. - for _, s := range mirrorStatus.SiteStatuses { - log.UsefulLog( - ctx, - "peer site mirrorUUID=%q, daemon up=%t, mirroring state=%q, description=%q and lastUpdate=%d", - s.MirrorUUID, - s.Up, - s.State, - s.Description, - s.LastUpdate) - if s.MirrorUUID != "" { - if !s.Up && s.State != librbd.MirrorImageStatusStateReplaying { - return fmt.Errorf("remote image %s is not healthy. State is up=%t, state=%q", - rbdVol, - s.Up, - s.State) - } - } - } - return nil }