From fed9fb3ca317f0a8ee245cec858ac58b50116c27 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 6 Jul 2018 09:49:22 -0500 Subject: [PATCH] Neutron: check that local ip address is populated on agent startup This PS updates the agent init container scripts to ensure that the local IP address is populated on agent startup. Change-Id: Ib5857d9dc82b1138a1b5f496ebe46dc1e3f221e7 Signed-off-by: Pete Birley --- .../bin/_neutron-linuxbridge-agent-init.sh.tpl | 11 ++++++++--- .../bin/_neutron-openvswitch-agent-init.sh.tpl | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl index 2cfc2e2ac5..e89765a3ed 100644 --- a/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-linuxbridge-agent-init.sh.tpl @@ -41,8 +41,13 @@ if [ -z "${tunnel_interface}" ] ; then fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null -IP=$(ip a s $tunnel_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}') -cat </tmp/pod-shared/ml2-local-ip.ini +LOCAL_IP=$(ip a s $tunnel_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}') +if [ -z "${LOCAL_IP}" ] ; then + echo "Var LOCAL_IP is empty" + exit 1 +fi + +tee > /tmp/pod-shared/ml2-local-ip.ini << EOF [vxlan] -local_ip = $IP +local_ip = "${LOCAL_IP}" EOF diff --git a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl index e150bfb63e..08c82e0503 100644 --- a/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl +++ b/neutron/templates/bin/_neutron-openvswitch-agent-init.sh.tpl @@ -52,8 +52,13 @@ if [ -z "${tunnel_interface}" ] ; then fi # determine local-ip dynamically based on interface provided but only if tunnel_types is not null -IP=$(ip a s $tunnel_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}') -cat </tmp/pod-shared/ml2-local-ip.ini +LOCAL_IP=$(ip a s $tunnel_interface | grep 'inet ' | awk '{print $2}' | awk -F "/" '{print $1}') +if [ -z "${LOCAL_IP}" ] ; then + echo "Var LOCAL_IP is empty" + exit 1 +fi + +tee > /tmp/pod-shared/ml2-local-ip.ini << EOF [ovs] -local_ip = $IP +local_ip = "${LOCAL_IP}" EOF