tape: also abort backup/restore on server shutdown
This commit is contained in:
parent
d64226efee
commit
9bd81bb384
|
@ -366,6 +366,7 @@ pub fn backup_snapshot(
|
|||
|
||||
loop {
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
// test is we have remaining chunks
|
||||
if chunk_iter.peek().is_none() {
|
||||
|
@ -375,6 +376,7 @@ pub fn backup_snapshot(
|
|||
let uuid = pool_writer.load_writable_media(worker)?;
|
||||
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
let (leom, _bytes) = pool_writer.append_chunk_archive(worker, &datastore, &mut chunk_iter)?;
|
||||
|
||||
|
@ -384,10 +386,12 @@ pub fn backup_snapshot(
|
|||
}
|
||||
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
let uuid = pool_writer.load_writable_media(worker)?;
|
||||
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
let (done, _bytes) = pool_writer.append_snapshot_archive(worker, &snapshot_reader)?;
|
||||
|
||||
|
@ -396,6 +400,7 @@ pub fn backup_snapshot(
|
|||
pool_writer.set_media_status_full(&uuid)?;
|
||||
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
pool_writer.load_writable_media(worker)?;
|
||||
let (done, _bytes) = pool_writer.append_snapshot_archive(worker, &snapshot_reader)?;
|
||||
|
|
|
@ -378,6 +378,7 @@ fn restore_chunk_archive<'a>(
|
|||
while let Some((digest, blob)) = decoder.next_chunk()? {
|
||||
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
if let Some(datastore) = datastore {
|
||||
let chunk_exists = datastore.cond_touch_chunk(&digest, false)?;
|
||||
|
@ -477,6 +478,7 @@ fn try_restore_snapshot_archive<R: pxar::decoder::SeqRead>(
|
|||
|
||||
loop {
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
let entry = match decoder.next() {
|
||||
None => break,
|
||||
|
|
|
@ -386,6 +386,7 @@ pub fn request_and_load_media(
|
|||
|
||||
loop {
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
|
||||
let mut handle = match drive_config.open() {
|
||||
Ok(handle) => handle,
|
||||
|
@ -397,6 +398,7 @@ pub fn request_and_load_media(
|
|||
}
|
||||
for _ in 0..50 { // delay 5 seconds
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
}
|
||||
continue;
|
||||
|
@ -441,6 +443,7 @@ pub fn request_and_load_media(
|
|||
// eprintln!("read label failed - test again in 5 secs");
|
||||
for _ in 0..50 { // delay 5 seconds
|
||||
worker.check_abort()?;
|
||||
crate::tools::fail_on_shutdown()?;
|
||||
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue