public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager] restore default value of 0 for remove/maxfiles
@ 2020-11-05 15:21 Stefan Reiter
  2020-11-06  8:44 ` Fabian Ebner
  2020-11-06  8:46 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Reiter @ 2020-11-05 15:21 UTC (permalink / raw)
  To: pve-devel

If neither the 'remove' option of vzdump nor the 'maxfiles' option in
the storage config are set, assume a value of 0, i.e. do not delete
anything and allow unlimited backups.

Restores previous behaviour that was broken in 7ab7d6f15f.

Also fixes a warning about using '== 0' on a non-number type.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
---
 PVE/VZDump.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 6873ceaf..517becb1 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -474,7 +474,7 @@ sub new {
 
 	    if (!defined($opts->{'prune-backups'}) && !defined($opts->{maxfiles})) {
 		$opts->{'prune-backups'} = $info->{'prune-backups'};
-		$opts->{maxfiles} = $info->{maxfiles};
+		$opts->{maxfiles} = $info->{maxfiles} // 0;
 		if ($opts->{maxfiles} == 0) {
 		    # zero means keep all, so avoid triggering any remove code path to be safe
 		    $opts->{remove} = 0;
-- 
2.20.1





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH manager] restore default value of 0 for remove/maxfiles
  2020-11-05 15:21 [pve-devel] [PATCH manager] restore default value of 0 for remove/maxfiles Stefan Reiter
@ 2020-11-06  8:44 ` Fabian Ebner
  2020-11-06  8:46 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Ebner @ 2020-11-06  8:44 UTC (permalink / raw)
  To: pve-devel

AFAICT the previous behavior is maxfiles = 1 when it's not set anywhere. 
That's the default value in the VZDump schema.

And that should happen a bit below in the code:
     if (!defined($opts->{'prune-backups'})) {
         my $maxfiles = delete $opts->{maxfiles} // $defaults->{maxfiles};
         $opts->{'prune-backups'} = { 'keep-last' => $maxfiles } if 
$maxfiles;

Or is there some weird perl behavior that makes this not work?

Am 05.11.20 um 16:21 schrieb Stefan Reiter:
> If neither the 'remove' option of vzdump nor the 'maxfiles' option in
> the storage config are set, assume a value of 0, i.e. do not delete
> anything and allow unlimited backups.
> 
> Restores previous behaviour that was broken in 7ab7d6f15f.
> 
> Also fixes a warning about using '== 0' on a non-number type.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>   PVE/VZDump.pm | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
> index 6873ceaf..517becb1 100644
> --- a/PVE/VZDump.pm
> +++ b/PVE/VZDump.pm
> @@ -474,7 +474,7 @@ sub new {
>   
>   	    if (!defined($opts->{'prune-backups'}) && !defined($opts->{maxfiles})) {
>   		$opts->{'prune-backups'} = $info->{'prune-backups'};
> -		$opts->{maxfiles} = $info->{maxfiles};
> +		$opts->{maxfiles} = $info->{maxfiles} // 0;
>   		if ($opts->{maxfiles} == 0) {
Wouldn't adding a definedness check here be sufficient?

>   		    # zero means keep all, so avoid triggering any remove code path to be safe
>   		    $opts->{remove} = 0;
> 




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] applied: [PATCH manager] restore default value of 0 for remove/maxfiles
  2020-11-05 15:21 [pve-devel] [PATCH manager] restore default value of 0 for remove/maxfiles Stefan Reiter
  2020-11-06  8:44 ` Fabian Ebner
@ 2020-11-06  8:46 ` Thomas Lamprecht
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Lamprecht @ 2020-11-06  8:46 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Reiter

On 05.11.20 16:21, Stefan Reiter wrote:
> If neither the 'remove' option of vzdump nor the 'maxfiles' option in
> the storage config are set, assume a value of 0, i.e. do not delete
> anything and allow unlimited backups.
> 
> Restores previous behaviour that was broken in 7ab7d6f15f.
> 
> Also fixes a warning about using '== 0' on a non-number type.
> 
> Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
> ---
>  PVE/VZDump.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-06  8:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05 15:21 [pve-devel] [PATCH manager] restore default value of 0 for remove/maxfiles Stefan Reiter
2020-11-06  8:44 ` Fabian Ebner
2020-11-06  8:46 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal