]> git.proxmox.com Git - pve-manager.git/commitdiff
vzdump: replace 'find' exclude command switches
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Thu, 3 Sep 2015 13:46:24 +0000 (15:46 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 16 Sep 2015 09:45:15 +0000 (11:45 +0200)
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
debian/changelog.Debian

index b763fbae26390b0e82d4e6f4755bf774bc4cbc30..dd7a7e9e9270fd810846c16a20723d066c773ebc 100644 (file)
@@ -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) {
index 8b0ef09b2fcc55c9fa5506f2bd9ad8cf3bb3507b..db469e84467e9a7816da21cc89d4bc2fe30d9855 100644 (file)
@@ -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