]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Revert "Revert "ovs-agent: Ensure integration bridge is created""
authorKevin Benton <blak111@gmail.com>
Thu, 19 Jun 2014 06:39:30 +0000 (23:39 -0700)
committerKevin Benton <blak111@gmail.com>
Wed, 25 Jun 2014 12:25:31 +0000 (05:25 -0700)
This reverts commit ccaad827b2bdcdcf4b538c5d5367f14cfc22c08f
that reverted e5cdad90f97d3a54a493eca19e7a3ff643426de1, which
was not the real cause of the problem the revert intended to fix.
Once this patch is back, change-id
I6381e3fee49910127c420dd2e3205c64cdb9e185 should fix the actual bug.

Change-Id: I4116bbb61aaf279d6d63a474134d47d97fe806f7

neutron/plugins/openvswitch/agent/ovs_neutron_agent.py
neutron/tests/unit/openvswitch/test_ovs_neutron_agent.py
neutron/tests/unit/openvswitch/test_ovs_tunnel.py

index ccc5ff246ac0fd3c1536a653605b7127de0ea450..085147a72b70b921a9558286b64d752591c4ffe4 100644 (file)
@@ -178,11 +178,11 @@ class OVSNeutronAgent(n_rpc.RpcCallback,
         self.int_br_device_count = 0
 
         self.int_br = ovs_lib.OVSBridge(integ_br, self.root_helper)
+        self.setup_integration_br()
         self.int_br.set_secure_mode()
         # Stores port update notifications for processing in main rpc loop
         self.updated_ports = set()
         self.setup_rpc()
-        self.setup_integration_br()
         self.bridge_mappings = bridge_mappings
         self.setup_physical_bridges(self.bridge_mappings)
         self.local_vlan_map = {}
@@ -723,6 +723,12 @@ class OVSNeutronAgent(n_rpc.RpcCallback,
         :param bridge_name: the name of the integration bridge.
         :returns: the integration bridge
         '''
+        # Ensure the integration bridge is created.
+        # ovs_lib.OVSBridge.create() will run
+        #   ovs-vsctl -- --may-exist add-br BRIDGE_NAME
+        # which does nothing if bridge already exists.
+        self.int_br.create()
+
         self.int_br.delete_port(cfg.CONF.OVS.int_peer_patch_port)
         self.int_br.remove_all_flows()
         # switch all traffic using L2 learning
index df49b3ce712d9c5566553451eea9f762b281e1f1..cad247c023e726d0da39b6a1e26d7cd4e35f8d98 100644 (file)
@@ -116,6 +116,8 @@ class TestOvsNeutronAgent(base.BaseTestCase):
             mock.patch('neutron.plugins.openvswitch.agent.ovs_neutron_agent.'
                        'OVSNeutronAgent.setup_ancillary_bridges',
                        return_value=[]),
+            mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
+                       'create'),
             mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
                        'set_secure_mode'),
             mock.patch('neutron.agent.linux.ovs_lib.OVSBridge.'
index 4ce7c168f2641242e9db24ad8110e404fbffeaa6..5719eec789792b107a32ef97088d777b0a658404 100644 (file)
@@ -106,12 +106,13 @@ class TunnelTest(base.BaseTestCase):
 
         self.mock_int_bridge = self.ovs_bridges[self.INT_BRIDGE]
         self.mock_int_bridge_expected = [
-            mock.call.set_secure_mode(),
+            mock.call.create(),
             mock.call.delete_port('patch-tun'),
             mock.call.remove_all_flows(),
             mock.call.add_flow(priority=1, actions='normal'),
             mock.call.add_flow(priority=0, table=constants.CANARY_TABLE,
-                               actions='drop')
+                               actions='drop'),
+            mock.call.set_secure_mode(),
         ]
 
         self.mock_map_tun_bridge = self.ovs_bridges[self.MAP_TUN_BRIDGE]