Support working with neutron host-routes.

If there is a neutron host-route for metadata, we shouldn't try to
replace the metadata route - instead just change the default route.

Change-Id: I27ab5057b32fcab00e4465913f03336125cbd665
This commit is contained in:
Robert Collins 2013-10-14 16:05:24 +13:00
parent 2b2aa7cb88
commit 98d3195d2d
2 changed files with 9 additions and 4 deletions

View File

@ -27,6 +27,6 @@ os-collect-config configuration.
Once the public interface is configured, public\_interface\_route (if set)
will replace the default route's next hop. The hop this replaces will be
added as the next hop for 169.254.169.254/32.
added as the next hop for 169.254.169.254/32 (unless one already exists).
This permits routing default traffic out through a hardware router without
breaking the ability to contact a bare metal metadata server.

View File

@ -26,8 +26,10 @@
# - an ip addresses on public_interface are moved onto physical_bridge.
#
# If public_interface_route is set then the current default route is
# specialised to a 169.254.169.254/32 only route and a default route via
# public_interface_route is added on the public interface.
# specialised to a 169.254.169.254/32 only route (unless there is already a
# 169.254.169.254 route - such as a neutron network with host routes can
# create) and a default route via public_interface_route is added on the public
# interface.
#
# Note that no persistent config file is written to the OS : ovs-vsctl modifies
# a persistent database so the bridge device will persist across reboots, but
@ -117,7 +119,10 @@ if [ -n "$PHYSICAL_INTERFACE" ] ; then
if [ -n "$PUBLIC_INTERFACE_ROUTE" ]; then
DEFAULT_VIA=$(ip route show | awk '/default / { print $3 }')
if [ "$DEFAULT_VIA" != "$PUBLIC_INTERFACE_ROUTE" ]; then
ip route add 169.254.169.254/32 via $DEFAULT_VIA
if [ -z "$(ip route show 169.254.169.254)" ]; then
# No explicit route to 169.254.169.254 - set one.
ip route add 169.254.169.254/32 via $DEFAULT_VIA
fi
ip route prepend dev $EXTERNAL_BRIDGE default via $PUBLIC_INTERFACE_ROUTE
ip route del default via $DEFAULT_VIA
fi