all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH proxmox-backup] snapshot locking: improve error contexts
@ 2026-10-23 12:11 Fabian Grünbichler
  0 siblings, 0 replies; only message in thread
From: Fabian Grünbichler @ 2026-10-23 12:11 UTC (permalink / raw)
  To: pbs-devel

having the struct-debug representation logged is rather noisy, the relative
path contains all the relevant information.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---

Notes:
    this is still often redundant, since context higher up might contain the
    API-type BackupDir, and the error itself might contain multiple copies of the
    lock path, but it's still an improvement..

 pbs-datastore/src/datastore.rs | 9 ++++++---
 src/api2/reader/mod.rs         | 4 ++--
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index d6dcce77f..665333f52 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -1870,14 +1870,14 @@ impl DataStore {
         match std::fs::create_dir(backup_dir.full_path()) {
             Ok(_) => {
                 let guard = backup_dir.lock().with_context(|| {
-                    format!("while creating new locked snapshot '{backup_dir:?}'")
+                    format!("while creating new locked snapshot {relative_path:?}")
                 })?;
                 Ok((relative_path, true, guard))
             }
             Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => {
                 let guard = backup_dir
                     .lock()
-                    .with_context(|| format!("while creating locked snapshot '{backup_dir:?}'"))?;
+                    .with_context(|| format!("while creating locked snapshot {relative_path:?}"))?;
                 Ok((relative_path, false, guard))
             }
             Err(e) => Err(e.into()),
@@ -2838,7 +2838,10 @@ impl DataStore {
         }
 
         let _guard = backup_dir.lock().with_context(|| {
-            format!("while updating the protection status of snapshot '{backup_dir:?}'")
+            format!(
+                "while updating the protection status of snapshot {:?}",
+                backup_dir.relative_path()
+            )
         })?;
 
         let protected_path = backup_dir.protected_file();
diff --git a/src/api2/reader/mod.rs b/src/api2/reader/mod.rs
index 4321d2286..29c00e74c 100644
--- a/src/api2/reader/mod.rs
+++ b/src/api2/reader/mod.rs
@@ -131,12 +131,12 @@ fn upgrade_to_backup_reader_protocol(
         }
 
         if !backup_dir.full_path().exists() {
-            bail!("snapshot {} does not exist.", backup_dir.dir());
+            bail!("snapshot {:?} does not exist.", backup_dir.relative_path());
         }
 
         let _guard = backup_dir
             .lock_shared()
-            .with_context(|| format!("while reading snapshot '{backup_dir:?}'"))?;
+            .with_context(|| format!("while reading snapshot {:?}", backup_dir.relative_path()))?;
 
         let path = datastore.base_path();
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-23 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-23 12:11 [PATCH proxmox-backup] snapshot locking: improve error contexts Fabian Grünbichler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal