]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Follow up patch for Validate when DVR enabled, l2_pop is also enabled
authorRomil Gupta <romilg@hp.com>
Mon, 23 Mar 2015 06:38:00 +0000 (23:38 -0700)
committerRomil Gupta <romilg@hp.com>
Thu, 26 Mar 2015 09:38:26 +0000 (02:38 -0700)
Reference:
https://review.openstack.org/#/c/165311/

For a VLAN underlays, DVR does not mandate l2-pop to be turned ON.

So just checking for enable_tunneling and validating for l2-pop being
turned ON is more than sufficient.

Change-Id: I96695dc623b4ea37d3ef1384eb9ac9c1384d3da3
Closes-Bug: #1417633

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

index 9b8aabb725e3b9d1eaad4bcc1b2d0bc017001b09..051cf7a044efc61ebc93a089052a2e38ebb37079 100644 (file)
@@ -180,6 +180,11 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
             'agent_type': q_const.AGENT_TYPE_OVS,
             'start_flag': True}
 
+        if tunnel_types:
+            self.enable_tunneling = True
+        else:
+            self.enable_tunneling = False
+
         # Validate agent configurations
         self._check_agent_configurations()
 
@@ -200,11 +205,6 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
         self.polling_interval = polling_interval
         self.minimize_polling = minimize_polling
         self.ovsdb_monitor_respawn_interval = ovsdb_monitor_respawn_interval
-
-        if tunnel_types:
-            self.enable_tunneling = True
-        else:
-            self.enable_tunneling = False
         self.local_ip = local_ip
         self.tunnel_count = 0
         self.vxlan_udp_port = cfg.CONF.AGENT.vxlan_udp_port
@@ -1556,9 +1556,11 @@ class OVSNeutronAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin,
             rpc_api.client.timeout = timeout
 
     def _check_agent_configurations(self):
-        if self.enable_distributed_routing and not self.l2_pop:
-            raise ValueError(_("DVR cannot be enabled without "
-                               "L2 population."))
+        if (self.enable_distributed_routing and self.enable_tunneling
+            and not self.l2_pop):
+            raise ValueError(_("DVR deployments for VXLAN/GRE underlays "
+                               "require L2-pop to be enabled, in both the "
+                               "Agent and Server side."))
 
 
 def _ofport_set_to_str(ofport_set):
index 1df71fe84a5b0d8c82d01bbca23f47788383a2cd..21314e49194408ff7adfa8d93990b36aa376b5d9 100644 (file)
@@ -167,17 +167,25 @@ class TestOvsNeutronAgent(base.BaseTestCase):
             self.assertFalse(set_ovs_db_func.called)
             self.assertFalse(delete_flows_func.called)
 
-    def test_check_agent_configurations_raises(self):
+    def test_check_agent_configurations_for_dvr_raises(self):
         self.agent.enable_distributed_routing = True
+        self.agent.enable_tunneling = True
         self.agent.l2_pop = False
         self.assertRaises(ValueError,
                           self.agent._check_agent_configurations)
 
-    def test_check_agent_configurations(self):
+    def test_check_agent_configurations_for_dvr(self):
         self.agent.enable_distributed_routing = True
+        self.agent.enable_tunneling = True
         self.agent.l2_pop = True
         self.assertIsNone(self.agent._check_agent_configurations())
 
+    def test_check_agent_configurations_for_dvr_with_vlan(self):
+        self.agent.enable_distributed_routing = True
+        self.agent.enable_tunneling = False
+        self.agent.l2_pop = False
+        self.assertIsNone(self.agent._check_agent_configurations())
+
     def test_port_bound_deletes_flows_for_valid_ofport(self):
         self._mock_port_bound(ofport=1, new_local_vlan=1)