Optionally allow blockdev in abs_filesystem_path
This is required to import from LVM storages, for example Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
This commit is contained in:
committed by
Thomas Lamprecht
parent
342a56805c
commit
4b84ad5e25
@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user