From 45f16a06e58a8b44eb725a4e88ee66ce7675c532 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 3 Sep 2015 15:46:24 +0200 Subject: [PATCH] vzdump: replace 'find' exclude command switches We're replacing the use of 'find' in the backup code for various reasons, so we cannot use find-specific options anymore. Besides, it's up to the plugin to create the archive and there's no guarantee using 'find' even makes sense. Even in the current code it's not being used when hitting the rsync case anyway. Now using simple glob patterns as that is more widely supported. --- PVE/VZDump.pm | 39 ++++++++------------------------------- debian/changelog.Debian | 2 ++ 2 files changed, 10 insertions(+), 31 deletions(-) diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm index b763fbae..dd7a7e9e 100644 --- a/PVE/VZDump.pm +++ b/PVE/VZDump.pm @@ -85,7 +85,7 @@ my $confdesc = { }, 'exclude-path' => { type => 'string', format => 'string-alist', - description => "exclude certain files/directories (regex).", + description => "exclude certain files/directories (shell globs).", optional => 1, }, mailto => { @@ -350,21 +350,6 @@ sub read_vzdump_defaults { return $res; } - -sub find_add_exclude { - my ($self, $excltype, $value) = @_; - - if (($excltype eq '-regex') || ($excltype eq '-files')) { - $value = "\.$value"; - } - - if ($excltype eq '-files') { - push @{$self->{findexcl}}, "'('", '-not', '-type', 'd', '-regex' , "'$value'", "')'", '-o'; - } else { - push @{$self->{findexcl}}, "'('", $excltype , "'$value'", '-prune', "')'", '-o'; - } -} - sub sendmail { my ($self, $tasklist, $totaltime, $err) = @_; @@ -589,28 +574,20 @@ sub new { $skiplist = [] if !$skiplist; my $self = bless { cmdline => $cmdline, opts => $opts, skiplist => $skiplist }; - #always skip '.' - push @{$self->{findexcl}}, "'('", '-regex' , "'^\\.\$'", "')'", '-o'; - - $self->find_add_exclude ('-type', 's'); # skip sockets - + my $findexcl = $self->{findexcl} = []; if ($defaults->{'exclude-path'}) { - foreach my $path (@{$defaults->{'exclude-path'}}) { - $self->find_add_exclude ('-regex', $path); - } + push @$findexcl, @{$defaults->{'exclude-path'}}; } if ($opts->{'exclude-path'}) { - foreach my $path (@{$opts->{'exclude-path'}}) { - $self->find_add_exclude ('-regex', $path); - } + push @$findexcl, @{$opts->{'exclude-path'}}; } if ($opts->{stdexcludes}) { - $self->find_add_exclude ('-files', '/var/log/.+'); - $self->find_add_exclude ('-regex', '/tmp/.+'); - $self->find_add_exclude ('-regex', '/var/tmp/.+'); - $self->find_add_exclude ('-regex', '/var/run/.+pid'); + push @$findexcl, '/var/log/?*', + '/tmp/?*', + '/var/tmp/?*', + '/var/run/?*'; } foreach my $p (@plugins) { diff --git a/debian/changelog.Debian b/debian/changelog.Debian index 8b0ef09b..db469e84 100644 --- a/debian/changelog.Debian +++ b/debian/changelog.Debian @@ -4,6 +4,8 @@ pve-manager (4.0-38) unstable; urgency=medium * bridgevlan : allow filtering on tagged interfaces (for QinQ) + * vzdump: replace 'find' exclude command switches + -- Proxmox Support Team Wed, 16 Sep 2015 11:05:49 +0200 pve-manager (4.0-37) unstable; urgency=medium