]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Deprecate enable_tunneling in the OVS agent
authorKyle Mestery <kmestery@cisco.com>
Thu, 27 Jun 2013 11:28:51 +0000 (11:28 +0000)
committerKyle Mestery <kmestery@cisco.com>
Fri, 28 Jun 2013 08:07:50 +0000 (08:07 +0000)
This patch properly deprecates the 'enable_tunneling' option in the OVS agent.
It does this be ignoring it if 'tunnel_types' is set, and if 'enable_tunneling'
is set, it defaults 'tunnel_types' to only GRE.

Fixes bug 1195374

Change-Id: I27fe6b930541a514fc51d3a6669347e52db8cb46

etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini
quantum/plugins/openvswitch/agent/ovs_quantum_agent.py
quantum/tests/unit/openvswitch/test_ovs_quantum_agent.py

index b18da65a094a26bc18e753d2ec308ff370ebe5ac..1660a7b34ac46e6ce3a72abe78cc69d106c26dff 100644 (file)
 # for GRE or VXLAN networks. Requires kernel support for OVS patch ports and
 # GRE or VXLAN tunneling.
 #
+# WARNING: This option will be deprecated in the Icehouse release, and will
+#          be replaced by specifying one or more 'tunnel_types' in the
+#          "agent" section of the configuration file below.
+#
 # enable_tunneling = False
 
 # (ListOpt) Comma-separated list of <tun_min>:<tun_max> tuples
index 05750e44576c78037e2dcb284d620a7712d7433b..377b444088913589e3777d6149203b71ec283755 100644 (file)
@@ -810,6 +810,10 @@ def create_agent_config_map(config):
         tunnel_type=config.AGENT.tunnel_type,
     )
 
+    # If enable_tunneling is TRUE, set tunnel_type to default to GRE
+    if config.OVS.enable_tunneling and not kwargs['tunnel_type']:
+        kwargs['tunnel_type'] = constants.TYPE_GRE
+
     if kwargs['tunnel_type'] in constants.TUNNEL_NETWORK_TYPES:
         if not kwargs['local_ip']:
             msg = _('Tunneling cannot be enabled without a valid local_ip.')
index 938794476eda1195029618478ce616677c376923..6d1a995ba7c25082006d51055b192e0a1b9dd79b 100644 (file)
@@ -39,10 +39,26 @@ class CreateAgentConfigMap(base.BaseTestCase):
         self.assertTrue(ovs_quantum_agent.create_agent_config_map(cfg.CONF))
 
     def test_create_agent_config_map_fails_for_invalid_tunnel_config(self):
+        self.addCleanup(cfg.CONF.reset)
+        # An ip address is required for tunneling but there is no default
+        cfg.CONF.set_override('tunnel_type', constants.TYPE_GRE,
+                              group='AGENT')
+        with testtools.ExpectedException(ValueError):
+            ovs_quantum_agent.create_agent_config_map(cfg.CONF)
+
+    def test_create_agent_config_map_enable_tunneling(self):
+        self.addCleanup(cfg.CONF.reset)
+        # Verify setting only enable_tunneling will default tunnel_type to GRE
+        cfg.CONF.set_override('tunnel_type', None, group='AGENT')
+        cfg.CONF.set_override('enable_tunneling', True, group='OVS')
+        cfg.CONF.set_override('local_ip', '10.10.10.10', group='OVS')
+        cfgmap = ovs_quantum_agent.create_agent_config_map(cfg.CONF)
+        self.assertEqual(cfgmap['tunnel_type'], constants.TYPE_GRE)
+
+    def test_create_agent_config_map_fails_no_local_ip(self):
         self.addCleanup(cfg.CONF.reset)
         # An ip address is required for tunneling but there is no default
         cfg.CONF.set_override('enable_tunneling', True, group='OVS')
-        cfg.CONF.set_override('tunnel_type', 'gre', group='AGENT')
         with testtools.ExpectedException(ValueError):
             ovs_quantum_agent.create_agent_config_map(cfg.CONF)