Skip to content
This repository was archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
ctrl: Demote volume if the state is primary
Browse files Browse the repository at this point in the history
Demote the volume only once if the instance
state is primary.

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
  • Loading branch information
Madhu-1 committed Nov 16, 2021
1 parent 36b5dee commit 5c1f953
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions controllers/volumereplication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,8 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
}, nil
}
} else {
replicationErr = r.markVolumeAsSecondary(instance, logger, volumeHandle, replicationHandle, parameters, secret)
// resync volume if successfully marked Secondary
if replicationErr == nil {
requeueForResync, replicationErr = r.resyncVolume(instance, logger, volumeHandle, replicationHandle, parameters, secret)
}
// resync volume as the volume is already marked Secondary
requeueForResync, replicationErr = r.resyncVolume(instance, logger, volumeHandle, replicationHandle, parameters, secret)
}

case replicationv1alpha1.Resync:
Expand Down

0 comments on commit 5c1f953

Please sign in to comment.