Skip to content

Commit

Permalink
fix restore bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyelei committed Jan 23, 2025
1 parent 0f05bda commit 40ba2ad
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/dataprotection/restore/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ func FormatRestoreTimeAndValidate(restoreTimeStr string, continuousBackup *dpv1a
restoreTimeStr = restoreTime.UTC().Format(time.RFC3339)
// TODO: check with Recoverable time

if continuousBackup.Status.TimeRange == nil || continuousBackup.Status.TimeRange.Start.IsZero() || continuousBackup.Status.TimeRange.End.IsZero() {
if continuousBackup.Status.TimeRange == nil || continuousBackup.GetStartTime().IsZero() || continuousBackup.GetEndTime().IsZero() {
return restoreTimeStr, fmt.Errorf("invalid timeRange of the backup")
}
if !isTimeInRange(restoreTime, continuousBackup.Status.TimeRange.Start.Time, continuousBackup.Status.TimeRange.End.Time) {
if !isTimeInRange(restoreTime, continuousBackup.GetStartTime().Time, continuousBackup.GetEndTime().Time) {
return restoreTimeStr, fmt.Errorf("restore-to-time is out of time range, you can view the recoverable time: \n"+
"\tkbcli cluster describe %s -n %s", continuousBackup.Labels[constant.AppInstanceLabelKey], continuousBackup.Namespace)
}
Expand Down

0 comments on commit 40ba2ad

Please sign in to comment.