[pve-devel] [PATCH storage] zfs: get the real mountpoint in path()

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Feb 12 15:06:36 CET 2016


---
Since mountpoints can be inherited and modified (and set to 'legacy'
and 'none') we need to deal with this. The current method of assuming
default paths doesn't always work.

'legacy' mounts don't have an actual path, so they need to be mounted
via `mount -t zfs` while mountpoints with paths *should* be mounted,
the question is now whether 'activate()' should also trigger a `zfs
mount`.

At the same time we never `zfs unmount` which can even cause issues
when done in the wrong order, so maybe we should keep assuming that
volumes with mountpoints ARE mounted at their mountpoints like we've
been doing all along anyway...

 PVE/Storage/ZFSPoolPlugin.pm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index 6b276e4..96db4f8 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -148,8 +148,12 @@ sub path {
 
     if ($vtype eq "images") {
 	if ($volname =~ m/^subvol-/) {
-	    # fixme: we currently assume standard mount point?!
-	    $path = "/$scfg->{pool}/$volname";
+	    if ($snapname) {
+		$path = "$scfg->{pool}/$volname";
+	    } else {
+		$path = $class->zfs_request($scfg, undef, 'get', '-H', '-o', 'value', 'mountpoint', "$scfg->{pool}/$volname");
+		chomp $path;
+	    }
 	} else {
 	    $path = "/dev/zvol/$scfg->{pool}/$volname";
 	}
-- 
2.1.4





More information about the pve-devel mailing list