[pve-devel] [PATCH container 1/3] use systemd-networkd for ubuntu >= 17.10
Dominik Csapak
d.csapak at proxmox.com
Tue Oct 31 11:25:09 CET 2017
Ubuntu Artful uses systemd-networkd now,
but we have to delete the default netplan config from the
upstream lxc container, and enable systemd-networkd
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
src/PVE/LXC/Setup/Ubuntu.pm | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/src/PVE/LXC/Setup/Ubuntu.pm b/src/PVE/LXC/Setup/Ubuntu.pm
index 59e18fb..c4035d9 100644
--- a/src/PVE/LXC/Setup/Ubuntu.pm
+++ b/src/PVE/LXC/Setup/Ubuntu.pm
@@ -51,7 +51,20 @@ sub template_fixup {
my ($self, $conf) = @_;
my $version = $self->{version};
-
+
+ if ($version >= '17.10') {
+ # enable systemd-networkd
+ $self->ct_mkdir('/etc/systemd/system/multi-user.target.wants');
+ $self->ct_mkdir('/etc/systemd/system/socket.target.wants');
+ $self->ct_symlink('/lib/systemd/system/systemd-networkd.service',
+ '/etc/systemd/system/multi-user.target.wants/systemd-networkd.service');
+ $self->ct_symlink('/lib/systemd/system/systemd-networkd.socket',
+ '/etc/systemd/system/socket.target.wants/systemd-networkd.socket');
+
+ # unlink default netplan lxc config
+ $self->ct_unlink('/etc/netplan/10-lxc.yaml');
+ }
+
if ($version eq '15.04' || $version eq '15.10' || $version eq '16.04') {
# edit /etc/securetty (enable login on console)
$self->setup_securetty($conf, qw(pts/0));
@@ -106,4 +119,14 @@ __EOD__
}
}
+sub setup_network {
+ my ($self, $conf) = @_;
+
+ if ($self->{version} >= '17.10') {
+ $self->setup_systemd_networkd($conf);
+ } else {
+ $self->SUPER::setup_network($conf);
+ }
+}
+
1;
--
2.11.0
More information about the pve-devel
mailing list