also support live-import with absolute paths

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2024-03-11 11:47:12 +01:00 committed by Thomas Lamprecht
parent e8710a9ae7
commit 81b984433b

View File

@ -420,9 +420,15 @@ my sub create_disks : prototype($$$$$$$$$$) {
}
} else {
$source = PVE::Storage::abs_filesystem_path($storecfg, $source, 1);
$size = PVE::Storage::file_size_info($source);
($size, my $source_format) = PVE::Storage::file_size_info($source);
die "could not get file size of $source\n" if !$size;
if ($live_import && $ds ne 'efidisk0') {
$live_import_mapping->{$ds} = {
path => $source,
format => $source_format,
};
} else {
(undef, $dst_volid) = PVE::QemuServer::ImportDisk::do_import(
$source,
$vmid,
@ -435,6 +441,7 @@ my sub create_disks : prototype($$$$$$$$$$) {
);
push @$vollist, $dst_volid;
}
}
if ($needs_creation) {
$size = PVE::Tools::convert_size($size, 'b' => 'kb'); # vdisk_alloc uses kb