]> git.proxmox.com Git - qemu-server.git/commitdiff
also support live-import with absolute paths
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 11 Mar 2024 10:47:12 +0000 (11:47 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 14 Mar 2024 12:37:16 +0000 (13:37 +0100)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
PVE/API2/Qemu.pm

index 6620f1d9c17c1be4809d5ab2c6affc1d723f5906..497987ff550a256730400eeaae99fbd84af2e9ff 100644 (file)
@@ -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) {