]> git.proxmox.com Git - pve-container.git/commitdiff
new helper mountpoint_backup_enabled()
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 18 May 2016 05:40:59 +0000 (07:40 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Wed, 18 May 2016 05:40:59 +0000 (07:40 +0200)
to test if backup is enabled for a specific mount point.

src/PVE/LXC/Config.pm
src/PVE/VZDump/LXC.pm

index d888fed2625fb0fac2d2d75b644c5a0ced988272..13f00aa2748897b66a28c937a0f4e77868011849 100644 (file)
@@ -44,6 +44,16 @@ sub cfs_config_path {
     return "nodes/$node/lxc/$vmid.conf";
 }
 
+sub mountpoint_backup_enabled {
+    my ($mp_key, $mountpoint) = @_;
+
+    return 1 if $mp_key eq 'rootfs';
+
+    return 1 if $mountpoint->{backup};
+
+    return 0;
+}
+
 sub has_feature {
     my ($class, $feature, $conf, $storecfg, $snapname, $running, $backup_only) = @_;
     my $err;
@@ -52,7 +62,7 @@ sub has_feature {
        my ($ms, $mountpoint) = @_;
 
        return if $err; # skip further test
-       return if $backup_only && $ms ne 'rootfs' && !$mountpoint->{backup};
+       return if $backup_only && !mountpoint_backup_enabled($ms, $mountpoint);
 
        $err = 1
            if !PVE::Storage::volume_has_feature($storecfg, $feature,
@@ -97,7 +107,9 @@ sub __snapshot_create_vol_snapshot {
 
     my $storecfg = PVE::Storage::config();
 
-    return if $snapname eq 'vzdump' && $ms ne 'rootfs' && !$mountpoint->{backup};
+    return if $snapname eq 'vzdump' &&
+       !mountpoint_backup_enabled($ms, $mountpoint);
+
     PVE::Storage::volume_snapshot($storecfg, $mountpoint->{volume}, $snapname);
 }
 
index 51af538b2bf226806edfd1393917f4932c425bff..bf6c14e7db46ef31929ca68c8d3fda989b38ed8d 100644 (file)
@@ -120,7 +120,7 @@ sub prepare {
 
        return if !$volid || !$mount;
 
-       if ($name ne 'rootfs' && !$data->{backup}) {
+       if (!PVE::LXC::Config->mountpoint_backup_enabled($name, $data)) {
            push @$exclude_dirs, $mount;
            return;
        }