[pve-devel] [PATCH storage] Check whether 'zfs get mountpoint' returns a valid absolute path

Fabian Ebner f.ebner at proxmox.com
Tue Feb 18 11:14:59 CET 2020


The command 'zfs get mountpoint' can return 'none'
and so 'mountpoint none' was written to storage.cfg,
which would block the fall-back to using the default
mount point when requesting a path, see [0].

[0]: https://forum.proxmox.com/threads/zfs-backup-with-snapshot-mode-fails.61927/#post-284123

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 PVE/Storage/ZFSPoolPlugin.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/PVE/Storage/ZFSPoolPlugin.pm b/PVE/Storage/ZFSPoolPlugin.pm
index d72ee16..b538e3b 100644
--- a/PVE/Storage/ZFSPoolPlugin.pm
+++ b/PVE/Storage/ZFSPoolPlugin.pm
@@ -153,8 +153,10 @@ sub on_add_hook {
     my $cfg_mountpoint = $scfg->{mountpoint};
 
     # ignore failure, pool might currently not be imported
-    my $mountpoint = eval {
-	$class->zfs_get_properties($scfg, 'mountpoint', $scfg->{pool}, 1)
+    my $mountpoint;
+    eval {
+	my $res = $class->zfs_get_properties($scfg, 'mountpoint', $scfg->{pool}, 1);
+	$mountpoint = PVE::Storage::Plugin::verify_path($res, 1) if defined($res);
     };
 
     if (defined($cfg_mountpoint)) {
-- 
2.20.1




More information about the pve-devel mailing list