]> git.proxmox.com Git - pve-manager.git/commitdiff
allow exclude-path in /etc/vzdump.conf
authorDietmar Maurer <dietmar@proxmox.com>
Mon, 28 Nov 2011 07:14:58 +0000 (08:14 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Mon, 28 Nov 2011 07:14:58 +0000 (08:14 +0100)
PVE/API2/VZDump.pm
PVE/VZDump.pm
bin/vzdump
vzdump.conf

index 3eda4470b59be43d87b6dd8b4bbf36390d012f37..66e84dffb1774a61b51473006568b22255b2811f 100644 (file)
@@ -71,7 +71,7 @@ __PACKAGE__->register_method ({
        
        # exclude-path list need to be 0 separated
        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'));
        $param->{mailto} = [ @mailto ];
index 6fd24bdaa1a59e527e3dcb72b7f1a429dc16c62d..bab7eb7bacab5ad072c6efd4fffccbf9c3fe8d5e 100644 (file)
@@ -212,6 +212,8 @@ sub read_vzdump_defaults {
            $res->{size} = int($1);
        } elsif ($line =~ m/maxfiles:\s*(\d+)\s*$/) {
            $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*$/) {
            $res->{mode} = $1;
        } else {
@@ -455,6 +457,12 @@ sub new {
 
     $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'}) {
        foreach my $path (@{$opts->{'exclude-path'}}) {
            $self->find_add_exclude ('-regex', $path);
@@ -1172,7 +1180,13 @@ sub command_line {
        next if $p eq 'id' || $p eq 'vmid' || $p eq 'starttime' || $p eq 'dow';
        my $v = $param->{$p};
        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;
index 9a5afe7e3fafc986d28829c46794b3ed5d583073..6f6ee68c5089b6a30e7ed04195f5b4509a726dab 100755 (executable)
@@ -123,6 +123,7 @@ Global configuration is stored in /etc/vzdump.conf.
  size: MB
  maxfiles: N
  script: FILENAME
+ exclude-path: PATHLIST
 
 =head1 HOOK SCRIPT
 
index 19893306e208b98473c142bea569dda4dfcfb275..77db3c27fd4437dea2a31d2ddf3ac93599041ae7 100644 (file)
@@ -11,3 +11,4 @@
 #size: MB
 #maxfiles: N
 #script: FILENAME
+#exclude-path: PATHLIST