[pve-devel] [PATCH storage 7/9] ovf: implement parsing nics

Fiona Ebner f.ebner at proxmox.com
Thu Apr 18 10:22:45 CEST 2024


Am 16.04.24 um 15:19 schrieb Dominik Csapak:
> @@ -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) {
> +	my $model = $xpc->findvalue('rasd:ResourceSubType', $item_node);
> +	$model = lc($model);
> +	$model = 'vmxnet3' if ! grep $model, @$allowed_nic_models;

Noticed another issue while testing. This doesn't work and should be

> $model = 'vmxnet3' if !grep { $_ eq $model } @$allowed_nic_models;

> +	$net->{"net${net_count}"} = { model => $model };
>      }
>  
> -    return {qm => $qm, disks => \@disks};
> +    return {qm => $qm, disks => \@disks, net => $net};
>  }
>  
>  1;




More information about the pve-devel mailing list