MNAIO: flat networking fixes

With the switch to systemd-networkd the veth pairs for flat networking
and lbaas aren't created.  This creates veth pairs if the server has the
appropriate server_networks defined.

* Create the veth network files

With this simple Match directive networkd will bring the interface up.

Change-Id: I0ae4375be128594a861c18aa33a98378859dd9d3
This commit is contained in:
Dave Wilde 2018-10-25 20:13:34 -05:00
parent 27aeb36389
commit 58c7890bfc

View File

@ -49,4 +49,55 @@ UseNTP=yes
Address={{ value.address }} Address={{ value.address }}
{% endif %} {% endif %}
EOF EOF
# generate files for flat networking
{% if value.iface is defined and key == "flat" %}
cat <<EOF >/etc/systemd/network/br-veth-{{ key }}.netdev
[NetDev]
Name=v{{ value.iface }}
Kind=veth
[Peer]
Name=br-veth-{{ key }}
EOF
cat <<EOF >/etc/systemd/network/br-veth-{{ key }}.network
[Match]
Name=br-veth-{{ key }}
[Network]
Bridge=br-{{ key }}
ConfigureWithoutCarrier=yes
EOF
cat <<EOF >/etc/systemd/network/v{{ value.iface }}.network
[Match]
Name=v{{ value.iface }}
EOF
{% endif %}
# generate files for lbaas
{% if value.iface is defined and key == "lbaas" %}
cat <<EOF >/etc/systemd/network/br-veth-{{ key }}.netdev
[NetDev]
Name=v{{ value.iface }}
Kind=veth
[Peer]
Name=br-veth-{{ key }}
EOF
cat <<EOF >/etc/systemd/network/br-veth-{{ key }}.network
[Match]
Name=br-veth-{{ key }}
[Network]
Bridge=br-{{ key }}
ConfigureWithoutCarrier=yes
EOF
cat <<EOF >/etc/systemd/network/v{{ value.iface }}.network
[Match]
Name=v{{ value.iface }}
EOF
{% endif %}
{% endfor %} {% endfor %}