Skip to content

Ensure accurate resource conflict reporting in NoResourceConflict condition#2442

Open
pruthvitd wants to merge 1 commit intoRamenDR:mainfrom
pruthvitd:fix-vm-conflict
Open

Ensure accurate resource conflict reporting in NoResourceConflict condition#2442
pruthvitd wants to merge 1 commit intoRamenDR:mainfrom
pruthvitd:fix-vm-conflict

Conversation

@pruthvitd
Copy link
Member

Correct IsDRActionInProgress() to avoid false “DR action in progress” when VRG spec/status are already in sync
This PR fixes an issue where IsDRActionInProgress() incorrectly reported that a DR action was in progress even when the Spec.ReplicationState and Status.State of the VRG were already aligned (and the action had effectively completed). The bug primarily surfaced on the secondary VRG, leading to misleading conflict checks and noisy/no-op DR flows.

Correct IsDRActionInProgress() to avoid false “DR action in progress”
when VRG spec/status are already in sync.
This PR fixes an issue where IsDRActionInProgress() incorrectly reported
 that a DR action was in progress even when the Spec.ReplicationState
and Status.State of the VRG were already aligned (and the action had
effectively completed). The bug primarily surfaced on the secondary VRG,
 leading to misleading conflict checks and noisy/no-op DR flows.

Signed-off-by: pruthvitd <prd@redhat.com>
Comment on lines +2470 to +2479
if isRepStateSecondary {
if !switchedToSecondary || (v.instance.Generation != status.ObservedGeneration) {
return true
}
}

if isRepStatePrimary {
if !switchedToPrimary || (v.instance.Generation != status.ObservedGeneration) {
return true
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this removes duplication and is slightly clearer:

Suggested change
if isRepStateSecondary {
if !switchedToSecondary || (v.instance.Generation != status.ObservedGeneration) {
return true
}
}
if isRepStatePrimary {
if !switchedToPrimary || (v.instance.Generation != status.ObservedGeneration) {
return true
}
stateTransitionComplete := (isRepStateSecondary && switchedToSecondary) || (isRepStatePrimary && switchedToPrimary)
if !stateTransitionComplete {
return true
}
if v.instance.Generation != status.ObservedGeneration {
return true
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants