[pve-devel] [PATCH container] zfs: deal with legacy mountpoints

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Feb 12 15:08:05 CET 2016


---
This needs the pve-storage zfs patch.

 src/PVE/LXC.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index a737fc0..6010bb4 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -2309,7 +2309,7 @@ sub mountpoint_mount {
 	my $scfg = PVE::Storage::storage_config($storage_cfg, $storage);
 	my $path = PVE::Storage::path($storage_cfg, $volid, $snapname);
 
-	my ($vtype, undef, undef, undef, undef, $isBase, $format) =
+	my ($vtype, $volname, undef, undef, undef, $isBase, $format) =
 	    PVE::Storage::parse_volname($storage_cfg, $volid);
 
 	$format = 'iso' if $vtype eq 'iso'; # allow to handle iso files
@@ -2325,7 +2325,13 @@ sub mountpoint_mount {
 			die "cannot mount subvol snapshots for storage type '$scfg->{type}'\n";
 		    }
 		} else {
-		    bindmount($path, $mount_path, $readonly, @extra_opts);
+		    if ($path eq 'legacy') {
+			$path = "$scfg->{pool}/$volname";
+			push @extra_opts, '-o', 'ro' if $readonly;
+			PVE::Tools::run_command(['mount', '-t', 'zfs', @extra_opts, $path, $mount_path]);
+		    } else {
+			bindmount($path, $mount_path, $readonly, @extra_opts);
+		    }
 		    warn "cannot enable quota control for bind mounted subvolumes\n" if $quota;
 		}
 	    }
-- 
2.1.4





More information about the pve-devel mailing list