tape: fix snapshot path in catalog and snapshot_archive

both used the 'Display' trait of pbs_datastore::BackupDir, which is not
intended to be serialized anywhere. Instead, manually format the path
using the print_ns_and_snapshot helper, and conversely, parse with
'parse_ns_and_snapshot'. to be a bit safer, change the register_snapshot
signature to take a BackupNamespace and BackupDir instead of a string.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak
2022-05-10 16:09:42 +02:00
parent 1e4e1514d3
commit 9c65e6ab4a
6 changed files with 27 additions and 31 deletions

View File

@ -438,7 +438,7 @@ pub fn list_content(
.unwrap_or_else(|_| set.uuid.to_string());
for (store, snapshot) in media_catalog_snapshot_list(status_path, &media_id)? {
let backup_dir: pbs_api_types::BackupDir = snapshot.parse()?;
let (_, backup_dir) = pbs_api_types::parse_ns_and_snapshot(&snapshot)?;
if let Some(backup_type) = filter.backup_type {
if backup_dir.ty() != backup_type {

View File

@ -1084,7 +1084,8 @@ fn restore_archive<'a>(
Uuid::from(header.uuid),
current_file_number,
&datastore_name,
&snapshot,
&backup_ns,
&backup_dir,
)?;
catalog.commit_if_large()?;
}
@ -1102,7 +1103,8 @@ fn restore_archive<'a>(
Uuid::from(header.uuid),
current_file_number,
&datastore_name,
&snapshot,
&backup_ns,
&backup_dir,
)?;
catalog.commit_if_large()?;
}