From ee9403c55c3aee9da7b25785b87e370c4095d881 Mon Sep 17 00:00:00 2001 From: yati1998 Date: Mon, 12 Jun 2023 17:20:40 +0530 Subject: [PATCH] replication: update reconcile logic This commit updates the reconcile logic to get more info and update the volrep status. Signed-off-by: yati1998 --- .../volumereplication_controller.go | 11 +++++++++++ internal/sidecar/service/volumereplication.go | 4 +++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/controllers/replication.storage/volumereplication_controller.go b/controllers/replication.storage/volumereplication_controller.go index 5ecf0e8fd..fc15f6c49 100644 --- a/controllers/replication.storage/volumereplication_controller.go +++ b/controllers/replication.storage/volumereplication_controller.go @@ -380,6 +380,17 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re if ts != nil { lastSyncTime := metav1.NewTime(ts.AsTime()) instance.Status.LastSyncTime = &lastSyncTime + instance.Status.LastSyncDuration = nil + instance.Status.LastSyncBytes = nil + td := info.GetLastSyncDuration() + if td != nil { + lastSyncDuration := metav1.Duration{Duration: td.AsDuration()} + instance.Status.LastSyncDuration = &lastSyncDuration + } + tb := info.GetLastSyncBytes() + if tb != 0 { + instance.Status.LastSyncBytes = &tb + } } requeueForInfo = true } else if !util.IsUnimplementedError(err) { diff --git a/internal/sidecar/service/volumereplication.go b/internal/sidecar/service/volumereplication.go index e55ad280d..806e566d4 100644 --- a/internal/sidecar/service/volumereplication.go +++ b/internal/sidecar/service/volumereplication.go @@ -221,6 +221,8 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo( } return &proto.GetVolumeReplicationInfoResponse{ - LastSyncTime: lastsynctime, + LastSyncTime: lastsynctime, + LastSyncDuration: resp.GetLastSyncDuration(), + LastSyncBytes: resp.GetLastSyncBytes(), }, nil }