Skip to content

Commit 5ade96f

Browse files
committed
ci: extra commit to fix panic
This commit will be removed later Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
1 parent 18a96f2 commit 5ade96f

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

internal/rbd/group/group_mirror.go

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,22 @@ func (status globalMirrorGroupStatus) GetRemoteSiteStatus(ctx context.Context) (
331331
totalSnapshotDuration += *localSnapInfo.LastSnapshotDuration
332332
}
333333
err = nil
334-
totalDuration := int64(totalSnapshotDuration / int64(totalImages))
334+
totalDuration := int64(0)
335+
if totalSnapshotDuration > 0 {
336+
totalDuration = int64(totalSnapshotDuration / int64(totalImages))
337+
}
338+
totalTime := int64(0)
339+
if totalSnpshotTime > 0 {
340+
totalTime = int64(totalSnpshotTime / int64(totalImages))
341+
}
342+
totalBytes := int64(0)
343+
if totalSnapshotBytes > 0 {
344+
totalBytes = int64(totalSnapshotBytes / int64(totalImages))
345+
}
335346
// write the total snapshot time, bytes and duration to the description
336347
d := localStatus{
337-
LocalSnapshotTime: int64(totalSnpshotTime / int64(totalImages)),
338-
LastSnapshotBytes: int64(totalSnapshotBytes / int64(totalImages)),
348+
LocalSnapshotTime: totalTime,
349+
LastSnapshotBytes: totalBytes,
339350
LastSnapshotDuration: &totalDuration,
340351
}
341352
description, err := json.Marshal(d)

0 commit comments

Comments
 (0)