Skip to content

Commit 7a68790

Browse files
rename ReadyToUse to SnapshotCaptured
1 parent 758c767 commit 7a68790

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
@@ -462,7 +462,7 @@ func (r *MantleBackupReconciler) reconcileAsSecondary(ctx context.Context, backu
462462
return ctrl.Result{}, err
463463
}
464464

465-
if backup.IsReady() {
465+
if backup.IsSnapshotCaptured() {
466466
return r.secondaryCleanup(ctx, backup, true)
467467
}
468468

@@ -525,7 +525,7 @@ func (r *MantleBackupReconciler) replicate(
525525
return ctrl.Result{}, err
526526
}
527527

528-
if prepareResult.isSecondaryMantleBackupReadyToUse {
528+
if prepareResult.isSecondaryMantleBackupSnapshotCaptured {
529529
return r.primaryCleanup(ctx, backup)
530530
}
531531
return r.startExportAndUpload(ctx, backup, prepareResult)
@@ -771,8 +771,8 @@ func (r *MantleBackupReconciler) provisionRBDSnapshot(
771771
return err
772772
}
773773

774-
// If the given MantleBackup is not ready to use, create a new RBD snapshot and update its status.
775-
if backup.IsReady() {
774+
// If the given MantleBackup snapshot is not captured, create a new RBD snapshot and update its status.
775+
if backup.IsSnapshotCaptured() {
776776
return nil
777777
}
778778

@@ -801,7 +801,7 @@ func (r *MantleBackupReconciler) provisionRBDSnapshot(
801801
backup.Status.SnapSize = &snapshot.Size
802802

803803
meta.SetStatusCondition(&backup.Status.Conditions, metav1.Condition{
804-
Type: mantlev1.BackupConditionReadyToUse, Status: metav1.ConditionTrue, Reason: mantlev1.ConditionReasonReadyToUseNoProblem})
804+
Type: mantlev1.BackupConditionSnapshotCaptured, Status: metav1.ConditionTrue, Reason: mantlev1.ConditionReasonSnapshotCapturedNoProblem})
805805
return nil
806806
}); err != nil {
807807
logger.Error(err, "failed to update MantleBackup status", "status", backup.Status)
@@ -895,9 +895,9 @@ func (r *MantleBackupReconciler) finalizeSecondary(
895895
}
896896

897897
type dataSyncPrepareResult struct {
898-
isIncremental bool // NOTE: The value is forcibly set to false if isSecondaryMantleBackupReadyToUse is true.
899-
isSecondaryMantleBackupReadyToUse bool
900-
diffFrom *mantlev1.MantleBackup // non-nil value iff isIncremental is true.
898+
isIncremental bool // NOTE: The value is forcibly set to false if isSecondaryMantleBackupSnapshotCaptured is true.
899+
isSecondaryMantleBackupSnapshotCaptured bool
900+
diffFrom *mantlev1.MantleBackup // non-nil value iff isIncremental is true.
901901
}
902902

903903
func (r *MantleBackupReconciler) prepareForDataSynchronization(
@@ -931,23 +931,23 @@ func (r *MantleBackupReconciler) prepareForDataSynchronization(
931931
return nil, fmt.Errorf("secondary MantleBackup not found: %s, %s",
932932
backup.GetName(), backup.GetNamespace())
933933
}
934-
isSecondaryMantleBackupReadyToUse := secondaryBackup.IsReady()
934+
isSecondaryMantleBackupSnapshotCaptured := secondaryBackup.IsSnapshotCaptured()
935935

936-
if isSecondaryMantleBackupReadyToUse {
936+
if isSecondaryMantleBackupSnapshotCaptured {
937937
return &dataSyncPrepareResult{
938-
isIncremental: false,
939-
isSecondaryMantleBackupReadyToUse: true,
940-
diffFrom: nil,
938+
isIncremental: false,
939+
isSecondaryMantleBackupSnapshotCaptured: true,
940+
diffFrom: nil,
941941
}, nil
942942
}
943943

944944
if syncMode, ok := backup.GetAnnotations()[annotSyncMode]; ok {
945945
switch syncMode {
946946
case syncModeFull:
947947
return &dataSyncPrepareResult{
948-
isIncremental: false,
949-
isSecondaryMantleBackupReadyToUse: isSecondaryMantleBackupReadyToUse,
950-
diffFrom: nil,
948+
isIncremental: false,
949+
isSecondaryMantleBackupSnapshotCaptured: isSecondaryMantleBackupSnapshotCaptured,
950+
diffFrom: nil,
951951
}, nil
952952
case syncModeIncremental:
953953
diffFromName, ok := backup.GetAnnotations()[annotDiffFrom]
@@ -965,9 +965,9 @@ func (r *MantleBackupReconciler) prepareForDataSynchronization(
965965
}
966966

967967
return &dataSyncPrepareResult{
968-
isIncremental: true,
969-
isSecondaryMantleBackupReadyToUse: isSecondaryMantleBackupReadyToUse,
970-
diffFrom: &diffFrom,
968+
isIncremental: true,
969+
isSecondaryMantleBackupSnapshotCaptured: isSecondaryMantleBackupSnapshotCaptured,
970+
diffFrom: &diffFrom,
971971
}, nil
972972
default:
973973
return nil, fmt.Errorf("unknown sync mode: %s", syncMode)
@@ -988,9 +988,9 @@ func (r *MantleBackupReconciler) prepareForDataSynchronization(
988988
isIncremental := (diffFrom != nil)
989989

990990
return &dataSyncPrepareResult{
991-
isIncremental: isIncremental,
992-
isSecondaryMantleBackupReadyToUse: isSecondaryMantleBackupReadyToUse,
993-
diffFrom: diffFrom,
991+
isIncremental: isIncremental,
992+
isSecondaryMantleBackupSnapshotCaptured: isSecondaryMantleBackupSnapshotCaptured,
993+
diffFrom: diffFrom,
994994
}, nil
995995
}
996996

@@ -1013,7 +1013,7 @@ func searchForDiffOriginMantleBackup(
10131013
if !ok {
10141014
continue
10151015
}
1016-
if !primaryBackup.IsReady() || !secondaryBackup.IsReady() {
1016+
if !primaryBackup.IsSnapshotCaptured() || !secondaryBackup.IsSnapshotCaptured() {
10171017
continue
10181018
}
10191019
if !primaryBackup.DeletionTimestamp.IsZero() || !secondaryBackup.DeletionTimestamp.IsZero() {
@@ -2382,13 +2382,13 @@ func (r *MantleBackupReconciler) reconcileImportJob(
23822382
return ctrl.Result{}, fmt.Errorf("failed to find imported RBD snapshot: %w", err)
23832383
}
23842384

2385-
// Update the status of the MantleBackup to set True to the ReadyToUse condition.
2385+
// Update the status of the MantleBackup to set True to the SnapshotCaptured condition.
23862386
if err := updateStatus(ctx, r.Client, backup, func() error {
23872387
backup.Status.SnapID = &snapshot.Id
23882388
meta.SetStatusCondition(&backup.Status.Conditions, metav1.Condition{
2389-
Type: mantlev1.BackupConditionReadyToUse,
2389+
Type: mantlev1.BackupConditionSnapshotCaptured,
23902390
Status: metav1.ConditionTrue,
2391-
Reason: mantlev1.ConditionReasonReadyToUseNoProblem,
2391+
Reason: mantlev1.ConditionReasonSnapshotCapturedNoProblem,
23922392
})
23932393
return nil
23942394
}); err != nil {

0 commit comments

Comments
 (0)