Browse Source

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

changes/12/663712/3
Zuul 4 weeks ago
parent
commit
ccb850e6a9

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

@@ -178,7 +178,6 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
178 178
         self.network_ports = collections.defaultdict(set)
179 179
         # keeps association between ports and ofports to detect ofport change
180 180
         self.vifname_to_ofport_map = {}
181
-        self.setup_rpc()
182 181
         # Stores newly created bridges
183 182
         self.added_bridges = list()
184 183
         self.bridge_mappings = self._parse_bridge_mappings(
@@ -212,6 +211,8 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
212 211
             self.setup_tunnel_br(ovs_conf.tunnel_bridge)
213 212
             self.setup_tunnel_br_flows()
214 213
 
214
+        self.setup_rpc()
215
+
215 216
         agent_api = ovs_ext_api.OVSAgentExtensionAPI(self.int_br, self.tun_br)
216 217
         self.ext_manager.initialize(
217 218
             self.connection, constants.EXTENSION_DRIVER_TYPE, agent_api)

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

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

Loading…
Cancel
Save