[pve-devel] [PATCH storage 2/2] plugins: allow limiting the number of protected backups per guest

Thomas Lamprecht t.lamprecht at proxmox.com
Thu Mar 17 09:11:17 CET 2022


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.





More information about the pve-devel mailing list