[pve-devel] [PATCH 6/7] fix bug #691: vzdump backup fixed on zfs

Wolfgang Link w.link at proxmox.com
Mon Aug 24 10:48:35 CEST 2015


---
 src/PVE/VZDump/LXC.pm | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/src/PVE/VZDump/LXC.pm b/src/PVE/VZDump/LXC.pm
index d415444..42c5e44 100644
--- a/src/PVE/VZDump/LXC.pm
+++ b/src/PVE/VZDump/LXC.pm
@@ -132,6 +132,10 @@ sub prepare {
     # fixme: when do we deactivate ??
     PVE::Storage::activate_volumes($self->{storecfg}, [$volid]) if $volid;
 
+    my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
+
+    my $scfg = PVE::Storage::storage_config($self->{storecfg}, $sid);
+
     if ($mode eq 'snapshot') {
 
 	die "mode failure - storage does not support snapshots (no volid)\n" 
@@ -140,10 +144,6 @@ sub prepare {
 	die "mode failure - storage does not support snapshots\n"
 	    if !PVE::Storage::volume_has_feature($self->{storecfg}, 'snapshot', $volid);
 
-	my ($sid, $volname) = PVE::Storage::parse_volume_id($volid, 1);
-
-	my $scfg = PVE::Storage::storage_config($self->{storecfg}, $sid);
-
 	# we only handle well known types for now, because the storage
 	# library dos not handle mount/unmount of snapshots
 	die "mode failure - storage does not support snapshot mount\n"
@@ -170,9 +170,16 @@ sub prepare {
     } else {
 
 	if ($mode eq 'stop') {
-	    my $mountpoint = $mountpointdir.$vmid."/rootfs";
+	    my $mountpoint;
 	    my $path = PVE::Storage::path($self->{storecfg}, $volid);
-	    &$loop_mount_image($path, $mountpoint);
+
+	    if ($scfg->{type} eq 'zfspool') {
+		$mountpoint = $path;
+	    } else {
+		$mountpoint = $mountpointdir.$vmid."/rootfs";
+		&$loop_mount_image($path, $mountpoint);
+	    }
+
 	    $task->{cleanup}->{snapshot_mount} = $mountpoint;
 	    $diskinfo->{dir} = $diskinfo->{mountpoint} = $mountpoint;
 	} elsif ($mode eq 'suspend') {
-- 
2.1.4





More information about the pve-devel mailing list