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 # 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 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 }} tunnel_interface="{{- .Values.network.interface.tunnel -}}"
if [ not $tunnel_interface ] ; then if [ -z "${tunnel_interface}" ] ; then
# search for interface with default routing # search for interface with default routing
tunnel_interface=$(ip r | grep default | grep -oP '(?<=dev ).*') tunnel_interface=$(ip r | grep default | grep -oP '(?<=dev ).*')
fi fi

View File

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

View File

@ -23,5 +23,5 @@ modprobe gre
modprobe vxlan modprobe vxlan
ovs-vsctl --no-wait show 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 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: ml2:
ovs: ovs:
auto_bridge_add: [] auto_bridge_add:
# To automatically add a physical interface to a specific bridge using, # To automatically add a physical interface to a specific bridge using,
# for example eth3 to bridge br-physnet1 define the following key/value # for example eth3 to bridge br-physnet1 define the following key/value
# in auto_bridge_add: # in auto_bridge_add:
# - br-physnet1:eth3 # br-physnet1: eth3
dependencies: dependencies:
db_init: db_init: