Neutron fixes; fix external and tunnel interfaces.

Fixes to resolve confusion between gotpl and bash variable handling
and also how bash handles empty strings.

These are required to robustly:
 1. make use of an external network (for floating IPs)
 2. specify *which* interface in the nodes is used for the tunnelled
    traffic.

Change-Id: I30fd675cd471a77dc09a6c7f6ee81120a978b38b
This commit is contained in:
Chris Wedgwood 2017-05-27 05:04:27 +00:00
parent 78abb8218c
commit 7b96c5cfff
4 changed files with 20 additions and 21 deletions

View File

@ -26,8 +26,8 @@ chown neutron: /run/openvswitch/db.sock
# see https://github.com/att-comdev/openstack-helm/issues/88
timeout 3m neutron-sanity-check --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/openvswitch_agent.ini --ovsdb_native --nokeepalived_ipv6_support
tunnel_interface={{ .Values.network.interface.tunnel }}
if [ not $tunnel_interface ] ; then
tunnel_interface="{{- .Values.network.interface.tunnel -}}"
if [ -z "${tunnel_interface}" ] ; then
# search for interface with default routing
tunnel_interface=$(ip r | grep default | grep -oP '(?<=dev ).*')
fi

View File

@ -20,23 +20,22 @@
set -x
bridge=$1
port=$2
bridge="{{ .Values.network.external_bridge }}"
port="{{ .Values.network.interface.external }}"
# note that only "br-ex" is definable right now
# and br-int and br-tun are assumed and handled
# by the agent
ovs-vsctl --no-wait --may-exist add-br $bridge
if [ $port] ; then
ovs-vsctl --no-wait --may-exist add-port $bridge $port
ip link set dev $port up
# create bridge device
ovs-vsctl --no-wait --may-exist add-br "$bridge"
if [ ! -z "$port" ] ; then
ovs-vsctl --no-wait --may-exist add-port "$bridge" "$port"
ip link set dev "$port" up
fi
# handle any bridge mappings
{{- range $bridge, $port := .Values.ml2.ovs.auto_bridge_add }}
ovs-vsctl --no-wait --may-exist add-br {{ $bridge }}
if [ {{ $port }} ] ; then
ovs-vsctl --no-wait --may-exist add-port {{ $bridge }} {{ $port }}
ip link set dev {{ $port }} up
fi
{{- end}}
{{ range $br, $phys := .Values.ml2.ovs.auto_bridge_add }}
# create {{ $br }}{{ if $phys }} and add port {{ $phys }}{{ end }}
ovs-vsctl --no-wait --may-exist add-br {{ $br }}
{{ if $phys }}
ovs-vsctl --no-wait --may-exist add-port {{ $br }} {{ $phys }}
ip link set dev {{ $phys }} up
{{ end }}
{{ end -}}

View File

@ -23,5 +23,5 @@ modprobe gre
modprobe vxlan
ovs-vsctl --no-wait show
bash /tmp/openvswitch-ensure-configured.sh {{ .Values.network.external_bridge }} {{ .Values.network.interface.external }}
bash -x /tmp/openvswitch-ensure-configured.sh
exec /usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock --mlockall -vconsole:emer -vconsole:err -vconsole:info

View File

@ -118,11 +118,11 @@ metadata:
ml2:
ovs:
auto_bridge_add: []
auto_bridge_add:
# To automatically add a physical interface to a specific bridge using,
# for example eth3 to bridge br-physnet1 define the following key/value
# in auto_bridge_add:
# - br-physnet1:eth3
# br-physnet1: eth3
dependencies:
db_init: