diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs index ccedb250..7a479cec 100644 --- a/pbs-datastore/src/backup_info.rs +++ b/pbs-datastore/src/backup_info.rs @@ -60,7 +60,7 @@ impl BackupGroup { &self.backup_id } - pub fn group_path(&self) -> PathBuf { + pub fn relative_group_path(&self) -> PathBuf { let mut relative_path = PathBuf::new(); relative_path.push(self.backup_type.as_str()); @@ -74,7 +74,7 @@ impl BackupGroup { let mut list = vec![]; let mut path = base_path.to_owned(); - path.push(self.group_path()); + path.push(self.relative_group_path()); proxmox_sys::fs::scandir( libc::AT_FDCWD, @@ -120,7 +120,7 @@ impl BackupGroup { let mut last = None; let mut path = base_path.to_owned(); - path.push(self.group_path()); + path.push(self.relative_group_path()); proxmox_sys::fs::scandir( libc::AT_FDCWD, @@ -283,7 +283,7 @@ impl BackupDir { } pub fn relative_path(&self) -> PathBuf { - let mut relative_path = self.group.group_path(); + let mut relative_path = self.group.relative_group_path(); relative_path.push(self.backup_time_string.clone()); diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index 64f87369..250f8e22 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -341,7 +341,7 @@ impl DataStore { /// Returns the absolute path for a backup_group pub fn group_path(&self, backup_group: &BackupGroup) -> PathBuf { let mut full_path = self.base_path(); - full_path.push(backup_group.group_path()); + full_path.push(backup_group.relative_group_path()); full_path } @@ -424,7 +424,7 @@ impl DataStore { pub fn last_successful_backup(&self, backup_group: &BackupGroup) -> Result, Error> { let base_path = self.base_path(); let mut group_path = base_path.clone(); - group_path.push(backup_group.group_path()); + group_path.push(backup_group.relative_group_path()); if group_path.exists() { backup_group.last_successful_backup(&base_path) @@ -438,7 +438,7 @@ impl DataStore { /// The backup owner is the entity who first created the backup group. pub fn get_owner(&self, backup_group: &BackupGroup) -> Result { let mut full_path = self.base_path(); - full_path.push(backup_group.group_path()); + full_path.push(backup_group.relative_group_path()); full_path.push("owner"); let owner = proxmox_sys::fs::file_read_firstline(full_path)?; owner.trim_end().parse() // remove trailing newline @@ -458,7 +458,7 @@ impl DataStore { force: bool, ) -> Result<(), Error> { let mut path = self.base_path(); - path.push(backup_group.group_path()); + path.push(backup_group.relative_group_path()); path.push("owner"); let mut open_options = std::fs::OpenOptions::new(); diff --git a/proxmox-backup-client/src/main.rs b/proxmox-backup-client/src/main.rs index e4a0969a..47a1f040 100644 --- a/proxmox-backup-client/src/main.rs +++ b/proxmox-backup-client/src/main.rs @@ -156,7 +156,7 @@ pub async fn api_datastore_latest_snapshot( if list.is_empty() { bail!( "backup group {:?} does not contain any snapshots.", - group.group_path() + group.relative_group_path() ); } @@ -263,7 +263,7 @@ async fn list_backup_groups(param: Value) -> Result { let render_group_path = |_v: &Value, record: &Value| -> Result { let item: GroupListItem = serde_json::from_value(record.to_owned())?; let group = BackupGroup::new(item.backup.ty, item.backup.id); - Ok(group.group_path().to_str().unwrap().to_owned()) + Ok(group.relative_group_path().to_str().unwrap().to_owned()) }; let render_last_backup = |_v: &Value, record: &Value| -> Result { diff --git a/src/api2/admin/datastore.rs b/src/api2/admin/datastore.rs index 0a1583be..d753ff4f 100644 --- a/src/api2/admin/datastore.rs +++ b/src/api2/admin/datastore.rs @@ -65,7 +65,7 @@ const GROUP_NOTES_FILE_NAME: &str = "notes"; fn get_group_note_path(store: &DataStore, group: &BackupGroup) -> PathBuf { let mut note_path = store.base_path(); - note_path.push(group.group_path()); + note_path.push(group.relative_group_path()); note_path.push(GROUP_NOTES_FILE_NAME); note_path }