From 7b96c5cffffd4c3e313f18b842744ebf11c4b7b9 Mon Sep 17 00:00:00 2001 From: Chris Wedgwood Date: Sat, 27 May 2017 05:04:27 +0000 Subject: [PATCH] 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 --- .../bin/_neutron-openvswitch-agent.sh.tpl | 4 +-- .../bin/_openvswitch-ensure-configured.sh.tpl | 31 +++++++++---------- .../bin/_openvswitch-vswitchd.sh.tpl | 2 +- neutron/values.yaml | 4 +-- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/neutron/templates/bin/_neutron-openvswitch-agent.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent.sh.tpl index 6f3310577f..5d5e4af845 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent.sh.tpl @@ -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 diff --git a/neutron/templates/bin/_openvswitch-ensure-configured.sh.tpl b/neutron/templates/bin/_openvswitch-ensure-configured.sh.tpl index 7eb703724c..54f5490370 100644 --- a/neutron/templates/bin/_openvswitch-ensure-configured.sh.tpl +++ b/neutron/templates/bin/_openvswitch-ensure-configured.sh.tpl @@ -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 -}} diff --git a/neutron/templates/bin/_openvswitch-vswitchd.sh.tpl b/neutron/templates/bin/_openvswitch-vswitchd.sh.tpl index 1e0c0d1db0..b93ba1e0f7 100644 --- a/neutron/templates/bin/_openvswitch-vswitchd.sh.tpl +++ b/neutron/templates/bin/_openvswitch-vswitchd.sh.tpl @@ -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 diff --git a/neutron/values.yaml b/neutron/values.yaml index 71d66fcc93..a1a0d452f9 100644 --- a/neutron/values.yaml +++ b/neutron/values.yaml @@ -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: