From 4b84ad5e256eff89ad5360c5ca588ff3b600d481 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Dominic=20J=C3=A4ger?= Date: Fri, 26 Mar 2021 13:32:25 +0100 Subject: [PATCH] Optionally allow blockdev in abs_filesystem_path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is required to import from LVM storages, for example Signed-off-by: Dominic Jäger --- PVE/Storage.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index eaa86fb..122c3e9 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -609,22 +609,22 @@ sub path { } sub abs_filesystem_path { - my ($cfg, $volid) = @_; + my ($cfg, $volid, $allow_blockdev) = @_; my $path; if (parse_volume_id ($volid, 1)) { activate_volumes($cfg, [ $volid ]); $path = PVE::Storage::path($cfg, $volid); } else { - if (-f $volid) { + if (-f $volid || ($allow_blockdev && -b $volid)) { my $abspath = abs_path($volid); if ($abspath && $abspath =~ m|^(/.+)$|) { $path = $1; # untaint any path } } } - - die "can't find file '$volid'\n" if !($path && -f $path); + die "can't find file '$volid'\n" + if !($path && (-f $path || ($allow_blockdev && -b $path))); return $path; } -- 2.39.2