Skip to content

Commit

Permalink
ci: extra commit to fix panic
Browse files Browse the repository at this point in the history
This commit will be removed later

Signed-off-by: Madhu Rajanna <[email protected]>
  • Loading branch information
Madhu-1 committed Jan 13, 2025
1 parent 6e5f2b7 commit 9247965
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
4 changes: 3 additions & 1 deletion internal/csi-addons/rbd/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,9 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
remoteStatus, err := mirrorStatus.GetRemoteSiteStatus(ctx)
if err != nil {
log.ErrorLog(ctx, err.Error())

if errors.Is(err, librbd.ErrNotExist) {
return nil, status.Errorf(codes.NotFound, "failed to get remote status: %v", err)
}
return nil, status.Errorf(codes.Internal, "failed to get remote status: %v", err)
}

Expand Down
17 changes: 14 additions & 3 deletions internal/rbd/group/group_mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,22 @@ func (status globalMirrorGroupStatus) GetRemoteSiteStatus(ctx context.Context) (
totalSnapshotDuration += *localSnapInfo.LastSnapshotDuration
}
err = nil
totalDuration := int64(totalSnapshotDuration / int64(totalImages))
totalDuration := int64(0)
if totalSnapshotDuration > 0 {
totalDuration = int64(totalSnapshotDuration / int64(totalImages))
}
totalTime := int64(0)
if totalSnpshotTime > 0 {
totalTime = int64(totalSnpshotTime / int64(totalImages))
}
totalBytes := int64(0)
if totalSnapshotBytes > 0 {
totalBytes = int64(totalSnapshotBytes / int64(totalImages))
}
// write the total snapshot time, bytes and duration to the description
d := localStatus{
LocalSnapshotTime: int64(totalSnpshotTime / int64(totalImages)),
LastSnapshotBytes: int64(totalSnapshotBytes / int64(totalImages)),
LocalSnapshotTime: totalTime,
LastSnapshotBytes: totalBytes,
LastSnapshotDuration: &totalDuration,
}
description, err := json.Marshal(d)
Expand Down

0 comments on commit 9247965

Please sign in to comment.