[pve-devel] [PATCH] Change bakup mode if storage support snapshot always use snapshot mode.

Wolfgang Link w.link at proxmox.com
Tue Aug 25 13:28:34 CEST 2015


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

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index d1a4ea6..5d8f701 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -1951,4 +1951,12 @@ sub mountpoint_mount {
     warn $@ if $@;
 }
 
+sub has_snapshot_capability {
+    my ($volid) = @_;
+    #implement later for all disks
+
+    my $cfg = PVE::Storage::config();
+
+    return PVE::Storage::volume_has_feature($cfg, 'snapshot', $volid);
+}
 1;
diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index fc3f03b..7b495d7 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -131,6 +131,8 @@ sub prepare {
 
     my $mountpoint = $mountpointdir.$vmid."/rootfs";
 
+    $mode = 'snapshot' if PVE::LXC::has_snapshot_capability($volid);
+
     # fixme: when do we deactivate ??
     PVE::Storage::activate_volumes($self->{storecfg}, [$volid]) if $volid;
 
-- 
2.1.4





More information about the pve-devel mailing list