[SOLVED] VZdump and the infinite exclude-path error

diaolin

Renowned Member
Jul 7, 2008
341
8
83
Trentino Italy
Found the bug, i hope that Dietmar will be so kind to include the solution.

/usr/share/perl5/PVE/API2/VZDump.pm

This code says that the exclude-path is ALWAYS read from command-line
and despite each line in /etc/vzdump.conf will be skipped

Code:
# exclude-path list need to be 0 separated
my @expaths = split(/\0/, $param->{'exclude-path'} || '');
$param->{'exclude-path'} = [ @expaths ];

the solution?
this one:

Code:
# exclude-path list need to be 0 separated
if (exists($param->{'exclude-path'})) {
    my @expaths = split(/\0/, $param->{'exclude-path'} || '');
    $param->{'exclude-path'} = [ @expaths ];
}

when the cmdline does not contain exclude-path the conf will be read

of course even the other parameters should be verified...
for example mailto and so on

/etc/vzdump.conf

exclude-path: /usr/.+ /sbin/.+ /var/.+

And now it works


Diaolin


(Here the solution for 1.* versions)

/usr/share/perl5/PVE/VZDump.pm

Change:

Code:
foreach my $k (keys %$defaults) {
if ($k eq 'dumpdir' || $k eq 'storage') {
               $opts->{$k} = $defaults->{$k} if !defined ($opts->{dumpdir}) &&
                !defined ($opts->{storage});
    } else {
              $opts->{$k} = $defaults->{$k} if !defined ($opts->{$k});
   }
}


in

Code:
foreach my $k (keys %$defaults) {
     if ($k eq 'dumpdir' || $k eq 'storage') {
            $opts->{$k} = $defaults->{$k} if !defined ($opts->{dumpdir}) &&
                !defined ($opts->{storage});
        } else {
      if (!defined ($opts->{$k}) or !$opts->{$k}) { $opts->{$k} = $defaults->{$k}; }
        }
 }
 
Last edited:
pay attention, we did a fix to the problem of exclude-path but there are many others
just follow the solution.

The idea behind your code is ok but it states that if you find a single parameter on cmdline
all parameters are overwritten, with my little hint this happens only for the passed param.

Diaolin