mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-08 22:23:15 +00:00
Merge pull request #7247 from Lyndon-Li/release-1.12
[1.12] Issue 7244: delete incomplete snapshot automatically for kopia uploader
This commit is contained in:
1
changelogs/unreleased/7247-Lyndon-Li
Normal file
1
changelogs/unreleased/7247-Lyndon-Li
Normal file
@@ -0,0 +1 @@
|
||||
Fix issue #7244. By the end of the upload, check the outstanding incomplete snapshots and delete them by calling ApplyRetentionPolicy
|
||||
@@ -44,6 +44,7 @@ import (
|
||||
)
|
||||
|
||||
// All function mainly used to make testing more convenient
|
||||
var applyRetentionPolicyFunc = policy.ApplyRetentionPolicy
|
||||
var treeForSourceFunc = policy.TreeForSource
|
||||
var setPolicyFunc = policy.SetPolicy
|
||||
var saveSnapshotFunc = snapshot.SaveSnapshot
|
||||
@@ -277,6 +278,11 @@ func SnapshotSource(
|
||||
return "", 0, errors.Wrapf(err, "Failed to save kopia manifest %v", manifest.ID)
|
||||
}
|
||||
|
||||
_, err = applyRetentionPolicyFunc(ctx, rep, sourceInfo, true)
|
||||
if err != nil {
|
||||
return "", 0, errors.Wrapf(err, "Failed to apply kopia retention policy for si %v", sourceInfo)
|
||||
}
|
||||
|
||||
if err = rep.Flush(ctx); err != nil {
|
||||
return "", 0, errors.Wrapf(err, "Failed to flush kopia repository")
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ func injectSnapshotFuncs() *snapshotMockes {
|
||||
repoWriterMock: &repomocks.RepositoryWriter{},
|
||||
}
|
||||
|
||||
applyRetentionPolicyFunc = s.policyMock.ApplyRetentionPolicy
|
||||
setPolicyFunc = s.policyMock.SetPolicy
|
||||
treeForSourceFunc = s.policyMock.TreeForSource
|
||||
loadSnapshotFunc = s.snapshotMock.LoadSnapshot
|
||||
|
||||
Reference in New Issue
Block a user