From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@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 DA8F16AAB9
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:03:59 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id D18FA2F84B
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:03:59 +0100 (CET)
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 id 5A7D92F83F
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:03:59 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2C8AB426FD
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:03:59 +0100 (CET)
Message-ID: <a9b28972-3440-96c1-6f2c-38cf5e624d02@proxmox.com>
Date: Thu, 17 Mar 2022 09:03:58 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
 Thunderbird/91.6.2
Content-Language: en-US
To: Thomas Lamprecht <t.lamprecht@proxmox.com>,
 Proxmox VE development discussion <pve-devel@lists.proxmox.com>
References: <20211216121233.162288-1-f.ebner@proxmox.com>
 <20211216121233.162288-3-f.ebner@proxmox.com>
 <0df19ffc-a685-1605-89ea-2f288aba26da@proxmox.com>
From: Fabian Ebner <f.ebner@proxmox.com>
In-Reply-To: <0df19ffc-a685-1605-89ea-2f288aba26da@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.122 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.001 Looks like a legit reply (A)
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 T_SCC_BODY_TEXT_LINE    -0.01 -
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [storage.pm]
Subject: Re: [pve-devel] [PATCH storage 2/2] plugins: allow limiting the
 number of protected backups per guest
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Thu, 17 Mar 2022 08:03:59 -0000

Am 16.03.22 um 17:42 schrieb Thomas Lamprecht:
> On 16.12.21 13:12, Fabian Ebner wrote:
>> diff --git a/PVE/Storage.pm b/PVE/Storage.pm
>> index d64019f..0643fad 100755
>> --- a/PVE/Storage.pm
>> +++ b/PVE/Storage.pm
>> @@ -232,6 +232,30 @@ sub update_volume_attribute {
>>      my $scfg = storage_config($cfg, $storeid);
>>      my $plugin = PVE::Storage::Plugin->lookup($scfg->{type});
>>  
>> +    my ($vtype, undef, $vmid) = $plugin->parse_volname($volname);
>> +    my $max_protected_backups = $scfg->{'max-protected-backups'} // 5;
> 
> maybe the default limit should be user privilege dependent? E.g., for root and users
> with .Allocate on the storage it wouldn't be a problem to have unlimited (or a higher
> count) as default? I mean, it's naturally a bit odd to differ, but one can argue a lot
> with auto-magic-convenience ;P
> 

Would add another dimension to the complexity ;) Also feels a bit
awkward code-wise at a first glance, as we'd need to get the rpcenv/user
in such a sub (or pass the user or pre-computed default in somehow). But
if you really want to, I can give it a go for v2.