[pbs-devel] [PATCH proxmox-backup 14/33] server: notifications: send GC notifications via notification system

Lukas Wagner l.wagner at proxmox.com
Mon Apr 15 16:10:07 CEST 2024



On  2024-04-15 11:41, Gabriel Goller wrote:
> On Fri Apr 12, 2024 at 12:06 PM CEST, Lukas Wagner wrote:
>> diff --git a/src/server/gc_job.rs b/src/server/gc_job.rs
>> index 41375d72..ff5bdccf 100644
>> --- a/src/server/gc_job.rs
>> +++ b/src/server/gc_job.rs
>> @@ -19,8 +19,6 @@ pub fn do_garbage_collection_job(
>>  ) -> Result<String, Error> {
>>      let store = datastore.name().to_string();
>>  
>> -    let (email, notify) = crate::server::lookup_datastore_notify_settings(&store);
>> -
>>      let worker_type = job.jobtype().to_string();
>>      let upid_str = WorkerTask::new_thread(
>>          &worker_type,
>> @@ -43,11 +41,9 @@ pub fn do_garbage_collection_job(
>>                  eprintln!("could not finish job state for {}: {err}", job.jobtype());
>>              }
>>  
>> -            if let Some(email) = email {
>> -                let gc_status = datastore.last_gc_status();
>> -                if let Err(err) = send_gc_status(&email, notify, &store, &gc_status, &result) {
>> -                    eprintln!("send gc notification failed: {err}");
>> -                }
>> +            let gc_status = datastore.last_gc_status();
>> +            if let Err(err) = send_gc_status(&store, &gc_status, &result) {
>> +                eprintln!("send gc notification failed: {err}");
>>              }
> 
> When a gc-job returns warnings (for example chunks missing), the
> notification does not include them and simply returns a success.
> Including the warnings would be great, but is a little bit problematic:
>  - how do we get them? the TaskStatus only stores a counter for warnings
>    and would somehow need to store them or search through the tasklog.
>  - do we add another template for `warning`? the severity `warning` is 
>    also kinda useless right now.
> 

I agree, this would indeed be quite useful. I'll note that down for the future.
As of now I do not want to add new notifications or modify existing ones in
order to avoid scope creep.

-- 
- Lukas




More information about the pbs-devel mailing list