Skip to content

Commit 3445715

Browse files
committed
OVS agent: Correct bridge setup ordering
This patch fixes three issues that combined to break tunnel networks. The first issue was the the failure mode was being set on the integration bridge after the canary flow was installed. This immediately wiped out the canary flow. The second problem was that the main loop would sync tunnel networks right before resetting the tunnel bridge when the canary flow was missing. This meant that it would sync all of the tunnels via RPC and then wipe them out. The final issue was that after resetting the tunnel bridge in the main loop, the tunnel_sync variable was not set to True, so the tunnels would never be resynchronized. This patch addresses the three issues in the following ways: 1. Set the failure mode on the bridge before the canary flow is installed. 2. Run the OVS restart logic before the tunnel synchronization. 3. If the restart logic is triggered, set tunnel_sync to True to trigger synchronization. Closes-Bug: #1292105 Change-Id: I6381e3fee49910127c420dd2e3205c64cdb9e185
1 parent b3063ed commit 3445715

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

neutron/plugins/openvswitch/agent/ovs_neutron_agent.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ def __init__(self, integ_br, tun_br, local_ip,
179179

180180
self.int_br = ovs_lib.OVSBridge(integ_br, self.root_helper)
181181
self.setup_integration_br()
182-
self.int_br.set_secure_mode()
183182
# Stores port update notifications for processing in main rpc loop
184183
self.updated_ports = set()
185184
self.setup_rpc()
@@ -728,6 +727,7 @@ def setup_integration_br(self):
728727
# ovs-vsctl -- --may-exist add-br BRIDGE_NAME
729728
# which does nothing if bridge already exists.
730729
self.int_br.create()
730+
self.int_br.set_secure_mode()
731731

732732
self.int_br.delete_port(cfg.CONF.OVS.int_peer_patch_port)
733733
self.int_br.remove_all_flows()
@@ -1334,6 +1334,13 @@ def rpc_loop(self, polling_manager=None):
13341334
ancillary_ports.clear()
13351335
sync = False
13361336
polling_manager.force_polling()
1337+
ovs_restarted = self.check_ovs_restart()
1338+
if ovs_restarted:
1339+
self.setup_integration_br()
1340+
self.setup_physical_bridges(self.bridge_mappings)
1341+
if self.enable_tunneling:
1342+
self.setup_tunnel_br()
1343+
tunnel_sync = True
13371344
# Notify the plugin of tunnel IP
13381345
if self.enable_tunneling and tunnel_sync:
13391346
LOG.info(_("Agent tunnel out of sync with plugin!"))
@@ -1342,12 +1349,6 @@ def rpc_loop(self, polling_manager=None):
13421349
except Exception:
13431350
LOG.exception(_("Error while synchronizing tunnels"))
13441351
tunnel_sync = True
1345-
ovs_restarted = self.check_ovs_restart()
1346-
if ovs_restarted:
1347-
self.setup_integration_br()
1348-
self.setup_physical_bridges(self.bridge_mappings)
1349-
if self.enable_tunneling:
1350-
self.setup_tunnel_br()
13511352
if self._agent_has_updates(polling_manager) or ovs_restarted:
13521353
try:
13531354
LOG.debug(_("Agent rpc_loop - iteration:%(iter_num)d - "

neutron/tests/unit/openvswitch/test_ovs_tunnel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ def setUp(self):
107107
self.mock_int_bridge = self.ovs_bridges[self.INT_BRIDGE]
108108
self.mock_int_bridge_expected = [
109109
mock.call.create(),
110+
mock.call.set_secure_mode(),
110111
mock.call.delete_port('patch-tun'),
111112
mock.call.remove_all_flows(),
112113
mock.call.add_flow(priority=1, actions='normal'),
113114
mock.call.add_flow(priority=0, table=constants.CANARY_TABLE,
114115
actions='drop'),
115-
mock.call.set_secure_mode(),
116116
]
117117

118118
self.mock_map_tun_bridge = self.ovs_bridges[self.MAP_TUN_BRIDGE]

0 commit comments

Comments
 (0)