[pve-devel] [PATCH v2 manager 10/13] Simplify how maxfiles is determined

Fabian Ebner f.ebner at proxmox.com
Wed Jun 10 13:24:01 CEST 2020


No functional change is intended.
The preference order is: option, then storage config, then vzdump defaults.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v2
IMHO the old method was very confusing.

 PVE/VZDump.pm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 12c02a2a..6d68ac34 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 {
-- 
2.20.1





More information about the pve-devel mailing list