5
0
mirror of git://git.proxmox.com/git/proxmox-backup.git synced 2025-02-26 21:57:33 +03:00

backup/snapshot reader: improve error message for ENOENT

instead of

 Error: unable to open snapshot directory "/full/path/to/snapshot" for locking - ENOENT: No such file or directory

this will now print

 Error: Snapshot vm/800/2023-01-16T12:28:11Z does not exist.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler 2023-02-02 14:04:23 +01:00 committed by Wolfgang Bumiller
parent bde9e3d74c
commit 07b6db8099
2 changed files with 8 additions and 0 deletions

View File

@ -41,6 +41,10 @@ impl SnapshotReader {
let datastore = snapshot.datastore();
let snapshot_path = snapshot.full_path();
if !snapshot_path.exists() {
bail!("snapshot {} does not exist!", snapshot.dir());
}
let locked_dir =
lock_dir_noblock_shared(&snapshot_path, "snapshot", "locked by another operation")?;

View File

@ -125,6 +125,10 @@ fn upgrade_to_backup_reader_protocol(
}
}
if !backup_dir.full_path().exists() {
bail!("snapshot {} does not exist.", backup_dir.dir());
}
let _guard = lock_dir_noblock_shared(
&backup_dir.full_path(),
"snapshot",