finish_backup: test/verify manifest at server side

We want to make sure that the client uploaded a readable manifest.
This commit is contained in:
Dietmar Maurer 2020-07-30 12:19:22 +02:00
parent e443902583
commit 9fa55e09a7

View File

@ -1,4 +1,4 @@
use anyhow::{bail, Error}; use anyhow::{bail, format_err, Error};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
@ -454,6 +454,13 @@ impl BackupEnvironment {
bail!("backup does not contain valid files (file count == 0)"); bail!("backup does not contain valid files (file count == 0)");
} }
state.finished = true;
// check manifest
let _manifest = self.datastore.load_manifest(&self.backup_dir)
.map_err(|err| format_err!("unable to load manifest blob - {}", err))?;
for snap in &state.base_snapshots { for snap in &state.base_snapshots {
let path = self.datastore.snapshot_path(snap); let path = self.datastore.snapshot_path(snap);
if !path.exists() { if !path.exists() {
@ -464,7 +471,6 @@ impl BackupEnvironment {
} }
} }
state.finished = true;
Ok(()) Ok(())
} }