]> git.proxmox.com Git - pve-manager.git/commitdiff
Simplify how maxfiles is determined
authorFabian Ebner <f.ebner@proxmox.com>
Tue, 30 Jun 2020 08:24:26 +0000 (10:24 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 30 Jun 2020 11:55:11 +0000 (13:55 +0200)
No functional change is intended.
The preference order is: option, then storage config, then vzdump defaults.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
PVE/VZDump.pm

index 9bdb5ab030482d0e712e870eba10b315c7c6261d..b1107eac16e768cd9513a36c7ba043cf67b19003 100644 (file)
@@ -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 {