mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-27 08:40:23 +00:00
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 commitc3c87f2ef3
. Which we added to check the remote image status. Signed-off-by: Madhu Rajanna <madhupr007@gmail.com> (cherry picked from commit704cb5c941
)
This commit is contained in:
parent
8d283f3cca
commit
4b7f0a0541
@ -615,9 +615,8 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checkHealthyPrimary checks if the image is a healhty primary or not.
|
// checkHealthyPrimary checks if the image is a healhty primary or not.
|
||||||
// healthy primary image will be in up+stopped state in local cluster and
|
// healthy primary image will be in up+stopped state, for states other
|
||||||
// up+replaying in the remote clusters, for states other than this it returns
|
// than this it returns an error message.
|
||||||
// an error message.
|
|
||||||
func checkHealthyPrimary(ctx context.Context, rbdVol *rbdVolume) error {
|
func checkHealthyPrimary(ctx context.Context, rbdVol *rbdVolume) error {
|
||||||
mirrorStatus, err := rbdVol.getImageMirroringStatus()
|
mirrorStatus, err := rbdVol.getImageMirroringStatus()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -641,26 +640,6 @@ func checkHealthyPrimary(ctx context.Context, rbdVol *rbdVolume) error {
|
|||||||
localStatus.State)
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user