vzdump exclude-path not working from vzdump.conf

Mar 2, 2016
21
3
23
46
Hi, I have a bunch of exclude patterns in my vzdump.conf which look like this:
Code:
exclude-path: "/dir1/.+" "/dir2/.+"
invoking vzdump on the command line (or the web interface)
Code:
vzdump 100

...gives this error:
Code:
Can't use string (""/dir1/.+" "/dir2/.+"") as an ARRAY ref while "strict refs" in use at /usr/share/perl5/PVE/VZDump.pm line 581. (500)

I've tried 10 different ways to write the "exclude-path:" assignment with no success (single quotes, making lists (a,b,c), or with square brackets, etc.). I'm no perl expert so I was just fooling around. Maybe someone knows how to get this write?

Even this in vzdump.conf doesn't work:
Code:
exclude-path: '/dir1/.+'
or this:
Code:
exclude-path: /dir1/.+

Basically, the config file is useless for exclude-path! When we figure this out, the wiki should be updated since the syntax doesn't work. I'd be happy to test out a patch to the perl code.
 
I've posted at pve-devel mailing list an hour or so ago... here's my current "patch" which seems to work well right now:

Code:
---
 VZDump.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/VZDump.pm b/VZDump.pm
index 54cea9c..0a3a2b3 100644
--- a/VZDump.pm
+++ b/VZDump.pm
@@ -577,12 +577,12 @@ sub new {
     my $self = bless { cmdline => $cmdline, opts => $opts, skiplist => $skiplist };

     my $findexcl = $self->{findexcl} = [];
-    if ($defaults->{'exclude-path'}) {
-    push @$findexcl, @{$defaults->{'exclude-path'}};
-    }

     if ($opts->{'exclude-path'}) {
-    push @$findexcl, @{$opts->{'exclude-path'}};
+    print "opt->exclude-path:", $opts->{'exclude-path'}, "\n";
+    my @pathlist = split(' ', $defaults->{'exclude-path'});
+    push @$findexcl, @pathlist;
+    }
     }

     if ($opts->{stdexcludes}) {
-- 


---
 VZDump.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/VZDump.pm b/VZDump.pm
index 0a3a2b3..4c56b1c 100644
--- a/VZDump.pm
+++ b/VZDump.pm
@@ -583,6 +583,9 @@ sub new {
    my @pathlist = split(' ', $defaults->{'exclude-path'});
    push @$findexcl, @pathlist;
     }
+
+    if (! defined $opts->{stdexcludes}) {
+    $opts->{stdexcludes} = $confdesc->{stdexcludes}->{default};
     }

     if ($opts->{stdexcludes}) {
--
 
Also, don't forget to test your excludes. For example, another thing that didn't work for me was the '/dir/.+' notation, instead, I had to use '/dir1/*'
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!