f924bfb418
This change resolves a long standing issue where a container's mac address regenerates when it was restarted. In most cases when a container is restarted and it's mac address is rotated and nothing bad happens; mac learning will resolve itself given enough time in just about all situations. However services like neutron-agents are long lived and are highly sensitive to network changes. These types of services expect consistent hardware addressing and when mac addresses rotate may become confused. To limit the possibility of prolonged downtime caused by mac address rotation on network sensitive containers an option has been created to allow a container to have a fixed mac address. If this option is enabled the container will generate fixed addresses for all networks assosiated with the specific container. The option is `lxc_container_fixed_mac` and it has a default value of "false". Change-Id: Ie1a8dc172c45fc2b4cfa724a2bafa67cb481ba73 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
25 lines
998 B
Django/Jinja
25 lines
998 B
Django/Jinja
# {{ ansible_managed }}
|
|
|
|
# Create a veth pair within the container
|
|
lxc.network.type = {{ item.value.type|default('veth') }}
|
|
# Network device within the container
|
|
lxc.network.name = {{ item.value.interface }}
|
|
{% if item.value.type is not defined or item.value.type == 'veth' %}
|
|
# Name the veth after the container
|
|
# NOTE(major): The lxc.network.veth.pair line must appear right after
|
|
# lxc.network.name or it will be ignored.
|
|
lxc.network.veth.pair = {{ lxc_container_network_veth_pair[-15:] }}
|
|
{% endif %}
|
|
# Host link to attach to, this should be a bridge if lxc.network.type = veth
|
|
lxc.network.link = {{ item.value.bridge }}
|
|
# Hardware Address
|
|
{% if lxc_container_fixed_mac | bool %}
|
|
lxc.network.hwaddr = {{ hostvars[inventory_hostname][item.value.interface + '_mac_address'] }}
|
|
{% else %}
|
|
lxc.network.hwaddr = 00:16:3e:xx:xx:xx
|
|
{% endif %}
|
|
# enable the device on boot
|
|
lxc.network.flags = up
|
|
# Set the container network MTU
|
|
lxc.network.mtu = {{ item.value.mtu|default(lxc_container_default_mtu) }}
|