backup: lock base snapshot and ensure existance on finish
To prevent forgetting the base snapshot of a running backup, and catch the case when it still happens (e.g. via manual rm) to at least error out instead of storing a potentially invalid backup. Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
8b5f72b176
commit
81f293513e
@ -480,6 +480,16 @@ impl BackupEnvironment {
|
||||
self.datastore.store_manifest(&self.backup_dir, manifest)
|
||||
.map_err(|err| format_err!("unable to store manifest blob - {}", err))?;
|
||||
|
||||
if let Some(base) = &self.last_backup {
|
||||
let path = self.datastore.snapshot_path(&base.backup_dir);
|
||||
if !path.exists() {
|
||||
bail!(
|
||||
"base snapshot {} was removed during backup, cannot finish as chunks might be missing",
|
||||
base.backup_dir
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// marks the backup as successful
|
||||
state.finished = true;
|
||||
|
||||
|
Reference in New Issue
Block a user