From 81b984433bdfce052b4bd1e12950795c3e0bc34a Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 11 Mar 2024 11:47:12 +0100 Subject: [PATCH] also support live-import with absolute paths Signed-off-by: Wolfgang Bumiller --- PVE/API2/Qemu.pm | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm index 6620f1d9..497987ff 100644 --- a/PVE/API2/Qemu.pm +++ b/PVE/API2/Qemu.pm @@ -420,20 +420,27 @@ 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; - (undef, $dst_volid) = PVE::QemuServer::ImportDisk::do_import( - $source, - $vmid, - $storeid, - { - drive_name => $ds, - format => $disk->{format}, - 'skip-config-update' => 1, - }, - ); - push @$vollist, $dst_volid; + 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, + $storeid, + { + drive_name => $ds, + format => $disk->{format}, + 'skip-config-update' => 1, + }, + ); + push @$vollist, $dst_volid; + } } if ($needs_creation) {