From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id B225B1FF15F for ; Mon, 18 Nov 2024 16:29:59 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 9BE4B1349D; Mon, 18 Nov 2024 16:29:37 +0100 (CET) From: Dominik Csapak To: pve-devel@lists.proxmox.com Date: Mon, 18 Nov 2024 16:29:08 +0100 Message-Id: <20241118152928.858590-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241118152928.858590-1-d.csapak@proxmox.com> References: <20241118152928.858590-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.016 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 v7 05/11] 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" 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 parse here. Signed-off-by: Dominik Csapak Reviewed-by: Fiona Ebner --- src/PVE/GuestImport/OVF.pm | 5 +++++ src/PVE/Storage/DirPlugin.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/GuestImport/OVF.pm b/src/PVE/GuestImport/OVF.pm index a760e1e..08e9d0f 100644 --- a/src/PVE/GuestImport/OVF.pm +++ b/src/PVE/GuestImport/OVF.pm @@ -228,6 +228,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/PVE/Storage/DirPlugin.pm b/src/PVE/Storage/DirPlugin.pm index 04a0485..0c32242 100644 --- a/src/PVE/Storage/DirPlugin.pm +++ b/src/PVE/Storage/DirPlugin.pm @@ -282,6 +282,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/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 c433c9d..e92258d 100755 --- a/src/test/run_ovf_tests.pl +++ b/src/test/run_ovf_tests.pl @@ -72,5 +72,6 @@ is($win10noNs->{qm}->{memory}, '6144', 'win10 VM (no default rasd NS) memory is is($win10noNs->{qm}->{cores}, '4', 'win10 VM (no default rasd NS) cores are correct'); # older esxi/ovf standard used 'other' for windows10 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.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel