Skip to content

Commit b1a89eb

Browse files
committed
Configure access to physical network also with ML2/OVN backend
Neutron L3 module in Devstack has way to conigure access to physical network on the node. It can put physical interface to the physical bridge or, in case when such physical device isn't set, it creates NAT rule in iptables. There was missing the same operation for ML2/OVN backend as L3 agent is not used there at all. This patch adds the same to be done in both L3 agent and ovn_agent modules. Closes-Bug: #1939627 Change-Id: I9e558d1d5d3edbce9e7a025ba3c11267f1579820
1 parent ab2a529 commit b1a89eb

3 files changed

Lines changed: 23 additions & 15 deletions

File tree

lib/neutron-legacy

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,27 @@ function _move_neutron_addresses_route {
663663
fi
664664
}
665665

666+
# _configure_public_network_connectivity() - Configures connectivity to the
667+
# external network using $PUBLIC_INTERFACE or NAT on the single interface
668+
# machines
669+
function _configure_public_network_connectivity {
670+
# If we've given a PUBLIC_INTERFACE to take over, then we assume
671+
# that we can own the whole thing, and privot it into the OVS
672+
# bridge. If we are not, we're probably on a single interface
673+
# machine, and we just setup NAT so that fixed guests can get out.
674+
if [[ -n "$PUBLIC_INTERFACE" ]]; then
675+
_move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True False "inet"
676+
677+
if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then
678+
_move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False False "inet6"
679+
fi
680+
else
681+
for d in $default_v4_route_devs; do
682+
sudo iptables -t nat -A POSTROUTING -o $d -s $FLOATING_RANGE -j MASQUERADE
683+
done
684+
fi
685+
}
686+
666687
# cleanup_mutnauq() - Remove residual data files, anything left over from previous
667688
# runs that a clean run would need to clean up
668689
function cleanup_mutnauq {

lib/neutron_plugins/ovn_agent

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ function create_public_bridge {
266266
# Create the public bridge that OVN will use
267267
sudo ovs-vsctl --may-exist add-br $PUBLIC_BRIDGE -- set bridge $PUBLIC_BRIDGE protocols=OpenFlow13,OpenFlow15
268268
sudo ovs-vsctl set open . external-ids:ovn-bridge-mappings=$PHYSICAL_NETWORK:$PUBLIC_BRIDGE
269+
_configure_public_network_connectivity
269270
}
270271

271272
function _disable_libvirt_apparmor {

lib/neutron_plugins/services/l3

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,7 @@ function _configure_neutron_l3_agent {
123123

124124
neutron_plugin_configure_l3_agent $Q_L3_CONF_FILE
125125

126-
# If we've given a PUBLIC_INTERFACE to take over, then we assume
127-
# that we can own the whole thing, and privot it into the OVS
128-
# bridge. If we are not, we're probably on a single interface
129-
# machine, and we just setup NAT so that fixed guests can get out.
130-
if [[ -n "$PUBLIC_INTERFACE" ]]; then
131-
_move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" True False "inet"
132-
133-
if [[ $(ip -f inet6 a s dev "$PUBLIC_INTERFACE" | grep -c 'global') != 0 ]]; then
134-
_move_neutron_addresses_route "$PUBLIC_INTERFACE" "$OVS_PHYSICAL_BRIDGE" False False "inet6"
135-
fi
136-
else
137-
for d in $default_v4_route_devs; do
138-
sudo iptables -t nat -A POSTROUTING -o $d -s $FLOATING_RANGE -j MASQUERADE
139-
done
140-
fi
126+
_configure_public_network_connectivity
141127
}
142128

143129
# Explicitly set router id in l3 agent configuration

0 commit comments

Comments
 (0)