[pve-devel] [PATCH v2 container] Closes #877: Skip mps with backup=0 for snapshot backups

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jan 28 16:10:59 CET 2016


---
 src/PVE/LXC.pm        | 6 +++++-
 src/PVE/VZDump/LXC.pm | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 64d7d5c..59971e8 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1732,7 +1732,8 @@ my $snapshot_prepare = sub {
 	    if defined($conf->{snapshots}->{$snapname});
 
 	my $storecfg = PVE::Storage::config();
-	die "snapshot feature is not available\n" if !has_feature('snapshot', $conf, $storecfg);
+	my $feature = $snapname eq 'vzdump' ? 'vzdump' : 'snapshot';
+	die "snapshot feature is not available\n" if !has_feature($feature, $conf, $storecfg);
 
 	$snap = $conf->{snapshots}->{$snapname} = {};
 
@@ -1782,11 +1783,14 @@ sub has_feature {
     my ($feature, $conf, $storecfg, $snapname) = @_;
     
     my $err;
+    my $vzdump = $feature eq 'vzdump';
+    $feature = 'snapshot' if $vzdump;
 
     foreach_mountpoint($conf, sub {
 	my ($ms, $mountpoint) = @_;
 
 	return if $err; # skip further test
+	return if $vzdump && $ms ne 'rootfs' && !$mountpoint->{backup};
 	
 	$err = 1 if !PVE::Storage::volume_has_feature($storecfg, $feature, $mountpoint->{volume}, $snapname);
 
diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index e2ed7b6..dddf17e 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -150,7 +150,7 @@ sub prepare {
     my $volid_list = [map { $_->{volume} } @$disks];
 
     if ($mode eq 'snapshot') {
-	if (!PVE::LXC::has_feature('snapshot', $conf, $storage_cfg)) {
+	if (!PVE::LXC::has_feature('vzdump', $conf, $storage_cfg)) {
 	    die "mode failure - some volumes do not support snapshots\n";
 	}
 
-- 
2.1.4





More information about the pve-devel mailing list