[pbs-devel] [RFC PATCH 3/5] fix #3935: datastore/config: add a constant for the locking directory
Stefan Sterz
s.sterz at proxmox.com
Fri Mar 18 15:06:53 CET 2022
adds a constant to make switching the datastore lock directory
location easier
Signed-off-by: Stefan Sterz <s.sterz at proxmox.com>
---
pbs-datastore/src/datastore.rs | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs
index c1304d1a..11bd578d 100644
--- a/pbs-datastore/src/datastore.rs
+++ b/pbs-datastore/src/datastore.rs
@@ -39,6 +39,8 @@ lazy_static! {
static ref DATASTORE_MAP: Mutex<HashMap<String, Arc<DataStore>>> = Mutex::new(HashMap::new());
}
+pub const DATASTORE_LOCKS_DIR: &str = "/run/proxmox-backup/locks";
+
/// checks if auth_id is owner, or, if owner is a token, if
/// auth_id is the user of the token
pub fn check_backup_owner(
@@ -807,7 +809,8 @@ impl DataStore {
backup_dir: &BackupDir,
) -> Result<String, Error> {
let mut path = format!(
- "/run/proxmox-backup/locks/{}/{}/{}",
+ "{}/{}/{}/{}",
+ DATASTORE_LOCKS_DIR,
self.name(),
backup_dir.group().backup_type(),
backup_dir.group().backup_id(),
@@ -949,7 +952,7 @@ impl DataStore {
}
fn snapshot_lock_path(&self, backup_dir: &BackupDir) -> Result<PathBuf, Error> {
- let path = Path::new("/run/proxmox-backup/locks")
+ let path = Path::new(DATASTORE_LOCKS_DIR)
.join(self.name())
.join(backup_dir.relative_path());
@@ -959,7 +962,7 @@ impl DataStore {
}
fn group_lock_path(&self, group: &BackupGroup) -> Result<PathBuf, Error> {
- let path = Path::new("/run/proxmox-backup/locks")
+ let path = Path::new(DATASTORE_LOCKS_DIR)
.join(self.name())
.join(group.group_path());
--
2.30.2
More information about the pbs-devel
mailing list