Skip to content

Commit 1b4f7df

Browse files
rename ReadyToUse to SnapshotCaptured
1 parent f2cc6b7 commit 1b4f7df

16 files changed

Lines changed: 100 additions & 100 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: 30 additions & 30 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() {
@@ -1979,8 +1979,8 @@ func (r *MantleBackupReconciler) startImport(
19791979
return ctrl.Result{}, fmt.Errorf("failed to unlock the volume: %w", err)
19801980
}
19811981

1982-
if err := r.markSecondaryReadyToUse(ctx, backup, target); err != nil {
1983-
return ctrl.Result{}, fmt.Errorf("failed to mark the secondary as ready to use: %w", err)
1982+
if err := r.markSecondarySnapshotCaptured(ctx, backup, target); err != nil {
1983+
return ctrl.Result{}, fmt.Errorf("failed to mark the secondary as snapshot captured: %w", err)
19841984
}
19851985

19861986
return ctrl.Result{}, nil
@@ -2721,8 +2721,8 @@ func (r *MantleBackupReconciler) createOrUpdateImportJob(
27212721
return err
27222722
}
27232723

2724-
// markSecondaryReadyToUse marks the MantleBackup ReadyToUse as True.
2725-
func (r *MantleBackupReconciler) markSecondaryReadyToUse(
2724+
// markSecondarySnapshotCaptured marks the MantleBackup SnapshotCaptured as True.
2725+
func (r *MantleBackupReconciler) markSecondarySnapshotCaptured(
27262726
ctx context.Context,
27272727
backup *mantlev1.MantleBackup,
27282728
snapshotTarget *snapshotTarget,
@@ -2738,13 +2738,13 @@ func (r *MantleBackupReconciler) markSecondaryReadyToUse(
27382738
return fmt.Errorf("failed to find imported RBD snapshot: %w", err)
27392739
}
27402740

2741-
// Update the status of the MantleBackup to set True to the ReadyToUse condition.
2741+
// Update the status of the MantleBackup to set True to the SnapshotCaptured condition.
27422742
if err := updateStatus(ctx, r.Client, backup, func() error {
27432743
backup.Status.SnapID = &snapshot.Id
27442744
meta.SetStatusCondition(&backup.Status.Conditions, metav1.Condition{
2745-
Type: mantlev1.BackupConditionReadyToUse,
2745+
Type: mantlev1.BackupConditionSnapshotCaptured,
27462746
Status: metav1.ConditionTrue,
2747-
Reason: mantlev1.ConditionReasonReadyToUseNoProblem,
2747+
Reason: mantlev1.ConditionReasonSnapshotCapturedNoProblem,
27482748
})
27492749
return nil
27502750
}); err != nil {

0 commit comments

Comments
 (0)