mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-12 09:50:14 +00:00
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.
This commit is contained in:
parent
7849cf8c58
commit
45f16a06e5
@ -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) {
|
||||
|
2
debian/changelog.Debian
vendored
2
debian/changelog.Debian
vendored
@ -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 <support@proxmox.com> Wed, 16 Sep 2015 11:05:49 +0200
|
||||
|
||||
pve-manager (4.0-37) unstable; urgency=medium
|
||||
|
Loading…
Reference in New Issue
Block a user