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

Fabian Grünbichler f.gruenbichler at proxmox.com
Thu Jan 28 09:00:30 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..de50821 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);
+	die "snapshot feature is not available\n"
+	    if !has_feature('snapshot', $conf, $storecfg, $snapname);
 
 	$snap = $conf->{snapshots}->{$snapname} = {};
 
@@ -1787,6 +1788,9 @@ sub has_feature {
 	my ($ms, $mountpoint) = @_;
 
 	return if $err; # skip further test
+
+	# skip mountpoints with backup == 0 if we create a vzdump snapshot
+	return if $snapname && $snapname eq '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..dfc686f 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('snapshot', $conf, $storage_cfg, 'vzdump')) {
 	    die "mode failure - some volumes do not support snapshots\n";
 	}
 
-- 
2.1.4





More information about the pve-devel mailing list