otherwise qemu-img uses its default intiator id which may not have access

Signed-off-by: Dominik Csapak <d.csa...@proxmox.com>
---
 PVE/QemuServer.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 8376260..2267a3a 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -7277,8 +7277,18 @@ sub create_efidisk($$$$$) {
     PVE::Storage::activate_volumes($storecfg, [$volid]);
 
     my $path = PVE::Storage::path($storecfg, $volid);
+
+    my $targetopts = ['-O', $fmt];
+    if ($path =~ m|^iscsi://|) {
+       $targetopts = ['--target-image-opts'];
+       $path = convert_iscsi_path($path);
+    }
+
+    my $cmd = ['/usr/bin/qemu-img', 'convert', '-n', '-f', 'raw' ];
+    push @$cmd, @$targetopts, $ovmf_vars, $path;
+
     eval {
-       run_command(['/usr/bin/qemu-img', 'convert', '-n', '-f', 'raw', '-O', 
$fmt, $ovmf_vars, $path]);
+       run_command($cmd);
     };
     die "Copying EFI vars image failed: $@" if $@;
 
-- 
2.20.1


_______________________________________________
pve-devel mailing list
pve-devel@pve.proxmox.com
https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to