]> git.proxmox.com Git - proxmox-backup.git/commit - src/api2/backup/environment.rs
datastore: prevent deletion of snaps in use as "previous backup"
authorStefan Reiter <s.reiter@proxmox.com>
Wed, 29 Jul 2020 12:33:11 +0000 (14:33 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 30 Jul 2020 06:26:01 +0000 (08:26 +0200)
commitc9756b40d1b33c573216f7c8eba209200c1d9bd5
treeada7c9df73d41a87089a648aa2863037af1c1e5d
parent8cd29fb24a2d6784d31626f8f633cb3199e9aa44
datastore: prevent deletion of snaps in use as "previous backup"

To prevent a race with a background GC operation, do not allow deletion
of backups who's index might currently be referenced as the "known chunk
list" for successive backups. Otherwise the GC could delete chunks it
thinks are no longer referenced, while at the same time telling the
client that it doesn't need to upload said chunks because they already
exist.

Additionally, prevent deletion of whole backup groups, if there are
snapshots contained that appear to be currently in-progress. This is
currently unlikely to trigger, as that function is only used for sync
jobs, but it's a useful safeguard either way.

Deleting a single snapshot has a 'force' parameter, which is necessary
to allow deleting incomplete snapshots on an aborted backup. Pruning
also sets force=true to avoid the check, since it calculates which
snapshots to keep on its own.

To avoid code duplication, the is_finished method is factored out.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
src/api2/admin/datastore.rs
src/api2/backup/environment.rs
src/backup/backup_info.rs
src/backup/datastore.rs
src/backup/prune.rs
src/bin/proxmox-backup-proxy.rs
src/client/pull.rs