From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@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 EC2586AA5E
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:11:18 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id E65C22F989
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:11:18 +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 6C0272F97E
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:11:18 +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 419BC46E95
 for <pve-devel@lists.proxmox.com>; Thu, 17 Mar 2022 09:11:18 +0100 (CET)
Message-ID: <c097b9a0-2a59-ec6f-ab86-32a929d015fc@proxmox.com>
Date: Thu, 17 Mar 2022 09:11:17 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101
 Thunderbird/99.0
Content-Language: en-US
To: Fabian Ebner <f.ebner@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>
 <a9b28972-3440-96c1-6f2c-38cf5e624d02@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <a9b28972-3440-96c1-6f2c-38cf5e624d02@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.057 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:11:19 -0000

On 17.03.22 09:03, Fabian Ebner wrote:
> 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

sure, but actually avoids bothering with that setting in the first place for most
simple setups, so could be a net benefit.

> 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.

hmm, yeah.. iff, it should probably happen in a separate get_protected_limit($scfg)
helper and we get the rpcenv singleton in other, rather deep, code paths too, so
not a big issue IMO, but not to hard feelings here.