Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set PeerReady condition status to false upon relocation initiation #1020

Conversation

BenamarMk
Copy link
Member

@BenamarMk BenamarMk commented Aug 3, 2023

Previously, the PeerReady condition status was set to false after the relocation setup between the source and target clusters was completed and before entering the clean-up phase. This led to a misleading indication that the peer was ready for a new action before getting to that point. Consequently, users can initiate another action, assuming that the PeerReady condition being true meant it was ready for the next step.

To rectify this issue, this commit ensures that as soon as the relocation action is initiated, the PeerReady condition status is immediately switched to false. This change accurately reflects the actual readiness of the peer, preventing any misconceptions about initiating additional actions prematurely.

Fixes: bz 2138855

@BenamarMk BenamarMk force-pushed the set-peerready-status-true-upon-relocation-initiation branch from edc6685 to e018d5b Compare August 3, 2023 18:23
Copy link
Member

@nirs nirs left a comment

Choose a reason for hiding this comment

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

Setting peer ready early looks good to me, but I don't understand the second change.

Also the title of the commit contradicts the commit message and the code - do you mean "Set PeerReady condition status to false upon relocation initiation"?

@@ -741,7 +741,7 @@ func (d *DRPCInstance) RunRelocate() (bool, error) {
return !done, fmt.Errorf(errMsg)
}

if !d.validatePeerReady() {
if d.getLastDRState() != rmn.Relocating && !d.validatePeerReady() {
Copy link
Member

Choose a reason for hiding this comment

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

Is this required because we set peer ready to false earlier, or additional change? If another change, can you separate it to another commit and explain the reason for this change?

Copy link
Member

Choose a reason for hiding this comment

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

Reconcile will loop over Relocate multiple times as various states change (e.g current primary transitions to secondary etc.). As the PeerReady is set to false for the current generation of the spec, once relocation has started, a future loop will error out here. This additional check hence is required to pass this gate if we checked everything was fine with the prior generation and started relocation.

@@ -1048,6 +1048,9 @@ func (d *DRPCInstance) relocate(preferredCluster, preferredClusterNamespace stri
d.setDRState(drState)
Copy link
Member

Choose a reason for hiding this comment

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

The comment above:

// Make sure we record the state that we are failing over

Is copy paste from failover code?

@@ -1048,6 +1048,9 @@ func (d *DRPCInstance) relocate(preferredCluster, preferredClusterNamespace stri
d.setDRState(drState)
addOrUpdateCondition(&d.instance.Status.Conditions, rmn.ConditionAvailable, d.instance.Generation,
d.getConditionStatusForTypeAvailable(), string(d.instance.Status.Phase), "Starting relocation")
addOrUpdateCondition(&d.instance.Status.Conditions, rmn.ConditionPeerReady, d.instance.Generation,
metav1.ConditionFalse, rmn.ReasonNotStarted,
fmt.Sprintf("Started relocation to cluster %q", preferredCluster))
Copy link
Member

Choose a reason for hiding this comment

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

The reason "ReasonNotStarted" contradicts the test "Started relocation".

Copy link
Member

Choose a reason for hiding this comment

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

We could potentially reword this to "Relocation in progress to cluster %q"

Copy link
Member Author

Choose a reason for hiding this comment

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

ack

Copy link
Member

@ShyamsundarR ShyamsundarR left a comment

Choose a reason for hiding this comment

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

LGTM

An orthogonal question/observation:

EnsureCleanup marks PeerReady post its operations are successful. ensureCleanupAndVolSyncReplicationSetup sets up EnsureVolSyncReplicationSetup post cleanup. Should we not mark PeerReady post EnsureVolSyncReplicationSetup is also a success from a VolSync POV?

@BenamarMk
Copy link
Member Author

EnsureCleanup marks PeerReady post its operations are successful. ensureCleanupAndVolSyncReplicationSetup sets up EnsureVolSyncReplicationSetup post cleanup. Should we not mark PeerReady post EnsureVolSyncReplicationSetup is also a success from a VolSync POV?

Not sure I understand the question. EnsureCleanup() is where we set the PeerReady as a success. We don't enter the volsync setup without ensuring that the peer is ready.

Previously, the PeerReady condition status was set to false after the relocation setup between
the source and target clusters was completed and before entering the clean up phase. This led
to a misleading indication that the peer was ready for a new action before getting to that point.
Consequently, users can initiate another action, assuming that the PeerReady condition being true
meant it was ready for the next step.

To rectify this issue, this commit ensures that as soon as the relocation action is initiated,
the PeerReady condition status is immediately switched to false. This change accurately reflects
the actual readiness of the peer, preventing any misconceptions about initiating additional actions
prematurely.

Signed-off-by: Benamar Mekhissi <bmekhiss@ibm.com>
@BenamarMk BenamarMk force-pushed the set-peerready-status-true-upon-relocation-initiation branch from e018d5b to fd162a2 Compare August 4, 2023 12:37
@ShyamsundarR
Copy link
Member

EnsureCleanup marks PeerReady post its operations are successful. ensureCleanupAndVolSyncReplicationSetup sets up EnsureVolSyncReplicationSetup post cleanup. Should we not mark PeerReady post EnsureVolSyncReplicationSetup is also a success from a VolSync POV?

Not sure I understand the question. EnsureCleanup() is where we set the PeerReady as a success. We don't enter the volsync setup without ensuring that the peer is ready.

(just reiterating, does not impact this PR)

So if volsync is not setup on the secondary, is it ready for a relocate? IOW should we declare DRPC PeerReady with Volsync protected volumes before the volsync setup is complete?

(above is based on my understanding that we declare PeerReady true in DRPC post EnsureCleanup and pre EnsureVolSyncReplicationSetup)

@nirs nirs changed the title Set PeerReady condition status to true upon relocation initiation Set PeerReady condition status to false upon relocation initiation Aug 6, 2023
@nirs nirs merged commit 521f7b6 into RamenDR:main Aug 10, 2023
13 checks passed
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.

None yet

3 participants