Skip to content

Commit

Permalink
replication: update reconcile logic
Browse files Browse the repository at this point in the history
This commit updates the reconcile logic to
get more info and update the volrep status.

Signed-off-by: yati1998 <[email protected]>
  • Loading branch information
yati1998 committed Jun 22, 2023
1 parent 0294ccd commit 9711c1f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions controllers/replication.storage/volumereplication_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 3 additions & 1 deletion internal/sidecar/service/volumereplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(
}

return &proto.GetVolumeReplicationInfoResponse{
LastSyncTime: lastsynctime,
LastSyncTime: lastsynctime,
LastSyncDuration: resp.GetLastSyncDuration(),
LastSyncBytes: resp.GetLastSyncBytes(),
}, nil
}

0 comments on commit 9711c1f

Please sign in to comment.