From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 9CB1996E3D for ; Tue, 16 Apr 2024 15:19:53 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5D1991BB18 for ; Tue, 16 Apr 2024 15:19:23 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 16 Apr 2024 15:19:18 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id DB68345246 for ; Tue, 16 Apr 2024 15:19:14 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Tue, 16 Apr 2024 15:18:58 +0200 Message-Id: <20240416131909.2867605-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240416131909.2867605-1-d.csapak@proxmox.com> References: <20240416131909.2867605-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.014 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH storage 5/9] ovf: implement parsing out firmware type X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Apr 2024 13:19:53 -0000 it seems there is no part of the ovf standard that handles which type of bios there is (at least i could not find it). Every ovf/ova i tested either has no info about it, or has it in a vmware specific property which we pare here. Signed-off-by: Dominik Csapak --- src/PVE/Storage/DirPlugin.pm | 5 +++++ src/PVE/Storage/OVF.pm | 5 +++++ src/test/ovf_manifests/Win10-Liz_no_default_ns.ovf | 1 + src/test/run_ovf_tests.pl | 1 + 4 files changed, 12 insertions(+) diff --git a/src/PVE/Storage/DirPlugin.pm b/src/PVE/Storage/DirPlugin.pm index 50ceab7..8a248c7 100644 --- a/src/PVE/Storage/DirPlugin.pm +++ b/src/PVE/Storage/DirPlugin.pm @@ -283,6 +283,11 @@ sub get_import_metadata { }; } + if (defined($res->{qm}->{bios}) && $res->{qm}->{bios} eq 'ovmf') { + $disks->{efidisk0} = 1; + push @$warnings, { type => 'efi-state-lost', key => 'bios', value => 'ovmf' }; + } + return { type => 'vm', source => $volname, diff --git a/src/PVE/Storage/OVF.pm b/src/PVE/Storage/OVF.pm index dd8431a..f56c34d 100644 --- a/src/PVE/Storage/OVF.pm +++ b/src/PVE/Storage/OVF.pm @@ -229,6 +229,11 @@ sub parse_ovf { my $ostype_id = $xpc->findvalue($xpath_find_ostype_id); $qm->{ostype} = get_ostype($ostype_id); + # vmware specific firmware config, seems to not be standardized in ovf ? + my $xpath_find_firmware = "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/vmw:Config[\@vmw:key=\"firmware\"]/\@vmw:value"; + my $firmware = $xpc->findvalue($xpath_find_firmware) || 'seabios'; + $qm->{bios} = 'ovmf' if $firmware eq 'efi'; + # disks metadata is split in four different xml elements: # * as an Item node of type DiskDrive in the VirtualHardwareSection # * as an Disk node in the DiskSection diff --git a/src/test/ovf_manifests/Win10-Liz_no_default_ns.ovf b/src/test/ovf_manifests/Win10-Liz_no_default_ns.ovf index b93540f..10ccaf1 100755 --- a/src/test/ovf_manifests/Win10-Liz_no_default_ns.ovf +++ b/src/test/ovf_manifests/Win10-Liz_no_default_ns.ovf @@ -137,6 +137,7 @@ + diff --git a/src/test/run_ovf_tests.pl b/src/test/run_ovf_tests.pl index e949c15..a8b2d1e 100755 --- a/src/test/run_ovf_tests.pl +++ b/src/test/run_ovf_tests.pl @@ -70,5 +70,6 @@ is($win10noNs->{qm}->{name}, 'Win10-Liz', 'win10 VM (no default rasd NS) name is is($win10noNs->{qm}->{memory}, '6144', 'win10 VM (no default rasd NS) memory is correct'); is($win10noNs->{qm}->{cores}, '4', 'win10 VM (no default rasd NS) cores are correct'); is($win10noNs->{qm}->{ostype}, 'other', 'win10 VM (no default rasd NS) ostype is correct'); +is($win10noNs->{qm}->{bios}, 'ovmf', 'win10 VM (no default rasd NS) bios is correct'); done_testing(); -- 2.39.2