mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-04-28 18:50:04 +00:00
file-restore: fallback to mpxar if catalog not present
The `proxmox-file-restore list` command will uses the provided path to lookup and list directory entries via the catalog. Fallback to using the metadata archive if the catalog is not present for fast lookups in a backup snapshot. This is in preparation for dropping encoding of the catalog for snapshots using split archive encoding. Proxmox VE's storage plugin uses this to allow single file restore for LXCs. Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
This commit is contained in:
parent
6cf75f2fe2
commit
84981486cb
@ -147,11 +147,11 @@ async fn list_files(
|
||||
Ok(entries)
|
||||
}
|
||||
ExtractPath::Pxar(file, mut path) => {
|
||||
if let Ok(file_info) = manifest.lookup_file_info(CATALOG_NAME) {
|
||||
let index = client
|
||||
.download_dynamic_index(&manifest, CATALOG_NAME)
|
||||
.await?;
|
||||
let most_used = index.find_most_used_chunks(8);
|
||||
let file_info = manifest.lookup_file_info(CATALOG_NAME)?;
|
||||
let chunk_reader = RemoteChunkReader::new(
|
||||
client.clone(),
|
||||
crypt_config,
|
||||
@ -165,6 +165,45 @@ async fn list_files(
|
||||
fullpath.append(&mut path);
|
||||
|
||||
catalog_reader.list_dir_contents(&fullpath)
|
||||
} else {
|
||||
if path.is_empty() {
|
||||
path = vec![b'/'];
|
||||
}
|
||||
|
||||
let (archive_name, payload_archive_name) =
|
||||
pbs_client::tools::get_pxar_archive_names(&file, &manifest)?;
|
||||
|
||||
let (reader, archive_size) = get_remote_pxar_reader(
|
||||
&archive_name,
|
||||
client.clone(),
|
||||
&manifest,
|
||||
crypt_config.clone(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let reader = if let Some(payload_archive_name) = payload_archive_name {
|
||||
let (payload_reader, payload_size) = get_remote_pxar_reader(
|
||||
&payload_archive_name,
|
||||
client,
|
||||
&manifest,
|
||||
crypt_config,
|
||||
)
|
||||
.await?;
|
||||
pxar::PxarVariant::Split(reader, (payload_reader, payload_size))
|
||||
} else {
|
||||
pxar::PxarVariant::Unified(reader)
|
||||
};
|
||||
|
||||
let accessor = Accessor::new(reader, archive_size).await?;
|
||||
let path = OsStr::from_bytes(&path);
|
||||
|
||||
pbs_client::tools::pxar_metadata_catalog_lookup(
|
||||
accessor,
|
||||
&path,
|
||||
Some(&archive_name),
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
ExtractPath::VM(file, path) => {
|
||||
let details = SnapRestoreDetails {
|
||||
|
Loading…
Reference in New Issue
Block a user