diff --git a/hooks/neutron_utils.py b/hooks/neutron_utils.py index 04222492..5f11f155 100644 --- a/hooks/neutron_utils.py +++ b/hooks/neutron_utils.py @@ -102,6 +102,8 @@ NEUTRON_OVS_PLUGIN_CONF = \ "/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini" NEUTRON_ML2_PLUGIN_CONF = \ "/etc/neutron/plugins/ml2/ml2_conf.ini" +NEUTRON_OVS_AGENT_CONF = \ + "/etc/neutron/plugins/ml2/openvswitch_agent.ini" NEUTRON_NVP_PLUGIN_CONF = \ "/etc/neutron/plugins/nicira/nvp.ini" NEUTRON_NSX_PLUGIN_CONF = \ @@ -279,6 +281,10 @@ def get_packages(): # Switch out to actual metering agent package packages.remove('neutron-plugin-metering-agent') packages.append('neutron-metering-agent') + if source >= 'mitaka': + # Switch out to actual ovs agent package + packages.remove('neutron-plugin-openvswitch-agent') + packages.append('neutron-openvswitch-agent') packages.extend(determine_l3ha_packages()) if git_install_requested(): @@ -452,6 +458,10 @@ NEUTRON_OVS_CONFIG_FILES = { 'hook_contexts': [NeutronGatewayContext()], 'services': ['neutron-plugin-openvswitch-agent'] }, + NEUTRON_OVS_AGENT_CONF: { + 'hook_contexts': [NeutronGatewayContext()], + 'services': ['neutron-openvswitch-agent'] + }, EXT_PORT_CONF: { 'hook_contexts': [ExternalPortContext()], 'services': ['ext-port'] @@ -567,7 +577,12 @@ CONFIG_FILES = { }, } -SERVICE_RENAMES = {} +SERVICE_RENAMES = { + 'mitaka': { + 'neutron-plugin-openvswitch-agent': 'neutron-openvswitch-agent', + 'neutron-plugin-metering-agent': 'neutron-metering-agent', + } +} def remap_service(service_name): @@ -599,10 +614,16 @@ def resolve_config_files(name, plugin, release): config_files = deepcopy(CONFIG_FILES) if plugin == 'ovs': # NOTE: deal with switch to ML2 plugin for >= icehouse - drop_config = [NEUTRON_ML2_PLUGIN_CONF] + drop_config = [NEUTRON_ML2_PLUGIN_CONF, + NEUTRON_OVS_AGENT_CONF] if release >= 'icehouse': # ovs -> ml2 - drop_config = [NEUTRON_OVS_PLUGIN_CONF] + drop_config = [NEUTRON_OVS_PLUGIN_CONF, + NEUTRON_OVS_AGENT_CONF] + if release >= 'mitaka': + # ml2 -> ovs_agent + drop_config = [NEUTRON_OVS_PLUGIN_CONF, + NEUTRON_ML2_PLUGIN_CONF] for _config in drop_config: if _config in config_files[name][plugin]: @@ -637,11 +658,14 @@ def register_configs(): def stop_services(): + release = get_os_codename_install_source(config('openstack-origin')) + plugin = remap_plugin(config('plugin')) name = networking_name() + config_files = resolve_config_files(name, plugin, release) svcs = set() - for ctxt in CONFIG_FILES[name][config('plugin')].itervalues(): + for ctxt in config_files[name][config('plugin')].itervalues(): for svc in ctxt['services']: - svcs.add(svc) + svcs.add(remap_service(svc)) for svc in svcs: service_stop(svc) diff --git a/templates/mitaka/openvswitch_agent.ini b/templates/mitaka/openvswitch_agent.ini new file mode 100644 index 00000000..499427a5 --- /dev/null +++ b/templates/mitaka/openvswitch_agent.ini @@ -0,0 +1,20 @@ +# mitaka +############################################################################### +# [ WARNING ] +# Configuration file maintained by Juju. Local changes may be overwritten. +############################################################################### +[ovs] +enable_tunneling = True +local_ip = {{ local_ip }} +bridge_mappings = {{ bridge_mappings }} + +[agent] +tunnel_types = {{ overlay_network_type }} +l2_population = {{ l2_population }} +enable_distributed_routing = {{ enable_dvr }} +{% if veth_mtu -%} +veth_mtu = {{ veth_mtu }} +{% endif %} + +[securitygroup] +firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver diff --git a/tests/019-basic-trusty-mitaka b/tests/019-basic-trusty-mitaka old mode 100755 new mode 100644 diff --git a/tests/basic_deployment.py b/tests/basic_deployment.py index caf79c57..4fc4ad10 100644 --- a/tests/basic_deployment.py +++ b/tests/basic_deployment.py @@ -185,6 +185,10 @@ class NeutronGatewayBasicDeployment(OpenStackAmuletDeployment): if self._get_openstack_release() <= self.trusty_juno: neutron_services.append('neutron-vpn-agent') + if self._get_openstack_release() >= self.trusty_mitaka: + # neutron-plugin-openvswitch-agent -> neutron-openvswitch-agent + neutron_services.remove('neutron-plugin-openvswitch-agent') + neutron_services.append('neutron-openvswitch-agent') nova_cc_services = ['nova-api-ec2', 'nova-api-os-compute', diff --git a/unit_tests/test_neutron_utils.py b/unit_tests/test_neutron_utils.py index 70609535..27d8440e 100644 --- a/unit_tests/test_neutron_utils.py +++ b/unit_tests/test_neutron_utils.py @@ -169,6 +169,19 @@ class TestQuantumUtils(CharmTestCase): self.assertFalse('python-mysqldb' in packages) self.assertTrue('python-pymysql' in packages) + @patch.object(neutron_utils, 'git_install_requested') + def test_get_packages_ovs_mitaka(self, git_requested): + git_requested.return_value = False + self.config.return_value = 'ovs' + self.get_os_codename_install_source.return_value = 'mitaka' + packages = neutron_utils.get_packages() + self.assertTrue('neutron-metering-agent' in packages) + self.assertFalse('neutron-plugin-metering-agent' in packages) + self.assertTrue('neutron-openvswitch-agent' in packages) + self.assertFalse('neutron-plugin-openvswitch-agent' in packages) + self.assertFalse('python-mysqldb' in packages) + self.assertTrue('python-pymysql' in packages) + @patch.object(neutron_utils, 'git_install_requested') def test_get_packages_l3ha(self, git_requested): git_requested.return_value = False @@ -355,6 +368,41 @@ class TestQuantumUtils(CharmTestCase): self.assertDictEqual(neutron_utils.restart_map(), ex_map) + def test_restart_map_ovs_mitaka(self): + self.config.return_value = 'ovs' + self.get_os_codename_install_source.return_value = 'mitaka' + ex_map = { + neutron_utils.NEUTRON_CONF: ['neutron-l3-agent', + 'neutron-dhcp-agent', + 'neutron-metadata-agent', + 'neutron-openvswitch-agent', + 'neutron-metering-agent', + 'neutron-lbaas-agent', + 'neutron-plugin-vpn-agent', + 'neutron-vpn-agent'], + neutron_utils.NEUTRON_DNSMASQ_CONF: ['neutron-dhcp-agent'], + neutron_utils.NEUTRON_LBAAS_AGENT_CONF: + ['neutron-lbaas-agent'], + neutron_utils.NEUTRON_OVS_AGENT_CONF: + ['neutron-openvswitch-agent'], + neutron_utils.NEUTRON_METADATA_AGENT_CONF: + ['neutron-metadata-agent'], + neutron_utils.NEUTRON_VPNAAS_AGENT_CONF: [ + 'neutron-plugin-vpn-agent', + 'neutron-vpn-agent'], + neutron_utils.NEUTRON_L3_AGENT_CONF: ['neutron-l3-agent', + 'neutron-vpn-agent'], + neutron_utils.NEUTRON_DHCP_AGENT_CONF: ['neutron-dhcp-agent'], + neutron_utils.NEUTRON_FWAAS_CONF: ['neutron-l3-agent', + 'neutron-vpn-agent'], + neutron_utils.NEUTRON_METERING_AGENT_CONF: + ['neutron-metering-agent'], + neutron_utils.NOVA_CONF: ['nova-api-metadata'], + neutron_utils.EXT_PORT_CONF: ['ext-port'], + neutron_utils.PHY_NIC_MTU_CONF: ['os-charm-phy-nic-mtu'], + } + self.assertEqual(ex_map, neutron_utils.restart_map()) + def test_restart_map_ovs_odl(self): self.config.return_value = 'ovs-odl' self.get_os_codename_install_source.return_value = 'icehouse'