mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-04-17 14:11:11 +00:00
remove calls to restic check before/after prune (#1794)
* remove calls to restic check before/after prune Signed-off-by: Steve Kriss <krisss@vmware.com> * changelog Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
committed by
Adnan Abdulhussein
parent
3a0c1be7f0
commit
686f41ebec
1
changelogs/unreleased/1794-skriss
Normal file
1
changelogs/unreleased/1794-skriss
Normal file
@@ -0,0 +1 @@
|
||||
remove 'restic check' calls from before/after 'restic prune' since they're redundant
|
||||
@@ -216,11 +216,6 @@ func (c *resticRepositoryController) runMaintenanceIfDue(req *v1.ResticRepositor
|
||||
|
||||
log.Info("Running maintenance on restic repository")
|
||||
|
||||
log.Debug("Checking repo before prune")
|
||||
if err := c.repositoryManager.CheckRepo(req); err != nil {
|
||||
return c.patchResticRepository(req, repoNotReady(err.Error()))
|
||||
}
|
||||
|
||||
// prune failures should be displayed in the `.status.message` field but
|
||||
// should not cause the repo to move to `NotReady`.
|
||||
log.Debug("Pruning repo")
|
||||
@@ -233,11 +228,6 @@ func (c *resticRepositoryController) runMaintenanceIfDue(req *v1.ResticRepositor
|
||||
}
|
||||
}
|
||||
|
||||
log.Debug("Checking repo after prune")
|
||||
if err := c.repositoryManager.CheckRepo(req); err != nil {
|
||||
return c.patchResticRepository(req, repoNotReady(err.Error()))
|
||||
}
|
||||
|
||||
return c.patchResticRepository(req, func(req *v1.ResticRepository) {
|
||||
req.Status.LastMaintenanceTime = metav1.Time{Time: now}
|
||||
})
|
||||
|
||||
@@ -91,13 +91,6 @@ func SnapshotsCommand(repoIdentifier string) *Command {
|
||||
}
|
||||
}
|
||||
|
||||
func CheckCommand(repoIdentifier string) *Command {
|
||||
return &Command{
|
||||
Command: "check",
|
||||
RepoIdentifier: repoIdentifier,
|
||||
}
|
||||
}
|
||||
|
||||
func PruneCommand(repoIdentifier string) *Command {
|
||||
return &Command{
|
||||
Command: "prune",
|
||||
|
||||
@@ -103,13 +103,6 @@ func TestSnapshotsCommand(t *testing.T) {
|
||||
assert.Equal(t, "repo-id", c.RepoIdentifier)
|
||||
}
|
||||
|
||||
func TestCheckCommand(t *testing.T) {
|
||||
c := CheckCommand("repo-id")
|
||||
|
||||
assert.Equal(t, "check", c.Command)
|
||||
assert.Equal(t, "repo-id", c.RepoIdentifier)
|
||||
}
|
||||
|
||||
func TestPruneCommand(t *testing.T) {
|
||||
c := PruneCommand("repo-id")
|
||||
|
||||
|
||||
@@ -49,9 +49,6 @@ type RepositoryManager interface {
|
||||
// authenticated to.
|
||||
ConnectToRepo(repo *velerov1api.ResticRepository) error
|
||||
|
||||
// CheckRepo checks the specified repo for errors.
|
||||
CheckRepo(repo *velerov1api.ResticRepository) error
|
||||
|
||||
// PruneRepo deletes unused data from a repo.
|
||||
PruneRepo(repo *velerov1api.ResticRepository) error
|
||||
|
||||
@@ -200,14 +197,6 @@ func (rm *repositoryManager) ConnectToRepo(repo *velerov1api.ResticRepository) e
|
||||
return rm.exec(snapshotsCmd, repo.Spec.BackupStorageLocation)
|
||||
}
|
||||
|
||||
func (rm *repositoryManager) CheckRepo(repo *velerov1api.ResticRepository) error {
|
||||
// restic check requires an exclusive lock
|
||||
rm.repoLocker.LockExclusive(repo.Name)
|
||||
defer rm.repoLocker.UnlockExclusive(repo.Name)
|
||||
|
||||
return rm.exec(CheckCommand(repo.Spec.ResticIdentifier), repo.Spec.BackupStorageLocation)
|
||||
}
|
||||
|
||||
func (rm *repositoryManager) PruneRepo(repo *velerov1api.ResticRepository) error {
|
||||
// restic prune requires an exclusive lock
|
||||
rm.repoLocker.LockExclusive(repo.Name)
|
||||
|
||||
Reference in New Issue
Block a user