From e67a8e09bc7ee41b627e1bff2f649081c9b6ef85 Mon Sep 17 00:00:00 2001 From: intlabs Date: Tue, 10 Oct 2017 09:46:07 -0500 Subject: [PATCH] Neutron: Update tunnel interface loaction logic This PS update the logic used to determine the default tunnel interface if one is not specified, as the original method could fail with complex device names. Change-Id: Ifec81f517ee29bef0926779591ab9cf5fe0e63c4 --- neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl | 2 +- neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl index 33e7b4a518..4816c90f01 100644 --- a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl @@ -54,7 +54,7 @@ tunnel_interface="{{- .Values.network.interface.tunnel -}}" if [ -z "${tunnel_interface}" ] ; then # search for interface with default routing # If there is not default gateway, exit - tunnel_interface=$(ip route list 0/0 | grep -oP '(?<=dev\s)\w+') || exit 1 + tunnel_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1 fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index 609dd23ac4..e084043a93 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -32,7 +32,8 @@ timeout 3m neutron-sanity-check --config-file /etc/neutron/neutron.conf --config tunnel_interface="{{- .Values.network.interface.tunnel -}}" if [ -z "${tunnel_interface}" ] ; then # search for interface with default routing - tunnel_interface=$(ip route list 0/0 | grep -oP '(?<=dev\s)\w+') + # If there is not default gateway, exit + tunnel_interface=$(ip -4 route list 0/0 | awk -F 'dev' '{ print $2; exit }' | awk '{ print $1 }') || exit 1 fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null