]> git.proxmox.com Git - pve-container.git/commitdiff
use systemd-networkd for ubuntu >= 17.10
authorDominik Csapak <d.csapak@proxmox.com>
Tue, 31 Oct 2017 10:25:09 +0000 (11:25 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 31 Oct 2017 11:46:58 +0000 (12:46 +0100)
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@proxmox.com>
src/PVE/LXC/Setup/Ubuntu.pm

index 59e18fb0f21ea7eb86523c2217c93a013f152709..c4035d9d194d323420089066e43547642641c64f 100644 (file)
@@ -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;