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 01DD8BBB89 for ; Tue, 26 Mar 2024 13:06:51 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D621A1373C for ; Tue, 26 Mar 2024 13:06:20 +0100 (CET) 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, 26 Mar 2024 13:06:20 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 24C4D421AB for ; Tue, 26 Mar 2024 13:06:20 +0100 (CET) Message-ID: <070b28e1-cd94-4027-be42-0cbef4e2abfb@proxmox.com> Date: Tue, 26 Mar 2024 13:06:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: Thomas Lamprecht , Proxmox VE development discussion References: <20240326110339.3899836-1-a.lauterer@proxmox.com> <2d2fddcb-c7ab-47ef-956e-71befbdb5d2c@proxmox.com> From: Aaron Lauterer In-Reply-To: <2d2fddcb-c7ab-47ef-956e-71befbdb5d2c@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.064 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: Re: [pve-devel] [PATCH storage] esxi: use mac address when static, generated and vpx 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, 26 Mar 2024 12:06:51 -0000 sent a v2, unfortunately also one a bit too quickly (with no changes). please ignore that one :) On 2024-03-26 12:36, Thomas Lamprecht wrote: > Am 26/03/2024 um 12:03 schrieb Aaron Lauterer: >> static -> defined manually >> generated -> by ESXi >> vpx -> generated by vCenter > > nice! > >> Signed-off-by: Aaron Lauterer >> --- >> src/PVE/Storage/ESXiPlugin.pm | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> >> diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm >> index 77fb6c0..c5ddfea 100644 >> --- a/src/PVE/Storage/ESXiPlugin.pm >> +++ b/src/PVE/Storage/ESXiPlugin.pm >> @@ -793,7 +793,10 @@ sub for_each_netdev { >> >> my $ty = $dev->{addressType}; >> my $mac = $dev->{address}; >> - if ($ty && fc($ty) eq fc('generated')) { >> + if ($ty && (fc($ty) eq fc('static') >> + || fc($ty) eq fc('generated') >> + || fc($ty) eq fc('vpx') # vCenter generated > > To compare the same string to different allowed values in Perl we > generally prefer to either use a hash map with known OK values as keys, > or alternatively a regex, e.g.: > > if (fc($ty) =~ /^(static|generated|vpx)$/) { > # ... > } > > If there are only a ~ handful of different option, like here, this is > still easy to read but avoids some line bloat. > > If you want you can send a v2, else I can also change this on applying? > >> + )) { >> $mac = $dev->{generatedAddress} // $mac; >> } >> >