tape: do not abort backup if tape drive does not support tape-alert-flags

This commit is contained in:
Dietmar Maurer 2021-01-15 11:43:17 +01:00
parent 4cfb123448
commit a08a198577
2 changed files with 34 additions and 31 deletions

View File

@ -70,6 +70,7 @@ impl LinuxTapeDrive {
/// - for autoloader only, try to reload ejected tapes /// - for autoloader only, try to reload ejected tapes
pub fn open(&self) -> Result<LinuxTapeHandle, Error> { pub fn open(&self) -> Result<LinuxTapeHandle, Error> {
proxmox::try_block!({
let file = open_linux_tape_device(&self.path)?; let file = open_linux_tape_device(&self.path)?;
let mut handle = LinuxTapeHandle::new(file); let mut handle = LinuxTapeHandle::new(file);
@ -106,6 +107,7 @@ impl LinuxTapeDrive {
// handle.set_default_options()?; // handle.set_default_options()?;
Ok(handle) Ok(handle)
}).map_err(|err| format_err!("open drive '{}' ({}) failed - {}", self.name, self.path, err))
} }
} }

View File

@ -214,13 +214,14 @@ impl PoolWriter {
request_and_load_media(worker, &drive_config, &self.drive_name, media.label())?; request_and_load_media(worker, &drive_config, &self.drive_name, media.label())?;
// test for critical tape alert flags // test for critical tape alert flags
let alert_flags = drive.tape_alert_flags()?; if let Ok(alert_flags) = drive.tape_alert_flags() {
if !alert_flags.is_empty() { if !alert_flags.is_empty() {
worker.log(format!("TapeAlertFlags: {:?}", alert_flags)); worker.log(format!("TapeAlertFlags: {:?}", alert_flags));
if tape_alert_flags_critical(alert_flags) { if tape_alert_flags_critical(alert_flags) {
bail!("aborting due to critical tape alert flags: {:?}", alert_flags); bail!("aborting due to critical tape alert flags: {:?}", alert_flags);
} }
} }
}
let catalog = update_media_set_label( let catalog = update_media_set_label(
worker, worker,