expose previous backup time in backup env

and use this information to add more information to client backup log
and guide the download manifest decision.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
This commit is contained in:
Fabian Grünbichler
2020-11-20 17:38:40 +01:00
committed by Dietmar Maurer
parent 866c859a1e
commit 8b7f8d3f3d
3 changed files with 68 additions and 16 deletions

View File

@ -1099,23 +1099,42 @@ async fn create_backup(
false
).await?;
let previous_manifest = match client.download_previous_manifest().await {
Ok(previous_manifest) => {
match previous_manifest.check_fingerprint(crypt_config.as_ref().map(Arc::as_ref)) {
Ok(()) => {
println!("Successfully downloaded previous manifest.");
Some(Arc::new(previous_manifest))
},
Err(err) => {
println!("Couldn't re-use pevious manifest - {}", err);
None
},
let download_previous_manifest = match client.previous_backup_time().await {
Ok(Some(backup_time)) => {
println!(
"Downloading previous manifest ({})",
strftime_local("%c", backup_time)?
);
true
}
Ok(None) => {
println!("No previous manifest available.");
false
}
Err(_) => {
// Fallback for outdated server, TODO remove/bubble up with 2.0
true
}
};
let previous_manifest = if download_previous_manifest {
match client.download_previous_manifest().await {
Ok(previous_manifest) => {
match previous_manifest.check_fingerprint(crypt_config.as_ref().map(Arc::as_ref)) {
Ok(()) => Some(Arc::new(previous_manifest)),
Err(err) => {
println!("Couldn't re-use previous manifest - {}", err);
None
}
}
}
},
Err(err) => {
println!("Couldn't download pevious manifest - {}", err);
None
},
Err(err) => {
println!("Couldn't download previous manifest - {}", err);
None
}
}
} else {
None
};
let snapshot = BackupDir::new(backup_type, backup_id, backup_time)?;