Move falling back full restore logic from PVC CSI RIA to data mover (#10541)
e2e-test-kind.yaml / extract (push) Failing after 6s
Run the E2E test on kind / get-go-version (push) Failing after 7s
Run the E2E test on kind / build (push) Skipped
Run the E2E test on kind / setup-test-matrix (push) Failing after 2s
Run the E2E test on kind / run-e2e-test (push) Skipped
push.yml / extract (push) Failing after 5s
Scorecard supply-chain security / Scorecard analysis (push) Skipped
Main CI / get-go-version (push) Failing after 6s
Main CI / Build (push) Skipped

Move falling back full restore logic from PVC CSI RIA to data mover

Signed-off-by: Wenkai Yin (尹文开) <wenkai.yin@broadcom.com>
This commit is contained in:
Wenkai Yin(尹文开)
2026-09-17 17:28:15 +08:00
committed by GitHub
parent 3721f043f0
commit ed28fb3a49
4 changed files with 12 additions and 8 deletions
+2 -4
View File
@@ -244,7 +244,6 @@ func (p *pvcRestoreItemAction) executeWithDataMove(logger *logrus.Entry, input *
var volumeSnapshot *snapshotv1api.VolumeSnapshot
cleanUpVolumeSnapshot := false
restoreType := input.Restore.Spec.ExistingVolumeDataPolicy
if pvcExists {
// Pre-flight checks must pass before any side effect on the existing PVC/PV.
if err := inplace.CheckPVCBoundToBackedUpVolume(ctx, p.crClient, existingPVC, pvcFromBackup.Spec.VolumeName, pvc.Annotations[velerov1api.InplaceRestoreVolumeHandleAnnotation], pvcFromBackup.Namespace); err != nil {
@@ -264,8 +263,7 @@ func (p *pvcRestoreItemAction) executeWithDataMove(logger *logrus.Entry, input *
logger.Info("requesting an in-place incremental restore with block data mover, taking a CSI snapshot of the existing PVC as the baseline of CBT...")
volumeSnapshot, err = p.createVolumeSnapshot(ctx, logger, input.Restore, *existingPVC, dataUploadResult.SnapshotClass, input.Restore.Spec.CSISnapshotTimeout.Duration)
if err != nil {
logger.Warnf("fail to create VolumeSnapshot for existing PVC %s/%s: %s, fallback to in-place full restore", existingPVC.Namespace, existingPVC.Name, err.Error())
restoreType = velerov1api.VolumeDataPolicyTypeFull
logger.Warnf("Fail to create VolumeSnapshot for existing PVC %s/%s: %s, incremental restore will be suppressed", existingPVC.Namespace, existingPVC.Name, err.Error())
} else {
cleanUpVolumeSnapshot = true
defer func() {
@@ -304,7 +302,7 @@ func (p *pvcRestoreItemAction) executeWithDataMove(logger *logrus.Entry, input *
var dataDownload *velerov2alpha1.DataDownload
dataDownload, err = restoreFromDataUploadResult(
ctx, dataUploadResult, input.Restore, backup, pvc, existingPV, newNamespace,
operationID, string(restoreType), volumeSnapshot, cleanUpVolumeSnapshot, p.crClient)
operationID, string(input.Restore.Spec.ExistingVolumeDataPolicy), volumeSnapshot, cleanUpVolumeSnapshot, p.crClient)
if err != nil {
logger.Errorf("Failed to restore from DataUploadResult: %s", err.Error())
return nil, errors.WithStack(err)
+1 -1
View File
@@ -532,7 +532,7 @@ func TestExecute(t *testing.T) {
ObjectMeta(builder.WithOwnerReference([]metav1.OwnerReference{{APIVersion: velerov1api.SchemeGroupVersion.String(), Kind: "Restore", Name: "testRestore", UID: "uid", Controller: boolptr.True()}}),
builder.WithLabelsMap(map[string]string{velerov1api.AsyncOperationIDLabel: "dd-uid.", velerov1api.RestoreNameLabel: "testRestore", velerov1api.RestoreUIDLabel: "uid"}),
builder.WithGenerateName("testRestore-")).Result()
d.Spec.RestoreType = "full"
d.Spec.RestoreType = "incremental"
d.Spec.DataMover = "velero-block"
return d
}(),