api2/tape: add notify_user to backup(-jobs) and restore api calls
so that a user can be given that will be notified for manual intervention (e.g. inserting a tape) Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
committed by
Dietmar Maurer
parent
be8adca115
commit
c9793d47f9
@ -319,6 +319,7 @@ pub fn request_and_load_media(
|
||||
config: &SectionConfigData,
|
||||
drive: &str,
|
||||
label: &MediaLabel,
|
||||
notify_email: &Option<String>,
|
||||
) -> Result<(
|
||||
Box<dyn TapeDriver>,
|
||||
MediaId,
|
||||
@ -375,9 +376,6 @@ pub fn request_and_load_media(
|
||||
return Ok((handle, media_id));
|
||||
}
|
||||
|
||||
|
||||
let to = "root@localhost"; // fixme
|
||||
|
||||
let mut last_media_uuid = None;
|
||||
let mut last_error = None;
|
||||
|
||||
@ -390,7 +388,9 @@ pub fn request_and_load_media(
|
||||
if tried {
|
||||
if let Some(reason) = failure_reason {
|
||||
task_log!(worker, "Please insert media '{}' into drive '{}'", label_text, drive);
|
||||
send_load_media_email(drive, &label_text, to, Some(reason))?;
|
||||
if let Some(to) = notify_email {
|
||||
send_load_media_email(drive, &label_text, to, Some(reason))?;
|
||||
}
|
||||
}
|
||||
|
||||
failure_reason = None;
|
||||
|
@ -64,11 +64,12 @@ pub struct PoolWriter {
|
||||
drive_name: String,
|
||||
status: Option<PoolWriterState>,
|
||||
media_set_catalog: MediaSetCatalog,
|
||||
notify_email: Option<String>,
|
||||
}
|
||||
|
||||
impl PoolWriter {
|
||||
|
||||
pub fn new(mut pool: MediaPool, drive_name: &str, worker: &WorkerTask) -> Result<Self, Error> {
|
||||
pub fn new(mut pool: MediaPool, drive_name: &str, worker: &WorkerTask, notify_email: Option<String>) -> Result<Self, Error> {
|
||||
|
||||
let current_time = proxmox::tools::time::epoch_i64();
|
||||
|
||||
@ -101,6 +102,7 @@ impl PoolWriter {
|
||||
drive_name: drive_name.to_string(),
|
||||
status: None,
|
||||
media_set_catalog,
|
||||
notify_email,
|
||||
})
|
||||
}
|
||||
|
||||
@ -227,7 +229,7 @@ impl PoolWriter {
|
||||
let (drive_config, _digest) = crate::config::drive::config()?;
|
||||
|
||||
let (mut drive, old_media_id) =
|
||||
request_and_load_media(worker, &drive_config, &self.drive_name, media.label())?;
|
||||
request_and_load_media(worker, &drive_config, &self.drive_name, media.label(), &self.notify_email)?;
|
||||
|
||||
// test for critical tape alert flags
|
||||
if let Ok(alert_flags) = drive.tape_alert_flags() {
|
||||
|
Reference in New Issue
Block a user