Browse Source

Merge "Initialize phys bridges before setup_rpc" into stable/stein

changes/97/679197/1
Zuul 1 month ago
parent
commit
5555359776

+ 2
- 1
neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py View File

@@ -186,7 +186,6 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
186 186
         self.network_ports = collections.defaultdict(set)
187 187
         # keeps association between ports and ofports to detect ofport change
188 188
         self.vifname_to_ofport_map = {}
189
-        self.setup_rpc()
190 189
         # Stores newly created bridges
191 190
         self.added_bridges = list()
192 191
         self.bridge_mappings = self._parse_bridge_mappings(
@@ -229,6 +228,8 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
229 228
             self.setup_tunnel_br(ovs_conf.tunnel_bridge)
230 229
             self.setup_tunnel_br_flows()
231 230
 
231
+        self.setup_rpc()
232
+
232 233
         self.dvr_agent = ovs_dvr_neutron_agent.OVSDVRNeutronAgent(
233 234
             self.context,
234 235
             self.dvr_plugin_rpc,

+ 14
- 0
neutron/tests/unit/plugins/ml2/drivers/openvswitch/agent/test_ovs_neutron_agent.py View File

@@ -180,6 +180,20 @@ class TestOvsNeutronAgent(object):
180 180
                 "Port", mock.ANY, "other_config", vlan_mapping)
181 181
             self.assertTrue(needs_binding)
182 182
 
183
+    def test_setup_physical_bridges_during_agent_initialization(self):
184
+        with mock.patch.object(
185
+            self.mod_agent.OVSNeutronAgent,
186
+            'setup_physical_bridges') as setup_physical_bridges,\
187
+                mock.patch.object(
188
+                    self.mod_agent.OVSNeutronAgent, 'setup_rpc') as setup_rpc:
189
+            setup_rpc.side_effect = oslo_messaging.MessagingException(
190
+                "Test communication failure")
191
+            try:
192
+                self._make_agent()
193
+            except oslo_messaging.MessagingException:
194
+                pass
195
+            setup_physical_bridges.assert_called_once_with(mock.ANY)
196
+
183 197
     def test_datapath_type_system(self):
184 198
         # verify kernel datapath is default
185 199
         expected = constants.OVS_DATAPATH_SYSTEM

Loading…
Cancel
Save