Commit 7dcce29d authored by Dietmar Maurer's avatar Dietmar Maurer

allow exclude-path in /etc/vzdump.conf

parent d9a6d2f5
...@@ -71,7 +71,7 @@ __PACKAGE__->register_method ({ ...@@ -71,7 +71,7 @@ __PACKAGE__->register_method ({
# exclude-path list need to be 0 separated # exclude-path list need to be 0 separated
my @expaths = split(/\0/, $param->{'exclude-path'} || ''); my @expaths = split(/\0/, $param->{'exclude-path'} || '');
$param->{'exclude-path'} = @expaths; $param->{'exclude-path'} = [ @expaths ];
my @mailto = PVE::Tools::split_list(extract_param($param, 'mailto')); my @mailto = PVE::Tools::split_list(extract_param($param, 'mailto'));
$param->{mailto} = [ @mailto ]; $param->{mailto} = [ @mailto ];
......
...@@ -212,6 +212,8 @@ sub read_vzdump_defaults { ...@@ -212,6 +212,8 @@ sub read_vzdump_defaults {
$res->{size} = int($1); $res->{size} = int($1);
} elsif ($line =~ m/maxfiles:\s*(\d+)\s*$/) { } elsif ($line =~ m/maxfiles:\s*(\d+)\s*$/) {
$res->{maxfiles} = int($1); $res->{maxfiles} = int($1);
} elsif ($line =~ m/exclude-path:\s*(.*)\s*$/) {
$res->{'exclude-path'} = PVE::Tools::split_args($1);
} elsif ($line =~ m/mode:\s*(stop|snapshot|suspend)\s*$/) { } elsif ($line =~ m/mode:\s*(stop|snapshot|suspend)\s*$/) {
$res->{mode} = $1; $res->{mode} = $1;
} else { } else {
...@@ -455,6 +457,12 @@ sub new { ...@@ -455,6 +457,12 @@ sub new {
$self->find_add_exclude ('-type', 's'); # skip sockets $self->find_add_exclude ('-type', 's'); # skip sockets
if ($defaults->{'exclude-path'}) {
foreach my $path (@{$defaults->{'exclude-path'}}) {
$self->find_add_exclude ('-regex', $path);
}
}
if ($opts->{'exclude-path'}) { if ($opts->{'exclude-path'}) {
foreach my $path (@{$opts->{'exclude-path'}}) { foreach my $path (@{$opts->{'exclude-path'}}) {
$self->find_add_exclude ('-regex', $path); $self->find_add_exclude ('-regex', $path);
...@@ -1172,7 +1180,13 @@ sub command_line { ...@@ -1172,7 +1180,13 @@ sub command_line {
next if $p eq 'id' || $p eq 'vmid' || $p eq 'starttime' || $p eq 'dow'; next if $p eq 'id' || $p eq 'vmid' || $p eq 'starttime' || $p eq 'dow';
my $v = $param->{$p}; my $v = $param->{$p};
my $pd = $confdesc->{$p} || die "no such vzdump option '$p'\n"; my $pd = $confdesc->{$p} || die "no such vzdump option '$p'\n";
$cmd .= " --$p " . PVE::Tools::shellquote($v) if defined($v) && $v ne ''; if ($p eq 'exclude-path') {
foreach my $path (split(/\0/, $v || '')) {
$cmd .= " --$p " . PVE::Tools::shellquote($path);
}
} else {
$cmd .= " --$p " . PVE::Tools::shellquote($v) if defined($v) && $v ne '';
}
} }
return $cmd; return $cmd;
......
...@@ -123,6 +123,7 @@ Global configuration is stored in /etc/vzdump.conf. ...@@ -123,6 +123,7 @@ Global configuration is stored in /etc/vzdump.conf.
size: MB size: MB
maxfiles: N maxfiles: N
script: FILENAME script: FILENAME
exclude-path: PATHLIST
=head1 HOOK SCRIPT =head1 HOOK SCRIPT
......
...@@ -11,3 +11,4 @@ ...@@ -11,3 +11,4 @@
#size: MB #size: MB
#maxfiles: N #maxfiles: N
#script: FILENAME #script: FILENAME
#exclude-path: PATHLIST
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment