Skip to content

Commit 47f76ac

Browse files
committed
Determine default IPv4 route device only when needed
Sometimes instances don't have an IPv4 default route, so only check for it when we actually need it. In a followup patch we could extend the code to check for an IPv6 default route instead or in addition. Related-Bug: 1902002 Change-Id: Ie6cd241721f6b1f8e030960921a696939b2dab10
1 parent 7de6e0b commit 47f76ac

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/neutron-legacy

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,17 @@ PHYSICAL_NETWORK=${PHYSICAL_NETWORK:-public}
226226
# Example: ``OVS_PHYSICAL_BRIDGE=br-eth1``
227227
OVS_PHYSICAL_BRIDGE=${OVS_PHYSICAL_BRIDGE:-br-ex}
228228

229-
default_route_dev=$(ip route | grep ^default | awk '{print $5}')
230-
die_if_not_set $LINENO default_route_dev "Failure retrieving default route device"
231229
# With the linuxbridge agent, if using VLANs for tenant networks,
232230
# or if using flat or VLAN provider networks, set in ``localrc`` to
233231
# the name of the network interface to use for the physical
234232
# network.
235233
#
236234
# Example: ``LB_PHYSICAL_INTERFACE=eth1``
237-
LB_PHYSICAL_INTERFACE=${LB_PHYSICAL_INTERFACE:-$default_route_dev}
235+
if [[ $Q_AGENT == "linuxbridge" && -z ${LB_PHYSICAL_INTERFACE} ]]; then
236+
default_route_dev=$(ip route | grep ^default | awk '{print $5}')
237+
die_if_not_set $LINENO default_route_dev "Failure retrieving default route device"
238+
LB_PHYSICAL_INTERFACE=$default_route_dev
239+
fi
238240

239241
# When Neutron tunnels are enabled it is needed to specify the
240242
# IP address of the end point in the local server. This IP is set

0 commit comments

Comments
 (0)