Merge "Make sure datapath_type is updated on bridges changed"
[openstack-build/neutron-build.git] / neutron / plugins / ml2 / drivers / openvswitch / agent / ovs_neutron_agent.py
index ff7c71bf28b3aaf86bfc0956326c62351ec32961..6231559c09e259c984b86a4ddfe86d02df53f541 100644 (file)
@@ -1003,8 +1003,9 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
             self.tun_br = self.br_tun_cls(tun_br_name)
         self.tun_br.set_agent_uuid_stamp(self.agent_uuid_stamp)
 
-        if not self.tun_br.bridge_exists(self.tun_br.br_name):
-            self.tun_br.create(secure_mode=True)
+        # tun_br.create() won't recreate bridge if it exists, but will handle
+        # cases where something like datapath_type has changed
+        self.tun_br.create(secure_mode=True)
         self.tun_br.setup_controllers(self.conf)
         if (not self.int_br.port_exists(self.conf.OVS.int_peer_patch_port) or
                 self.patch_tun_ofport == ovs_lib.INVALID_OFPORT):
@@ -1062,6 +1063,9 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
                            'bridge': bridge})
                 sys.exit(1)
             br = self.br_phys_cls(bridge)
+            # The bridge already exists, so create won't recreate it, but will
+            # handle things like changing the datapath_type
+            br.create()
             br.setup_controllers(self.conf)
             br.setup_default_table()
             self.phys_brs[physical_network] = br