From 513244b56b1ba6bff5fe52c6719200c4820d5192 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Evrard Date: Wed, 2 Dec 2015 17:13:24 +0100 Subject: [PATCH] Added to ability to set mtu for lxcbr0 The lxc_host role overrides the configuration done by the system administrator on the host. If mtu was defined in /etc/lxc/ and in the system network interfaces, then these configurations will be overriden. This commit should allow the deployer to set the mtu for its lxcbr0 network, by setting the variable lxc_net_mtu. Fixes-Bug: #1518303 Change-Id: I42ab3d0a2c20ae94335de195cdb14579d9f59f5f --- defaults/main.yml | 1 + templates/lxc-net-bridge.cfg.j2 | 3 +++ templates/lxc-openstack.conf.j2 | 3 +++ 3 files changed, 7 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index c82829b3..c72c2168 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,6 +23,7 @@ lxc_net_bridge_port: none lxc_net_address: 10.0.3.1 lxc_net_netmask: 255.255.255.0 lxc_net_gateway: none ## if "none" no gateway will on the LXC bridge, nat must be "false" to use a gateway. +#lxc_net_mtu: 1500 ##setting this variable will add mtu configuration for the lxc config and network bridge # lxc container nat enabled lxc_net_nat: true ## If "true" nat rules will be created with the lxc network. diff --git a/templates/lxc-net-bridge.cfg.j2 b/templates/lxc-net-bridge.cfg.j2 index afcb161b..436cb6c0 100644 --- a/templates/lxc-net-bridge.cfg.j2 +++ b/templates/lxc-net-bridge.cfg.j2 @@ -7,6 +7,9 @@ iface {{ lxc_net_bridge }} inet static {% if lxc_net_nat == "true" %} {% if lxc_net_gateway != "none" %} gateway {{ lxc_net_gateway }} +{% endif %} +{% if lxc_net_mtu is defined %} + mtu {{ lxc_net_mtu }} {% endif %} # nat rules start and stop post-up /usr/local/bin/lxc-system-manage iptables-create diff --git a/templates/lxc-openstack.conf.j2 b/templates/lxc-openstack.conf.j2 index 24b38da7..97ab4975 100644 --- a/templates/lxc-openstack.conf.j2 +++ b/templates/lxc-openstack.conf.j2 @@ -10,4 +10,7 @@ lxc.network.type = {{ lxc_container_net_type }} lxc.network.name = {{ lxc_container_net_name }} lxc.network.link = {{ lxc_container_net_link }} lxc.network.flags = up +{% if lxc_net_mtu is defined %} +lxc.network.mtu = {{ lxc_net_mtu }} +{% endif %} lxc.network.hwaddr = 00:16:3e:xx:xx:xx