Check whether 'zfs get mountpoint' returns a valid absolute path

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@proxmox.com>
This commit is contained in:
Fabian Ebner
2020-02-18 11:14:59 +01:00
committed by Thomas Lamprecht
parent 1022a7c4a9
commit 75815bf556

View File

@ -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)) {