[pve-devel] [PATCH container 17/20] add upscript (lxcnetaddbr) to container lxc config

w.bumiller at proxmox.com w.bumiller at proxmox.com
Fri Apr 3 16:37:37 CEST 2020


From: Wolfgang Bumiller <w.bumiller at proxmox.com>

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 at proxmox.com>
---
 src/PVE/LXC.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index de4389d..b397d67 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -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;
-- 
2.20.1





More information about the pve-devel mailing list