openstack-ansible-lxc_conta.../templates/container-interface.ini.j2
Dmitriy R 27697e9126 Implements possibility to use physical networks in containers.
This is usefull, if SR-IOV is used, and it's possible to
supply every container with it's own interface.
Especially usefull, if infinband is used (for example, for ceph),
as it can not be added into bridge.

openstack-user-config should be modified in this way for every service
within affected network:

- network:
    container_bridge: "ib5"
    container_type: "phys"
    container_interface: "ib5"
    ip_from_q: "storage"
    type: "raw"
    group_binds:
      - cinder_volume

Change-Id: I299aa3fb26f5278d2c86bb18c5df5abddcf0ff65
2018-08-10 00:05:54 +03:00

25 lines
1.2 KiB
Django/Jinja

# {{ ansible_managed }}
{### For lxc > 3.0 use lxc.net.[i] otherwise use lxc.network #}
{% set _lxc_net_var = (lxc_three_syntax | bool) | ternary ('lxc.net.' + ((item.0 | default(0)) | string),'lxc.network') %}
# Set the interface's type for the container
{{ _lxc_net_var }}.type = {{ item.1.type|default('veth') }}
# Network device within the container
{{ _lxc_net_var }}.name = {{ item.1.interface }}
{% if item.1.type is not defined or item.1.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_net_var }}.veth.pair = {{ lxc_container_network_veth_pair_indexed[-15:] }}
{% endif %}
# Host link to attach to, this should be a bridge if lxc.network.type = veth
{{ _lxc_net_var }}.link = {{ item.1.bridge }}
{% if item.1.type is not defined or item.1.type != 'phys' %}
# Hardware Address
{{ _lxc_net_var }}.hwaddr = {{ hostvars[inventory_hostname][item.1.interface + '_mac_address'] }}
{% endif %}
# enable the device on boot
{{ _lxc_net_var }}.flags = up
# Set the container network MTU
{{ _lxc_net_var }}.mtu = {{ item.1.mtu|default(lxc_container_default_mtu) }}