From 4ed7de8f715fbda77fee7fc05deebcdc78ab7e0a Mon Sep 17 00:00:00 2001 From: Artur Korzeniewski Date: Fri, 8 Sep 2017 09:38:05 +0200 Subject: [PATCH] Neutron: fix reg exp for finding default tunneling interface Grep the output from 'ip route' command matching first word after match. The OVS was fixed some time ago, but in new linuxbridge the default tunnel interface was following wrong grep expression. Making both OVS and linuxbridge to follow the same reg exp. Change-Id: I222d694b06285d5ec3d848ee157542796dfc1cc7 Closes-Bug: #1700323 --- neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl | 2 +- neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl | 2 +- 2 files changed, 2 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 179c669063..33e7b4a518 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 r | grep default | grep -oP '(?<=dev ).*') || exit 1 + tunnel_interface=$(ip route list 0/0 | grep -oP '(?<=dev\s)\w+') || 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 20f515832d..609dd23ac4 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -32,7 +32,7 @@ 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 | awk '/^default/ { print $5 }' | head -1 ) + tunnel_interface=$(ip route list 0/0 | grep -oP '(?<=dev\s)\w+') fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null