Support per-host overrides of auto_bridge_add

Support per-host overrides of auto_bridge_add, so we can set different
nic for ovs bridges.
This feature is already merged into openstack-helm. As we don't use
latest version of openstack-helm, so make this as a patch in
stx-upstream.

Change-Id: Ida085e8475ade6787aaaee77148d669248dd66c6
Story: 2004649
Task: 29867
Signed-off-by: chengli3 <cheng1.li@intel.com>
This commit is contained in:
chengli3 2019-03-07 10:14:54 +08:00
parent 99d7ae52d3
commit 9587d6c2d2
3 changed files with 208 additions and 1 deletions

View File

@ -5,4 +5,4 @@ TAR="$TAR_NAME-$SHA.tar.gz"
COPY_LIST="${CGCS_BASE}/downloads/$TAR $PKG_BASE/files/* "
TIS_PATCH_VER=11
TIS_PATCH_VER=12

View File

@ -29,6 +29,7 @@ Patch08: 0007-Stein-Remove-ceilometer-upgrade-option.patch
Patch09: 0008-Stein-Update-Cinder-to-include-resource_filters.json.patch
Patch10: 0009-Stein-add-log_config_append-to-neutron-etc.patch
Patch11: 0010-Stein-Nova-console-address-config-optionality.patch
Patch12: 0011-Support-per-host-overrides-of-auto_bridge_add.patch
BuildRequires: helm
BuildRequires: openstack-helm-infra
@ -50,6 +51,7 @@ Openstack Helm charts
%patch09 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
# initialize helm and build the toolkit

View File

