[pve-devel] applied: [PATCH container 4/5] alpine: setup net: pass whole config to parent method

Thomas Lamprecht t.lamprecht at proxmox.com
Wed Sep 9 21:12:22 CEST 2020


We expected the whole $conf to be passed in a call to setup_network,
a bit ago it worked if their where only the netX keys present, for
some plugin that still is the case.
But, in the Debian version, reused by Alpine, we now check if the CT
distro version is recent enough to support (or need) the address in
CIDR format.
So, at least "ostype" needs to be passed to, else we get ugly
warnings in the syslog (or the recently added --debug log CLI switch)

Just pass the whole config, the setup_network method need to cope
with that anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/LXC/Setup/Alpine.pm | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/PVE/LXC/Setup/Alpine.pm b/src/PVE/LXC/Setup/Alpine.pm
index 75d6ebe..e486971 100644
--- a/src/PVE/LXC/Setup/Alpine.pm
+++ b/src/PVE/LXC/Setup/Alpine.pm
@@ -86,21 +86,24 @@ sub setup_network {
     # at least with the workaround the networking starts and if an ipv4 is
     # configured slaac for ipv6 works (unless accept_ra = 0 in the node)
 
-    my $netconf = {};
+    my $newconf = {};
     my $networks = {};
     foreach my $k (keys %$conf) {
+	my $value = $conf->{$k};
+	$newconf->{$k} = $value;
 	next if $k !~ m/^net(\d+)$/;
-	my $netstring = $conf->{$k};
+
+	my $netstring = $value;
 	# check for dhcp6:
 	my $d = PVE::LXC::Config->parse_lxc_network($netstring);
 	if (defined($d->{ip6}) && ($d->{ip6} eq 'dhcp' || $d->{ip6} eq 'auto')) {
 	    $d->{ip6} = 'manual';
 	    $netstring = PVE::LXC::Config->print_lxc_network($d);
 	}
-	$netconf->{$k} = $netstring;
+	$newconf->{$k} = $netstring;
     }
 
-    PVE::LXC::Setup::Debian::setup_network($self, $netconf);
+    PVE::LXC::Setup::Debian::setup_network($self, $newconf);
 }
 
 1;
-- 
2.20.1





More information about the pve-devel mailing list