[pve-devel] [PULL container 3/5] install Alpine.pm and configure its network

Wolfgang Bumiller w.bumiller at proxmox.com
Fri Feb 12 09:27:32 CET 2016


Since busybox' current default DHCPv6 client is unfinished
and alpine currently doesn't handle a 'dhcp' interface type
in its /etc/network/interfaces and bails out when
configuring the network with a broken config we have to make
sure we don't pass this on to debian's setup_network.

Unfortunately a warning at this point would only be visible
when creating a container because at this point no warning
makes it to the console/UI (and errors would be hidden
because the setup runs in our lxc prestart hook).
---
 src/PVE/LXC/Setup/Alpine.pm | 24 +++++++++++++++++++++++-
 src/PVE/LXC/Setup/Makefile  |  2 +-
 2 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/PVE/LXC/Setup/Alpine.pm b/src/PVE/LXC/Setup/Alpine.pm
index f294961..7f7da3a 100644
--- a/src/PVE/LXC/Setup/Alpine.pm
+++ b/src/PVE/LXC/Setup/Alpine.pm
@@ -8,6 +8,7 @@ use PVE::Network;
 use File::Path;
 
 use PVE::LXC::Setup::Base;
+use PVE::LXC::Setup::Debian;
 
 use base qw(PVE::LXC::Setup::Base);
 
@@ -41,7 +42,28 @@ sub setup_init {
 }
 
 sub setup_network {
-    # Nothing to do
+    # Network is debian compatible, but busybox' udhcpc6 is unfinished
+    my ($self, $conf) = @_;
+
+    # XXX: udhcpc6 in busybox is broken; once a working alpine release comes
+    # we can remove this bit.
+    #
+    # Filter out ipv6 dhcp and turn it into 'manual' so they see what's up.
+    my $netconf = {};
+    my $networks = {};
+    foreach my $k (keys %$conf) {
+	next if $k !~ m/^net(\d+)$/;
+	my $netstring = $conf->{$k};
+	# check for dhcp6:
+	my $d = PVE::LXC::parse_lxc_network($netstring);
+	if (defined($d->{ip6}) && $d->{ip6} eq 'dhcp') {
+	    $d->{ip6} = 'manual';
+	    $netstring = PVE::LXC::print_lxc_network($d);
+	}
+	$netconf->{$k} = $netstring;
+    }
+
+    PVE::LXC::Setup::Debian::setup_network($self, $netconf);
 }
 
 1;
diff --git a/src/PVE/LXC/Setup/Makefile b/src/PVE/LXC/Setup/Makefile
index 9235edf..c12f1a3 100644
--- a/src/PVE/LXC/Setup/Makefile
+++ b/src/PVE/LXC/Setup/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Base.pm Debian.pm Ubuntu.pm Redhat.pm Fedora.pm SUSE.pm ArchLinux.pm
+SOURCES=Base.pm Debian.pm Ubuntu.pm Redhat.pm Fedora.pm SUSE.pm ArchLinux.pm Alpine.pm
 
 .PHONY: install
 install:
-- 
2.1.4





More information about the pve-devel mailing list