From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <l.wagner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 1903096489
 for <pbs-devel@lists.proxmox.com>; Mon, 15 Apr 2024 16:10:11 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id EEBDBB4CA
 for <pbs-devel@lists.proxmox.com>; Mon, 15 Apr 2024 16:10:10 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [94.136.29.106])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS
 for <pbs-devel@lists.proxmox.com>; Mon, 15 Apr 2024 16:10:08 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 043B444A27
 for <pbs-devel@lists.proxmox.com>; Mon, 15 Apr 2024 16:10:08 +0200 (CEST)
Message-ID: <6d58c2b1-cc6a-4ebe-bbc6-956ce13f2695@proxmox.com>
Date: Mon, 15 Apr 2024 16:10:07 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
To: Proxmox Backup Server development discussion
 <pbs-devel@lists.proxmox.com>, Gabriel Goller <g.goller@proxmox.com>
References: <20240412100631.94218-1-l.wagner@proxmox.com>
 <20240412100631.94218-15-l.wagner@proxmox.com>
 <D0KLIW8P2XF2.TF2NVU31XHUV@proxmox.com>
Content-Language: de-AT, en-US
From: Lukas Wagner <l.wagner@proxmox.com>
In-Reply-To: <D0KLIW8P2XF2.TF2NVU31XHUV@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL -0.004 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DMARC_MISSING             0.1 Missing DMARC policy
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
Subject: Re: [pbs-devel] [PATCH proxmox-backup 14/33] server: notifications:
 send GC notifications via notification system
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Mon, 15 Apr 2024 14:10:11 -0000



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