From: Dominik Csapak <d.csapak@proxmox.com>
To: Fiona Ebner <f.ebner@proxmox.com>,
Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH storage 7/9] ovf: implement parsing nics
Date: Wed, 17 Apr 2024 15:16:19 +0200 [thread overview]
Message-ID: <d108f0de-ee70-44f4-b85b-ef98905a2f87@proxmox.com> (raw)
In-Reply-To: <d3605008-9d4c-4e92-82a0-e15c4bcd0cfe@proxmox.com>
On 4/17/24 14:09, Fiona Ebner wrote:
> Am 16.04.24 um 15:19 schrieb Dominik Csapak:
>> by iterating over the relevant parts and trying to parse out the
>> 'ResourceSubType'. The content of that is not standardized, but I only
>> ever found examples that are compatible with vmware, meaning it's
>> either 'e1000', 'e1000e' or 'vmxnet3' (in various capitalizations; thus
>> the `lc()`)
>>
>> As a fallback i used vmxnet3, since i guess most OVAs are tuned for
>> vmware.
>
> I'm not familiar enough with the OVA/OVF ecosystem, but is this really
> the best default. I'd kinda expect e1000(e) to cause less issues in case
> we were not able to get the type from the OVA/OVF. And people coming
> from VMWare are likely going to use the dedicated importer.
i did choose that, since from what i saw looking for ovas, they are mostly
tailored for vmware consumption, so i thought it'd make sense to use
that as default.
not opposed to use e1000 though. i think in practice it won't make much difference
>
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>> src/PVE/Storage/DirPlugin.pm | 2 +-
>> src/PVE/Storage/OVF.pm | 20 +++++++++++++++++++-
>> src/test/run_ovf_tests.pl | 5 +++++
>> 3 files changed, 25 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/PVE/Storage/DirPlugin.pm b/src/PVE/Storage/DirPlugin.pm
>> index 8a248c7..21c8350 100644
>> --- a/src/PVE/Storage/DirPlugin.pm
>> +++ b/src/PVE/Storage/DirPlugin.pm
>> @@ -294,7 +294,7 @@ sub get_import_metadata {
>> 'create-args' => $res->{qm},
>> 'disks' => $disks,
>> warnings => $warnings,
>> - net => [],
>> + net => $res->{net},
>> };
>> }
>>
>> diff --git a/src/PVE/Storage/OVF.pm b/src/PVE/Storage/OVF.pm
>> index f438de2..c3e7ed9 100644
>> --- a/src/PVE/Storage/OVF.pm
>> +++ b/src/PVE/Storage/OVF.pm
>> @@ -120,6 +120,12 @@ sub get_ostype {
>> return $ostype_ids->{$id} // 'other';
>> }
>>
>> +my $allowed_nic_models = [
>> + 'e1000',
>> + 'e1000e',
>> + 'vmxnet3',
>> +];
>> +
>> sub find_by {
>> my ($key, $param) = @_;
>> foreach my $resource (@resources) {
>> @@ -355,9 +361,21 @@ ovf:Item[rasd:InstanceID='%s']/rasd:ResourceType", $controller_id);
>>
>> $qm->{boot} = "order=" . join(';', @$boot);
>>
>> + my $nic_id = dtmf_name_to_id('Ethernet Adapter');
>> + my $xpath_find_nics = "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType=${nic_id}]";
>> + my @nic_items = $xpc->findnodes($xpath_find_nics);
>> +
>> + my $net = {};
>> +
>> + my $net_count = 0;
>> + foreach my $item_node (@nic_items) {
>
> Style nit: please use for instead of foreach
>
>> + my $model = $xpc->findvalue('rasd:ResourceSubType', $item_node);
>> + $model = lc($model);
>> + $model = 'vmxnet3' if ! grep $model, @$allowed_nic_models;
>
>
>> + $net->{"net${net_count}"} = { model => $model };
>> }
>
> $net_count is never increased.
>
>>
>> - return {qm => $qm, disks => \@disks};
>> + return {qm => $qm, disks => \@disks, net => $net};
>> }
>>
>> 1;
>> diff --git a/src/test/run_ovf_tests.pl b/src/test/run_ovf_tests.pl
>> index 8cf5662..d9a7b4b 100755
>> --- a/src/test/run_ovf_tests.pl
>> +++ b/src/test/run_ovf_tests.pl
>> @@ -54,6 +54,11 @@ is($win10noNs->{disks}->[0]->{disk_address}, 'scsi0', 'single disk vm (no defaul
>> is($win10noNs->{disks}->[0]->{backing_file}, "$test_manifests/Win10-Liz-disk1.vmdk", 'single disk vm (no default rasd NS) has the correct disk backing device');
>> is($win10noNs->{disks}->[0]->{virtual_size}, 2048, 'single disk vm (no default rasd NS) has the correct size');
>>
>> +print "testing nics\n";
>> +is($win2008->{net}->{net0}->{model}, 'e1000', 'win2008 has correct nic model');
>> +is($win10->{net}->{net0}->{model}, 'e1000e', 'win10 has correct nic model');
>> +is($win10noNs->{net}->{net0}->{model}, 'e1000e', 'win10 (no default rasd NS) has correct nic model');
>> +
>> print "\ntesting vm.conf extraction\n";
>>
>> is($win2008->{qm}->{boot}, 'order=scsi0;scsi1', 'win2008 VM boot is correct');
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2024-04-17 13:16 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-16 13:18 [pve-devel] [PATCH storage/qemu-server/pve-manager] implement ova/ovf import for directory type storages Dominik Csapak
2024-04-16 13:18 ` [pve-devel] [PATCH storage 1/9] copy OVF.pm from qemu-server Dominik Csapak
2024-04-16 15:02 ` Thomas Lamprecht
2024-04-17 9:19 ` Fiona Ebner
2024-04-17 9:26 ` Thomas Lamprecht
2024-04-16 13:18 ` [pve-devel] [PATCH storage 2/9] plugin: dir: implement import content type Dominik Csapak
2024-04-17 10:07 ` Fiona Ebner
2024-04-17 10:07 ` Fiona Ebner
2024-04-17 13:13 ` Dominik Csapak
2024-04-17 12:46 ` Fabian Grünbichler
2024-04-16 13:18 ` [pve-devel] [PATCH storage 3/9] plugin: dir: handle ova files for import Dominik Csapak
2024-04-17 10:52 ` Fiona Ebner
2024-04-17 13:07 ` Dominik Csapak
2024-04-17 13:39 ` Fabian Grünbichler
2024-04-18 7:22 ` Fiona Ebner
2024-04-18 7:25 ` Fiona Ebner
2024-04-18 8:55 ` Fabian Grünbichler
2024-04-17 12:45 ` Fabian Grünbichler
2024-04-17 13:10 ` Dominik Csapak
2024-04-17 13:52 ` Fabian Grünbichler
2024-04-17 14:07 ` Dominik Csapak
2024-04-18 6:46 ` Fabian Grünbichler
2024-04-16 13:18 ` [pve-devel] [PATCH storage 4/9] ovf: implement parsing the ostype Dominik Csapak
2024-04-17 11:32 ` Fiona Ebner
2024-04-17 13:14 ` Dominik Csapak
2024-04-18 7:31 ` Fiona Ebner
2024-04-16 13:18 ` [pve-devel] [PATCH storage 5/9] ovf: implement parsing out firmware type Dominik Csapak
2024-04-17 11:43 ` Fiona Ebner
2024-04-16 13:18 ` [pve-devel] [PATCH storage 6/9] ovf: implement rudimentary boot order Dominik Csapak
2024-04-17 11:54 ` Fiona Ebner
2024-04-17 13:15 ` Dominik Csapak
2024-04-16 13:19 ` [pve-devel] [PATCH storage 7/9] ovf: implement parsing nics Dominik Csapak
2024-04-17 12:09 ` Fiona Ebner
2024-04-17 13:16 ` Dominik Csapak [this message]
2024-04-18 8:22 ` Fiona Ebner
2024-04-16 13:19 ` [pve-devel] [PATCH storage 8/9] api: allow ova upload/download Dominik Csapak
2024-04-18 8:05 ` Fiona Ebner
2024-04-16 13:19 ` [pve-devel] [PATCH storage 9/9] plugin: enable import for nfs/btfs/cifs/cephfs Dominik Csapak
2024-04-18 8:43 ` Fiona Ebner
2024-04-16 13:19 ` [pve-devel] [PATCH qemu-server 1/3] api: delete unused OVF.pm Dominik Csapak
2024-04-18 8:52 ` Fiona Ebner
2024-04-18 8:57 ` Dominik Csapak
2024-04-18 9:03 ` Fiona Ebner
2024-04-16 13:19 ` [pve-devel] [PATCH qemu-server 2/3] use OVF from Storage Dominik Csapak
2024-04-18 9:07 ` Fiona Ebner
2024-04-16 13:19 ` [pve-devel] [PATCH qemu-server 3/3] api: create: implement extracting disks when needed for import-from Dominik Csapak
2024-04-18 9:41 ` Fiona Ebner
2024-04-18 9:48 ` Dominik Csapak
2024-04-18 9:55 ` Fiona Ebner
2024-04-18 9:58 ` Dominik Csapak
2024-04-18 10:01 ` Fiona Ebner
2024-04-16 13:19 ` [pve-devel] [PATCH manager 1/4] ui: fix special 'import' icon for non-esxi storages Dominik Csapak
2024-04-16 13:19 ` [pve-devel] [PATCH manager 2/4] ui: guest import: add ova-needs-extracting warning text Dominik Csapak
2024-04-16 13:19 ` [pve-devel] [PATCH manager 3/4] ui: enable import content type for relevant storages Dominik Csapak
2024-04-16 13:19 ` [pve-devel] [PATCH manager 4/4] ui: enable upload/download buttons for 'import' type storages Dominik Csapak
2024-04-17 12:37 ` Fabian Grünbichler
2024-04-18 11:20 ` Fiona Ebner
2024-04-18 11:23 ` Dominik Csapak
2024-04-18 11:26 ` Fiona Ebner
2024-04-17 13:11 ` [pve-devel] [PATCH storage/qemu-server/pve-manager] implement ova/ovf import for directory " Fabian Grünbichler
2024-04-17 13:19 ` Dominik Csapak
2024-04-18 6:40 ` Fabian Grünbichler
2024-04-18 9:27 ` Dominik Csapak
2024-04-18 10:35 ` Fiona Ebner
2024-04-18 11:10 ` Dominik Csapak
2024-04-18 11:13 ` Fiona Ebner
2024-04-18 11:17 ` Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d108f0de-ee70-44f4-b85b-ef98905a2f87@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox