verify/protect: improve error on disappearing snapshots
or clients passing in a non-existent snapshot. Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
parent
07b6db8099
commit
c78437e320
@ -1180,6 +1180,10 @@ impl DataStore {
|
||||
pub fn update_protection(&self, backup_dir: &BackupDir, protection: bool) -> Result<(), Error> {
|
||||
let full_path = backup_dir.full_path();
|
||||
|
||||
if !full_path.exists() {
|
||||
bail!("snapshot {} does not exist!", backup_dir.dir());
|
||||
}
|
||||
|
||||
let _guard = lock_dir_noblock(&full_path, "snapshot", "possibly running or in use")?;
|
||||
|
||||
let protected_path = backup_dir.protected_file();
|
||||
|
@ -328,6 +328,16 @@ pub fn verify_backup_dir(
|
||||
upid: UPID,
|
||||
filter: Option<&dyn Fn(&BackupManifest) -> bool>,
|
||||
) -> Result<bool, Error> {
|
||||
if !backup_dir.full_path().exists() {
|
||||
task_log!(
|
||||
verify_worker.worker,
|
||||
"SKIPPED: verify {}:{} - snapshot does not exist (anymore).",
|
||||
verify_worker.datastore.name(),
|
||||
backup_dir.dir(),
|
||||
);
|
||||
return Ok(true);
|
||||
}
|
||||
|
||||
let snap_lock = lock_dir_noblock_shared(
|
||||
&backup_dir.full_path(),
|
||||
"snapshot",
|
||||
|
Loading…
Reference in New Issue
Block a user