]> git.proxmox.com Git - pve-container.git/commitdiff
add upscript (lxcnetaddbr) to container lxc config
authorWolfgang Bumiller <w.bumiller@proxmox.com>
Fri, 3 Apr 2020 14:37:37 +0000 (16:37 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 4 Apr 2020 17:39:02 +0000 (19:39 +0200)
This used to be a patch on top of lxc, now we just configure
it explicitly here to reduce the patch load.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
src/PVE/LXC.pm

index de4389d3a25d23fb089400890b3001a73f1905e1..b397d67846a1cb3244f2b20316013545954b9c09 100644 (file)
@@ -580,6 +580,8 @@ sub update_lxc_config {
        return;
     }
 
+    my ($lxc_major, $lxc_minor) = get_lxc_version();
+
     my $raw = '';
 
     die "missing 'arch' - internal error" if !$conf->{arch};
@@ -682,6 +684,11 @@ sub update_lxc_config {
        $raw .= "lxc.net.$ind.hwaddr = $d->{hwaddr}\n" if defined($d->{hwaddr});
        $raw .= "lxc.net.$ind.name = $d->{name}\n" if defined($d->{name});
        $raw .= "lxc.net.$ind.mtu = $d->{mtu}\n" if defined($d->{mtu});
+
+       # Starting with lxc 4.0, we do not patch lxc to execute our up-scripts.
+       if ($lxc_major >= 4) {
+           $raw .= "lxc.net.$ind.script.up = /usr/share/lxc/lxcnetaddbr\n";
+       }
     }
 
     my $had_cpuset = 0;