api2/tape/restore: restore_chunk_archive: only ignore tape related errors
when we get an error from the tape, we possibly want to ignore it, i.e. when the file was incomplete, but we still want to error out if the error came from e.g, the datastore, so we have to move the error checking code to the 'next_chunk' call Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
6dde015f8c
commit
1dd1c9eb5c
@ -597,8 +597,28 @@ fn restore_chunk_archive<'a>(
|
|||||||
|
|
||||||
let mut decoder = ChunkArchiveDecoder::new(reader);
|
let mut decoder = ChunkArchiveDecoder::new(reader);
|
||||||
|
|
||||||
let result: Result<_, Error> = proxmox::try_block!({
|
loop {
|
||||||
while let Some((digest, blob)) = decoder.next_chunk()? {
|
let (digest, blob) = match decoder.next_chunk() {
|
||||||
|
Ok(Some((digest, blob))) => (digest, blob),
|
||||||
|
Ok(None) => break,
|
||||||
|
Err(err) => {
|
||||||
|
let reader = decoder.reader();
|
||||||
|
|
||||||
|
// check if this stream is marked incomplete
|
||||||
|
if let Ok(true) = reader.is_incomplete() {
|
||||||
|
return Ok(Some(chunks));
|
||||||
|
}
|
||||||
|
|
||||||
|
// check if this is an aborted stream without end marker
|
||||||
|
if let Ok(false) = reader.has_end_marker() {
|
||||||
|
worker.log("missing stream end marker".to_string());
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
|
||||||
|
// else the archive is corrupt
|
||||||
|
return Err(err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
worker.check_abort()?;
|
worker.check_abort()?;
|
||||||
|
|
||||||
@ -622,29 +642,8 @@ fn restore_chunk_archive<'a>(
|
|||||||
}
|
}
|
||||||
chunks.push(digest);
|
chunks.push(digest);
|
||||||
}
|
}
|
||||||
Ok(())
|
|
||||||
});
|
|
||||||
|
|
||||||
match result {
|
Ok(Some(chunks))
|
||||||
Ok(()) => Ok(Some(chunks)),
|
|
||||||
Err(err) => {
|
|
||||||
let reader = decoder.reader();
|
|
||||||
|
|
||||||
// check if this stream is marked incomplete
|
|
||||||
if let Ok(true) = reader.is_incomplete() {
|
|
||||||
return Ok(Some(chunks));
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if this is an aborted stream without end marker
|
|
||||||
if let Ok(false) = reader.has_end_marker() {
|
|
||||||
worker.log("missing stream end marker".to_string());
|
|
||||||
return Ok(None);
|
|
||||||
}
|
|
||||||
|
|
||||||
// else the archive is corrupt
|
|
||||||
Err(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn restore_snapshot_archive<'a>(
|
fn restore_snapshot_archive<'a>(
|
||||||
|
Loading…
Reference in New Issue
Block a user