From 5c1f953e0c6f1e74a586e394e21428438f9e28ce Mon Sep 17 00:00:00 2001 From: Madhu Rajanna Date: Tue, 16 Nov 2021 12:00:04 +0530 Subject: [PATCH] ctrl: Demote volume if the state is primary Demote the volume only once if the instance state is primary. Signed-off-by: Madhu Rajanna --- controllers/volumereplication_controller.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/controllers/volumereplication_controller.go b/controllers/volumereplication_controller.go index 42ff2371..a68b671d 100644 --- a/controllers/volumereplication_controller.go +++ b/controllers/volumereplication_controller.go @@ -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: