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 A0F781FF17C for ; Wed, 25 Jun 2025 10:30:45 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D16451070A; Wed, 25 Jun 2025 10:31:17 +0200 (CEST) Date: Wed, 25 Jun 2025 10:30:43 +0200 From: Wolfgang Bumiller To: Filip Schauer Message-ID: <45gnrfy7d6nagilkveaxtlheupun47joxoym57ziyro4clylqo@asl2nxfooulu> References: <20250611144903.200940-1-f.schauer@proxmox.com> <20250611144903.200940-7-f.schauer@proxmox.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-SPAM-LEVEL: Spam detection results: 0 AWL 0.080 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 container v2 06/11] configure static IP in LXC config for custom entrypoint 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 Cc: pve-devel@lists.proxmox.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On Wed, Jun 25, 2025 at 10:26:20AM +0200, Wolfgang Bumiller wrote: > On Wed, Jun 11, 2025 at 04:48:58PM +0200, Filip Schauer wrote: > > When a container uses the default `/sbin/init` entrypoint, network > > I'm not a fan of this logic, also because it does not support 'dhcp' (in > which case it should IMO fail instead). (Missed that there will be a dhcp patch - that one could revert the error message then - I'd still prefer to have an error initially here. Anyway, the point about having a property to control this behavior still stands.) > But maybe we can figure out an IP if SDN is in use to support the dhcp > case if there are static/permanent leases? (@Stefan?) > > I think this should be handled with a separate key in the containers > network configuration. Maybe a "setup" property which defaults to > "container" and can be set to "host" (not sure if we ever need more, > if we know we don't, it could be a boolean...) > > > interface configuration is usually managed by processes within the > > container. However, containers with a different entrypoint might not > > have any internal network management process. Consequently, IP addresses > > might not be assigned. > > > > This change ensures that a static IP address is explicitly set in the > > LXC config for the container. > > > > Signed-off-by: Filip Schauer > > --- > > src/PVE/LXC.pm | 12 ++++++++++++ > > 1 file changed, 12 insertions(+) > > > > diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm > > index b2be27e..0131ac3 100644 > > --- a/src/PVE/LXC.pm > > +++ b/src/PVE/LXC.pm > > @@ -818,6 +818,18 @@ sub update_lxc_config { > > if ($lxc_major >= 4) { > > $raw .= "lxc.net.$ind.script.up = /usr/share/lxc/lxcnetaddbr\n"; > > } > > + > > + if (!defined($d->{link_down}) || $d->{link_down} != 1 > > + && PVE::LXC::Config->get_entrypoint($conf) ne "/sbin/init" > > + ) { > > + $raw .= "lxc.net.$ind.ipv4.address = $d->{ip}\n" > > + if defined($d->{ip}) && $d->{ip} !~ /^(dhcp|manual)$/; > > + $raw .= "lxc.net.$ind.ipv4.gateway = $d->{gw}\n" if defined($d->{gw}); > > + $raw .= "lxc.net.$ind.ipv6.address = $d->{ip6}\n" > > + if defined($d->{ip6}) && $d->{ip6} !~ /^(auto|dhcp|manual)$/; > > + $raw .= "lxc.net.$ind.ipv6.gateway = $d->{gw6}\n" if defined($d->{gw6}); > > + $raw .= "lxc.net.$ind.flags = up\n"; > > + } > > } > > > > my $had_cpuset = 0; > > -- > > 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel