Skip to content

Commit 2ad8bc3

Browse files
rename ReadyToUse to SnapshotCaptured
1 parent 42ba24a commit 2ad8bc3

16 files changed

Lines changed: 94 additions & 94 deletions

api/v1/mantlebackup_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ type MantleBackupStatus struct {
5757
}
5858

5959
const (
60-
BackupConditionReadyToUse = "ReadyToUse"
61-
BackupConditionSyncedToRemote = "SyncedToRemote"
62-
BackupConditionVerified = "Verified"
60+
BackupConditionSnapshotCaptured = "SnapshotCaptured"
61+
BackupConditionSyncedToRemote = "SyncedToRemote"
62+
BackupConditionVerified = "Verified"
6363

64-
// Reasons for ConditionReadyToUse
65-
ConditionReasonReadyToUseNoProblem = "NoProblem"
64+
// Reasons for ConditionSnapshotCaptured
65+
ConditionReasonSnapshotCapturedNoProblem = "NoProblem"
6666
// Reasons for ConditionSyncedToRemote
6767
ConditionReasonSyncedToRemoteNoProblem = "NoProblem"
6868
// Reasons for ConditionVerified
@@ -93,8 +93,8 @@ type MantleBackupList struct {
9393
Items []MantleBackup `json:"items"`
9494
}
9595

96-
func (m *MantleBackup) IsReady() bool {
97-
return meta.IsStatusConditionTrue(m.Status.Conditions, BackupConditionReadyToUse)
96+
func (m *MantleBackup) IsSnapshotCaptured() bool {
97+
return meta.IsStatusConditionTrue(m.Status.Conditions, BackupConditionSnapshotCaptured)
9898
}
9999

100100
func (m *MantleBackup) IsSynced() bool {

docs/design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ spec:
135135
status:
136136
conditions:
137137
# The corresponding backup data is ready to use if `status` is "True"
138-
- type: "ReadyToUse"
138+
- type: "SnapshotCaptured"
139139
status: "True"
140140
```
141141

internal/controller/mantlebackup_controller.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ func (r *MantleBackupReconciler) reconcilePre(ctx context.Context, backup *mantl
410410
return ctrl.Result{}, err
411411
}
412412

413-
if !backup.IsReady() {
413+
if !backup.IsSnapshotCaptured() {
414414
if err := r.provisionRBDSnapshot(ctx, backup, target); err != nil {
415415
return ctrl.Result{}, err
416416
}
@@ -498,14 +498,14 @@ func (r *MantleBackupReconciler) reconcileAsSecondary(ctx context.Context, backu
498498
return ctrl.Result{}, err
499499
}
500500

501-
if !backup.IsReady() {
501+
if !backup.IsSnapshotCaptured() {
502502
result, err := r.startImport(ctx, backup, target)
503503
if err != nil || !result.IsZero() {
504504
return result, err
505505
}
506506
}
507507

508-
if backup.IsReady() && !backup.IsVerified() {
508+
if backup.IsSnapshotCaptured() && !backup.IsVerified() {
509509
if err := r.verify(ctx, backup); err != nil {
510510
return ctrl.Result{}, err
511511
}
@@ -568,7 +568,7 @@ func (r *MantleBackupReconciler) replicate(
568568
return ctrl.Result{}, err
569569
}
570570

571-
if prepareResult.isSecondaryMantleBackupReadyToUse {
571+
if prepareResult.isSecondaryMantleBackupSnapshotCaptured {
572572
if err := r.updateMantleBackupCondition(
573573
ctx, backup,
574574
mantlev1.BackupConditionSyncedToRemote,
@@ -860,7 +860,7 @@ func (r *MantleBackupReconciler) provisionRBDSnapshot(
860860
}
861861

862862
meta.SetStatusCondition(&backup.Status.Conditions, metav1.Condition{
863-
Type: mantlev1.BackupConditionReadyToUse, Status: metav1.ConditionTrue, Reason: mantlev1.ConditionReasonReadyToUseNoProblem})
863+
Type: mantlev1.BackupConditionSnapshotCaptured, Status: metav1.ConditionTrue, Reason: mantlev1.ConditionReasonSnapshotCapturedNoProblem})
864864
return nil
865865
}); err != nil {
866866
logger.Error(err, "failed to update MantleBackup status", "status", backup.Status)
@@ -954,9 +954,9 @@ func (r *MantleBackupReconciler) finalizeSecondary(
954954
}
955955

956956
type dataSyncPrepareResult struct {
957-
isIncremental bool // NOTE: The value is forcibly set to false if isSecondaryMantleBackupReadyToUse is true.
958-
isSecondaryMantleBackupReadyToUse bool
959-
diffFrom *mantlev1.MantleBackup // non-nil value iff isIncremental is true.
957+
isIncremental bool // NOTE: The value is forcibly set to false if isSecondaryMantleBackupSnapshotCaptured is true.
958+
isSecondaryMantleBackupSnapshotCaptured bool
959+
diffFrom *mantlev1.MantleBackup // non-nil value iff isIncremental is true.
960960
}
961961

962962
func (r *MantleBackupReconciler) prepareForDataSynchronization(
@@ -990,23 +990,23 @@ func (r *MantleBackupReconciler) prepareForDataSynchronization(
990990
return nil, fmt.Errorf("secondary MantleBackup not found: %s, %s",
991991
backup.GetName(), backup.GetNamespace())
992992
}
993-
isSecondaryMantleBackupReadyToUse := secondaryBackup.IsReady()
993+
isSecondaryMantleBackupSnapshotCaptured := secondaryBackup.IsSnapshotCaptured()
994994

995-
if isSecondaryMantleBackupReadyToUse {
995+
if isSecondaryMantleBackupSnapshotCaptured {
996996
return &dataSyncPrepareResult{
997-
isIncremental: false,
998-
isSecondaryMantleBackupReadyToUse: true,
999-
diffFrom: nil,
997+
isIncremental: false,
998+
isSecondaryMantleBackupSnapshotCaptured: true,
999+
diffFrom: nil,
10001000
}, nil
10011001
}
10021002

10031003
if syncMode, ok := backup.GetAnnotations()[annotSyncMode]; ok {
10041004
switch syncMode {
10051005
case syncModeFull:
10061006
return &dataSyncPrepareResult{
1007-
isIncremental: false,
1008-
isSecondaryMantleBackupReadyToUse: isSecondaryMantleBackupReadyToUse,
1009-
diffFrom: nil,
1007+
isIncremental: false,
1008+
isSecondaryMantleBackupSnapshotCaptured: isSecondaryMantleBackupSnapshotCaptured,
1009+
diffFrom: nil,
10101010
}, nil
10111011
case syncModeIncremental:
10121012
diffFromName, ok := backup.GetAnnotations()[annotDiffFrom]
@@ -1024,9 +1024,9 @@ func (r *MantleBackupReconciler) prepareForDataSynchronization(
10241024
}
10251025

10261026
return &dataSyncPrepareResult{
1027-
isIncremental: true,
1028-
isSecondaryMantleBackupReadyToUse: isSecondaryMantleBackupReadyToUse,
1029-
diffFrom: &diffFrom,
1027+
isIncremental: true,
1028+
isSecondaryMantleBackupSnapshotCaptured: isSecondaryMantleBackupSnapshotCaptured,
1029+
diffFrom: &diffFrom,
10301030
}, nil
10311031
default:
10321032
return nil, fmt.Errorf("unknown sync mode: %s", syncMode)
@@ -1047,9 +1047,9 @@ func (r *MantleBackupReconciler) prepareForDataSynchronization(
10471047
isIncremental := (diffFrom != nil)
10481048

10491049
return &dataSyncPrepareResult{
1050-
isIncremental: isIncremental,
1051-
isSecondaryMantleBackupReadyToUse: isSecondaryMantleBackupReadyToUse,
1052-
diffFrom: diffFrom,
1050+
isIncremental: isIncremental,
1051+
isSecondaryMantleBackupSnapshotCaptured: isSecondaryMantleBackupSnapshotCaptured,
1052+
diffFrom: diffFrom,
10531053
}, nil
10541054
}
10551055

@@ -1072,7 +1072,7 @@ func searchForDiffOriginMantleBackup(
10721072
if !ok {
10731073
continue
10741074
}
1075-
if !primaryBackup.IsReady() || !secondaryBackup.IsReady() {
1075+
if !primaryBackup.IsSnapshotCaptured() || !secondaryBackup.IsSnapshotCaptured() {
10761076
continue
10771077
}
10781078
if !primaryBackup.DeletionTimestamp.IsZero() || !secondaryBackup.DeletionTimestamp.IsZero() {
@@ -2496,13 +2496,13 @@ func (r *MantleBackupReconciler) reconcileImportJob(
24962496
return ctrl.Result{}, fmt.Errorf("failed to find imported RBD snapshot: %w", err)
24972497
}
24982498

2499-
// Update the status of the MantleBackup to set True to the ReadyToUse condition.
2499+
// Update the status of the MantleBackup to set True to the SnapshotCaptured condition.
25002500
if err := updateStatus(ctx, r.Client, backup, func() error {
25012501
backup.Status.SnapID = &snapshot.Id
25022502
meta.SetStatusCondition(&backup.Status.Conditions, metav1.Condition{
2503-
Type: mantlev1.BackupConditionReadyToUse,
2503+
Type: mantlev1.BackupConditionSnapshotCaptured,
25042504
Status: metav1.ConditionTrue,
2505-
Reason: mantlev1.ConditionReasonReadyToUseNoProblem,
2505+
Reason: mantlev1.ConditionReasonSnapshotCapturedNoProblem,
25062506
})
25072507
return nil
25082508
}); err != nil {

0 commit comments

Comments
 (0)