Change to set the container network MTU

This change adds the container network MTU option within the container
network LXC config file. This will allow a deployer to set the MTU within
a provider networks entry in openstack_user_config.yml.

Example:

  ....
  provider_networks:
    - network:
        container_bridge: "br-storage"
        container_type: "veth"
        container_interface: "eth2"
        ip_from_q: "storage"
        type: "raw"
        container_mtu: "9000"
        group_binds:
          - glance_api
          - cinder_api
          - cinder_volume
          - nova_compute
          - swift_proxy

This changes gives the deployer the ability to selectively set the mtu as
needed.

The dynamic_inventory.py script has been updated to allow for the MTU entry.

Example file documentation has been added to show how to use this new setting.

BackportPotential
DocImpact
Closes-Bug: #1477346

Change-Id: If8c0ee042d2f1322f8322ea6c8ee33606070d880
This commit is contained in:
kevin
2015-07-22 19:06:57 -05:00
parent 4f405f4704
commit 8cf1f44c9e
3 changed files with 16 additions and 2 deletions

View File

@@ -147,6 +147,9 @@
# Name of mechanism that connects interfaces in containers to the bridge
# on target hosts for this network. Typically 'veth'.
#
# Option: container_mtu (optional, string)
# Sets the MTU within LXC for a given network type.
#
# Option: ip_from_q (optional, string)
# Name of network in 'cidr_networks' level to use for IP address pool. Only
# valid for 'raw' and 'vxlan' types.
@@ -226,6 +229,7 @@
# container_bridge: "br-storage"
# container_type: "veth"
# container_interface: "eth2"
# container_mtu: "9000"
# ip_from_q: "storage"
# - network:
# group_binds:
@@ -233,6 +237,7 @@
# container_bridge: "br-vxlan"
# container_type: "veth"
# container_interface: "eth10"
# container_mtu: "9000"
# ip_from_q: "tunnel"
# type: "vxlan"
# range: "1:1000"

View File

@@ -456,8 +456,9 @@ def _load_optional_q(config, cidr_name):
def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
bridge, net_type, user_config, is_ssh_address,
is_container_address, static_routes):
bridge, net_type, net_mtu, user_config,
is_ssh_address, is_container_address,
static_routes):
"""Process additional ip adds and append then to hosts as needed.
If the host is found to be "is_metal" it will be marked as "on_metal"
@@ -492,6 +493,9 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
if net_type:
_network['type'] = net_type
if net_mtu:
_network['mtu'] = net_mtu
return _network
def return_netmask():
@@ -519,6 +523,7 @@ def _add_additional_networks(key, inventory, ip_q, q_name, netmask, interface,
interface,
bridge,
net_type,
net_mtu,
user_config,
is_ssh_address,
is_container_address,
@@ -694,6 +699,7 @@ def container_skel_load(container_skel, inventory, config):
interface=p_net['container_interface'],
bridge=p_net['container_bridge'],
net_type=p_net.get('container_type'),
net_mtu=p_net.get('container_mtu'),
user_config=config,
is_ssh_address=p_net.get('is_ssh_address'),
is_container_address=p_net.get('is_container_address'),

View File

@@ -10,3 +10,6 @@ lxc.network.link = {{ item.value.bridge }}
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
# enable the device on boot
lxc.network.flags = up
# Set the container network MTU
lxc.network.mtu = {{ item.value.mtu|default('1500') }}