From f2fe00f1e2986b606bc9f650950535426502e64c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Mon, 16 May 2022 10:39:10 +0200 Subject: [PATCH] BackupDir: fix manifest_lock_path MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this definitely shouldn't rely on BackupDir's Display implementation.. Signed-off-by: Fabian Grünbichler --- pbs-datastore/src/backup_info.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs index c8ceccd5..f8ac099f 100644 --- a/pbs-datastore/src/backup_info.rs +++ b/pbs-datastore/src/backup_info.rs @@ -421,13 +421,14 @@ impl BackupDir { /// Returns the filename to lock a manifest /// /// Also creates the basedir. The lockfile is located in - /// '/run/proxmox-backup/locks/{datastore}/{type}/{id}/{timestamp}.index.json.lck' - fn manifest_lock_path(&self) -> Result { - let mut path = format!("/run/proxmox-backup/locks/{}/{self}", self.store.name()); + /// '/run/proxmox-backup/locks/{datastore}/[ns/{ns}/]+{type}/{id}/{timestamp}.index.json.lck' + fn manifest_lock_path(&self) -> Result { + let mut path = PathBuf::from(&format!("/run/proxmox-backup/locks/{}", self.store.name())); + path.push(self.relative_path()); + std::fs::create_dir_all(&path)?; - use std::fmt::Write; let ts = self.backup_time_string(); - write!(path, "/{ts}{}", &MANIFEST_LOCK_NAME)?; + path.push(&format!("{ts}{MANIFEST_LOCK_NAME}")); Ok(path) }