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 02AC69C235 for ; Tue, 21 Nov 2023 18:49:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D9892E77E for ; Tue, 21 Nov 2023 18:49:41 +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, 21 Nov 2023 18:49:41 +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 DF8A741E44 for ; Tue, 21 Nov 2023 18:49:40 +0100 (CET) Message-ID: <9365cdcb-6b68-40bb-97a3-3f23b2785849@proxmox.com> Date: Tue, 21 Nov 2023 18:49:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird To: Proxmox VE development discussion , Stefan Lendl References: <20231121145556.436743-1-s.lendl@proxmox.com> <20231121145556.436743-3-s.lendl@proxmox.com> Content-Language: en-US From: Stefan Hanreich In-Reply-To: <20231121145556.436743-3-s.lendl@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.459 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 T_SCC_BODY_TEXT_LINE -0.01 - Subject: Re: [pve-devel] [PATCH pve-container 2/3] sdn: pass vmid and hostname to add_dhcp_mapping 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, 21 Nov 2023 17:49:42 -0000 see below On 11/21/23 15:55, Stefan Lendl wrote: > If no DHCP mapping was found in IPAM it will request a new IP. > In order to register an IPAM mapping it requires these values. > > Signed-off-by: Stefan Lendl > --- > src/PVE/LXC.pm | 4 ++-- > src/lxc-pve-prestart-hook | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm > index 9361823..7883cfb 100644 > --- a/src/PVE/LXC.pm > +++ b/src/PVE/LXC.pm > @@ -993,7 +993,7 @@ sub update_net { > warn $@ if $@; > > PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1); > - PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}); > + PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}, $vmid, $conf->{hostname}); > } > > delete $conf->{$opt}; > @@ -1046,7 +1046,7 @@ sub update_net { > } else { > if ($have_sdn) { > PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1); > - PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}); > + PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, $newnet->{hwaddr}, $vmid, $conf->{hostname}); > } > > hotplug_net($vmid, $conf, $opt, $newnet, $netid); > diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook > index ab35774..4f5c7e2 100755 > --- a/src/lxc-pve-prestart-hook > +++ b/src/lxc-pve-prestart-hook > @@ -210,7 +210,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub { > next if $k !~ /^net(\d+)/; > my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k}); > next if $net->{type} ne 'veth'; > - PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{hwaddr}); > + PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, $net->{hwaddr}, $conf->{vmid}, $conf->{hostname}); The $conf->{vmid} variable does not exist, a simple $vmid would work here. I've sent a patch correcting this issue. Other than that consider this series Tested-by: Stefan Hanreich