Merge "Deprecate enable_tunneling in the OVS agent"

This commit is contained in:
Jenkins 2013-06-29 02:29:09 +00:00 committed by Gerrit Code Review
commit 6ef206d25d
3 changed files with 25 additions and 1 deletions

View File

@ -26,6 +26,10 @@
# for GRE or VXLAN networks. Requires kernel support for OVS patch ports and # for GRE or VXLAN networks. Requires kernel support for OVS patch ports and
# GRE or VXLAN tunneling. # 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 # enable_tunneling = False
# (ListOpt) Comma-separated list of <tun_min>:<tun_max> tuples # (ListOpt) Comma-separated list of <tun_min>:<tun_max> tuples

View File

@ -810,6 +810,10 @@ def create_agent_config_map(config):
tunnel_type=config.AGENT.tunnel_type, 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 kwargs['tunnel_type'] in constants.TUNNEL_NETWORK_TYPES:
if not kwargs['local_ip']: if not kwargs['local_ip']:
msg = _('Tunneling cannot be enabled without a valid local_ip.') msg = _('Tunneling cannot be enabled without a valid local_ip.')

View File

@ -39,10 +39,26 @@ class CreateAgentConfigMap(base.BaseTestCase):
self.assertTrue(ovs_quantum_agent.create_agent_config_map(cfg.CONF)) self.assertTrue(ovs_quantum_agent.create_agent_config_map(cfg.CONF))
def test_create_agent_config_map_fails_for_invalid_tunnel_config(self): 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) self.addCleanup(cfg.CONF.reset)
# An ip address is required for tunneling but there is no default # 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('enable_tunneling', True, group='OVS')
cfg.CONF.set_override('tunnel_type', 'gre', group='AGENT')
with testtools.ExpectedException(ValueError): with testtools.ExpectedException(ValueError):
ovs_quantum_agent.create_agent_config_map(cfg.CONF) ovs_quantum_agent.create_agent_config_map(cfg.CONF)