From fc20cbcb4820ebce64af6f12dbf639f6a122d0b4 Mon Sep 17 00:00:00 2001 From: James Page Date: Sat, 3 May 2014 08:31:11 +0100 Subject: [PATCH] Add reverse map for nvp and associated test cases --- hooks/quantum_contexts.py | 3 ++- templates/havana/dhcp_agent.ini | 2 +- unit_tests/test_quantum_contexts.py | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hooks/quantum_contexts.py b/hooks/quantum_contexts.py index 59ef74b6..c8b635aa 100644 --- a/hooks/quantum_contexts.py +++ b/hooks/quantum_contexts.py @@ -78,8 +78,9 @@ def remap_plugin(plugin): ''' Remaps plugin name for renames/switches in packaging ''' release = get_os_codename_install_source(config('openstack-origin')) if plugin == 'nvp' and release >= 'icehouse': - # Remap nvp plugin to nsx for releases >= icehouse plugin = 'nsx' + elif plugin == 'nsx' and release < 'icehouse': + plugin = 'nvp' return plugin diff --git a/templates/havana/dhcp_agent.ini b/templates/havana/dhcp_agent.ini index 85e93864..059b26be 100644 --- a/templates/havana/dhcp_agent.ini +++ b/templates/havana/dhcp_agent.ini @@ -11,7 +11,7 @@ ovs_use_veth = True {% if instance_mtu -%} dnsmasq_config_file = /etc/neutron/dnsmasq.conf {% endif -%} -{% if plugin == 'nvp' -%} +{% if plugin == 'nvp' or plugin == 'nsx' -%} enable_metadata_network = True enable_isolated_metadata = True {% endif -%} diff --git a/unit_tests/test_quantum_contexts.py b/unit_tests/test_quantum_contexts.py index d9e1b086..3a6b48cc 100644 --- a/unit_tests/test_quantum_contexts.py +++ b/unit_tests/test_quantum_contexts.py @@ -308,10 +308,12 @@ class TestMisc(CharmTestCase): def test_remap_plugin(self): self.get_os_codename_install_source.return_value = 'havana' self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nvp') + self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nvp') def test_remap_plugin_icehouse(self): self.get_os_codename_install_source.return_value = 'icehouse' self.assertEquals(quantum_contexts.remap_plugin('nvp'), 'nsx') + self.assertEquals(quantum_contexts.remap_plugin('nsx'), 'nsx') def test_remap_plugin_noop(self): self.get_os_codename_install_source.return_value = 'icehouse'