From 5b6b72e6ee4dba7b1b4e75d218bc27e0fd1ce647 Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Tue, 30 Jun 2020 10:24:26 +0200 Subject: [PATCH] Simplify how maxfiles is determined No functional change is intended. The preference order is: option, then storage config, then vzdump defaults. Signed-off-by: Fabian Ebner --- PVE/VZDump.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index 9bdb5ab0..b1107eac 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -405,12 +405,10 @@ sub new { my $defaults = read_vzdump_defaults(); - my $maxfiles = $opts->{maxfiles}; # save here, because we overwrite with default - $opts->{remove} = 1 if !defined($opts->{remove}); foreach my $k (keys %$defaults) { - next if $k eq 'exclude-path'; # dealt with separately + next if $k eq 'exclude-path' || $k eq 'maxfiles'; # dealt with separately if ($k eq 'dumpdir' || $k eq 'storage') { $opts->{$k} = $defaults->{$k} if !defined ($opts->{dumpdir}) && !defined ($opts->{storage}); @@ -466,7 +464,7 @@ sub new { $opts->{dumpdir} = $info->{dumpdir}; $opts->{scfg} = $info->{scfg}; $opts->{pbs} = $info->{pbs}; - $maxfiles //= $info->{maxfiles}; + $opts->{maxfiles} //= $info->{maxfiles}; } elsif ($opts->{dumpdir}) { $errors .= "dumpdir '$opts->{dumpdir}' does not exist" if ! -d $opts->{dumpdir}; @@ -474,6 +472,8 @@ sub new { die "internal error"; } + $opts->{maxfiles} //= $defaults->{maxfiles}; + if ($opts->{tmpdir} && ! -d $opts->{tmpdir}) { $errors .= "\n" if $errors; $errors .= "tmpdir '$opts->{tmpdir}' does not exist"; @@ -485,10 +485,7 @@ sub new { die "$errors\n"; } - $opts->{maxfiles} = $maxfiles if defined($maxfiles); - return $self; - } sub get_mount_info {