@ -0,0 +1,205 @@
From 6e2e4aba8d1053adb6dcfc598c5c3d78c3195c94 Mon Sep 17 00:00:00 2001
From: chengli3 <cheng1.li@intel.com>
Date: Mon, 25 Feb 2019 20:15:53 +0800
Subject: [PATCH] Support per-host overrides of auto_bridge_add
.Values.network.auto_bridge_add is a global config. So in multi nodes
deployment, it requires that all hosts have the same nic names. This is
a strict limit.
This patch is to support per-host auto_bridge_add, so that we can define
different auto_bridge_add for hosts.
Also, this patch move .network.auto_bridge_add to .conf.auto_bridge_add
Change-Id: I4a4d6efbbfe073d035bc5c03700fbe998e708d0f
Story: 2005059
Task: 29601
---
doc/source/devref/networking.rst | 2 +-
.../bin/_neutron-linuxbridge-agent-init.sh.tpl | 28 +++++++++---------
.../bin/_neutron-openvswitch-agent-init.sh.tpl | 18 +++++++-----
neutron/templates/configmap-etc.yaml | 1 +
neutron/templates/daemonset-lb-agent.yaml | 4 +++
neutron/templates/daemonset-ovs-agent.yaml | 4 +++
neutron/values.yaml | 34 +++++++++++-----------
7 files changed, 53 insertions(+), 38 deletions(-)
diff --git a/doc/source/devref/networking.rst b/doc/source/devref/networking.rst
index e10a045..7b1afd7 100644
--- a/doc/source/devref/networking.rst
+++ b/doc/source/devref/networking.rst
@@ -272,7 +272,7 @@ init container and main container with :code:`neutron-ovs-agent` via file
Configuration of OVS bridges can be done via
`neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl`. The
script is configuring the external network bridge and sets up any
-bridge mappings defined in :code:`network.auto_bridge_add`. These
+bridge mappings defined in :code:`conf.auto_bridge_add`. These
values should align with
:code:`conf.plugins.openvswitch_agent.ovs.bridge_mappings`.
diff --git a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl
index e89765a..71a2b6b 100644
--- a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl
+++ b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl
@@ -19,19 +19,21 @@ limitations under the License.
set -ex
# configure all bridge mappings defined in config
-{{- range $br, $phys := .Values.network.auto_bridge_add }}
-if [ -n "{{- $br -}}" ] ; then
- # adding existing bridge would break out the script when -e is set
- set +e
- ip link add name {{ $br }} type bridge
- set -e
- ip link set dev {{ $br }} up
- if [ -n "{{- $phys -}}" ] ; then
- ip link set dev {{ $phys }} master {{ $br }}
- fi
-fi
-{{- end }}
-
+# /tmp/auto_bridge_add is one line json file: {"br-ex1":"eth1","br-ex2":"eth2"}
+for bmap in `sed 's/[{}"]//g' /tmp/auto_bridge_add | tr "," "\n"`
+do
+ bridge=${bmap%:*}
+ iface=${bmap#*:}
+ # adding existing bridge would break out the script when -e is set
+ set +e
+ ip link add name $bridge type bridge
+ set -e
+ ip link set dev $bridge up
+ if [ -n "$iface" ] && [ "$iface" != "null" ]
+ then
+ ip link set dev $iface master $bridge
+ fi
+done
tunnel_interface="{{- .Values.network.interface.tunnel -}}"
if [ -z "${tunnel_interface}" ] ; then
diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl
index 08c82e0..84f5e4b 100644
--- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl
+++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl
@@ -36,13 +36,17 @@ if neutron-sanity-check --version >/dev/null 2>/dev/null; then
fi
# handle any bridge mappings
-{{- range $bridge, $port := .Values.network.auto_bridge_add }}
-ovs-vsctl --no-wait --may-exist add-br {{ $bridge }}
-{{ if $port }}
-ovs-vsctl --no-wait --may-exist add-port {{ $bridge }} {{ $port }}
-ip link set dev {{ $port }} up
-{{ end }}
-{{- end }}
+# /tmp/auto_bridge_add is one line json file: {"br-ex1":"eth1","br-ex2":"eth2"}
+for bmap in `sed 's/[{}"]//g' /tmp/auto_bridge_add | tr "," "\n"`
+do
+ bridge=${bmap%:*}
+ iface=${bmap#*:}
+ ovs-vsctl --no-wait --may-exist add-br $bridge
+ if [ -n "$iface" ] && [ "$iface" != "null" ]
+ then
+ ovs-vsctl --no-wait --may-exist add-port $bridge $iface
+ fi
+done
tunnel_interface="{{- .Values.network.interface.tunnel -}}"
if [ -z "${tunnel_interface}" ] ; then
diff --git a/neutron/templates/configmap-etc.yaml b/neutron/templates/configmap-etc.yaml
index 027602b..4ee5774 100644
--- a/neutron/templates/configmap-etc.yaml
+++ b/neutron/templates/configmap-etc.yaml
@@ -196,6 +196,7 @@ data:
dnsmasq.conf: ""
neutron_sudoers: {{ $envAll.Values.conf.neutron_sudoers | b64enc }}
rootwrap.conf: {{ $envAll.Values.conf.rootwrap | b64enc }}
+ auto_bridge_add: {{ toJson $envAll.Values.conf.auto_bridge_add | b64enc }}
{{- range $key, $value := $envAll.Values.conf.rootwrap_filters }}
{{- $filePrefix := replace "_" "-" $key }}
{{ printf "%s.filters" $filePrefix }}: {{ $value.content | b64enc }}
diff --git a/neutron/templates/daemonset-lb-agent.yaml b/neutron/templates/daemonset-lb-agent.yaml
index 1c7da46..c2b432f 100644
--- a/neutron/templates/daemonset-lb-agent.yaml
+++ b/neutron/templates/daemonset-lb-agent.yaml
@@ -112,6 +112,10 @@ spec:
subPath: neutron_sudoers
readOnly: true
- name: neutron-etc
+ mountPath: /tmp/auto_bridge_add
+ subPath: auto_bridge_add
+ readOnly: true
+ - name: neutron-etc
mountPath: /etc/neutron/rootwrap.conf
subPath: rootwrap.conf
readOnly: true
diff --git a/neutron/templates/daemonset-ovs-agent.yaml b/neutron/templates/daemonset-ovs-agent.yaml
index e17693f..2e66844 100644
--- a/neutron/templates/daemonset-ovs-agent.yaml
+++ b/neutron/templates/daemonset-ovs-agent.yaml
@@ -122,6 +122,10 @@ spec:
subPath: neutron_sudoers
readOnly: true
- name: neutron-etc
+ mountPath: /tmp/auto_bridge_add
+ subPath: auto_bridge_add
+ readOnly: true
+ - name: neutron-etc
mountPath: /etc/neutron/rootwrap.conf
subPath: rootwrap.conf
readOnly: true
diff --git a/neutron/values.yaml b/neutron/values.yaml
index a366dee..cf56ac5 100644
--- a/neutron/values.yaml
+++ b/neutron/values.yaml
@@ -90,18 +90,6 @@ network:
# allowing agents to be restarted without packet loss and simpler
# debugging. This feature requires mount propagation support.
share_namespaces: true
- # auto_bridge_add is a table of "bridge: interface" pairs
- # To automatically add a physical interfaces to a specific bridges,
- # for example eth3 to bridge br-physnet1, if0 to br0 and iface_two
- # to br1 do something like:
- #
- # auto_bridge_add:
- # br-physnet1: eth3
- # br0: if0
- # br1: iface_two
- # br-ex will be added by default
- auto_bridge_add:
- br-ex: null
interface:
# Tunnel interface will be used for VXLAN tunneling. If null
# (default) there is a fallback mechanism to search for interface
@@ -1632,13 +1620,25 @@ conf:
priority: 0
apply-to: all
pattern: '(notifications)\.'
+ ## NOTE: "besteffort" is meant for dev env with mixed compute type only.
+ ## This helps prevent sriov init script from failing due to mis-matched NIC
+ ## For prod env, target NIC should match and init script should fail otherwise.
+ ## sriov_init:
+ ## - besteffort
sriov_init:
-
- ## NOTE: "besteffort" is meant for dev env with mixed compute type only.
- ## This helps prevent sriov init script from failing due to mis-matched NIC
- ## For prod env, target NIC should match and init script should fail otherwise.
- ## sriov_init:
- ## - besteffort
+ # auto_bridge_add is a table of "bridge: interface" pairs
+ # To automatically add a physical interfaces to a specific bridges,
+ # for example eth3 to bridge br-physnet1, if0 to br0 and iface_two
+ # to br1 do something like:
+ #
+ # auto_bridge_add:
+ # br-physnet1: eth3
+ # br0: if0
+ # br1: iface_two
+ # br-ex will be added by default
+ auto_bridge_add:
+ br-ex: null
# Names of secrets used by bootstrap and environmental checks
secrets:
--
2.7.4