@@ -216,13 +216,15 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
216216
217217 return reconcile.Result {}, err
218218 }
219+
219220 if pvc != nil {
220221 if err = r .addFinalizerToPVC (ctx , logger , pvc ); err != nil {
221222 logger .Error (err , "Failed to add PersistentVolumeClaim finalizer" )
222223
223224 return reconcile.Result {}, err
224225 }
225226 }
227+
226228 if vg != nil {
227229 if err = r .addFinalizerToVG (ctx , logger , vg ); err != nil {
228230 logger .Error (err , "Failed to add VolumeGroup finalizer" )
@@ -238,6 +240,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
238240
239241 return ctrl.Result {}, err
240242 }
243+
241244 if pvc != nil {
242245 if err = r .removeFinalizerFromPVC (ctx , logger , pvc ); err != nil {
243246 logger .Error (err , "Failed to remove PersistentVolumeClaim finalizer" )
@@ -260,6 +263,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
260263 return reconcile.Result {}, err
261264 }
262265 }
266+
263267 logger .Info ("volumeReplication object is terminated, skipping reconciliation" )
264268
265269 return ctrl.Result {}, nil
@@ -276,6 +280,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
276280 if err = r .enableReplication (logger , replicationSource , replicationHandle , parameters , secret ); err != nil {
277281 logger .Error (err , "failed to enable replication" )
278282 setFailureCondition (instance )
283+
279284 msg := replication .GetMessageFromError (err )
280285 uErr := r .updateReplicationStatus (ctx , instance , logger , getCurrentReplicationState (instance ), msg )
281286 if uErr != nil {
@@ -339,6 +344,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
339344 if replicationErr != nil {
340345 msg := replication .GetMessageFromError (replicationErr )
341346 logger .Error (replicationErr , "failed to Replicate" , "ReplicationState" , instance .Spec .ReplicationState )
347+
342348 err = r .updateReplicationStatus (ctx , instance , logger , getCurrentReplicationState (instance ), msg )
343349 if err != nil {
344350 logger .Error (err , "failed to update volumeReplication status" , "VRName" , instance .Name )
@@ -380,6 +386,7 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
380386 }
381387
382388 instance .Status .LastCompletionTime = getCurrentTime ()
389+
383390 err = r .updateReplicationStatus (ctx , instance , logger , getReplicationState (instance ), msg )
384391 if err != nil {
385392 return ctrl.Result {}, err
@@ -475,6 +482,7 @@ func (r *VolumeReplicationReconciler) waitForVolumeReplicationResource(logger lo
475482 Kind : resourceName ,
476483 Version : replicationv1alpha1 .GroupVersion .Version ,
477484 })
485+
478486 for {
479487 err := r .Client .List (context .TODO (), unstructuredResource )
480488 if err == nil {
@@ -636,6 +644,7 @@ func (r *VolumeReplicationReconciler) disableVolumeReplication(logger logr.Logge
636644
637645 return nil
638646 }
647+
639648 logger .Error (resp .Error , "failed to disable volume replication" )
640649
641650 return resp .Error
0 commit comments