diff --git a/hooks/neutron_api_hooks.py b/hooks/neutron_api_hooks.py index 4fdf20cd..aa74e8ac 100755 --- a/hooks/neutron_api_hooks.py +++ b/hooks/neutron_api_hooks.py @@ -104,7 +104,8 @@ def install(): execd_preinstall() configure_installation_source(config('openstack-origin')) apt_update() - apt_install(determine_packages(), fatal=True) + apt_install(determine_packages(config('openstack-origin')), + fatal=True) [open_port(port) for port in determine_ports()] @@ -112,7 +113,8 @@ def install(): @hooks.hook('config-changed') @restart_on_change(restart_map(), stopstart=True) def config_changed(): - apt_install(filter_installed_packages(determine_packages()), + apt_install(filter_installed_packages( + determine_packages(config('openstack-origin'))), fatal=True) if config('prefer-ipv6'): setup_ipv6() diff --git a/hooks/neutron_api_utils.py b/hooks/neutron_api_utils.py index 17ee02d9..6d5155d8 100644 --- a/hooks/neutron_api_utils.py +++ b/hooks/neutron_api_utils.py @@ -45,6 +45,12 @@ BASE_PACKAGES = [ 'uuid', ] +KILO_PACKAGES = [ + 'python-neutron-lbaas', + 'python-neutron-fwaas', + 'python-neutron-vpnaas', +] + BASE_SERVICES = [ 'neutron-server' ] @@ -100,7 +106,7 @@ def api_port(service): return API_PORTS[service] -def determine_packages(): +def determine_packages(source=None): # currently all packages match service names packages = [] + BASE_PACKAGES for v in resource_map().values(): @@ -109,6 +115,8 @@ def determine_packages(): 'server_packages', 'neutron') packages.extend(pkgs) + if get_os_codename_install_source(source) >= 'kilo': + packages.extend(KILO_PACKAGES) return list(set(packages)) @@ -208,7 +216,7 @@ def do_openstack_upgrade(configs): ] apt_update(fatal=True) apt_upgrade(options=dpkg_opts, fatal=True, dist=True) - pkgs = determine_packages() + pkgs = determine_packages(new_os_rel) # Sort packages just to make unit tests easier pkgs.sort() apt_install(packages=pkgs, diff --git a/templates/kilo/neutron.conf b/templates/kilo/neutron.conf new file mode 100644 index 00000000..bd1f9c12 --- /dev/null +++ b/templates/kilo/neutron.conf @@ -0,0 +1,77 @@ +############################################################################### +# [ WARNING ] +# Configuration file maintained by Juju. Local changes may be overwritten. +## Restart trigger {{ restart_trigger }} +############################################################################### +[DEFAULT] +verbose = {{ verbose }} +debug = {{ debug }} +use_syslog = {{ use_syslog }} +state_path = /var/lib/neutron +lock_path = $state_path/lock +bind_host = {{ bind_host }} +auth_strategy = keystone +notification_driver = neutron.openstack.common.notifier.rpc_notifier +api_workers = {{ workers }} +rpc_workers = {{ workers }} + +{% if neutron_bind_port -%} +bind_port = {{ neutron_bind_port }} +{% else -%} +bind_port = 9696 +{% endif -%} + +{% if core_plugin -%} +core_plugin = {{ core_plugin }} +{% if neutron_plugin in ['ovs', 'ml2'] -%} +service_plugins = router,firewall,lbaas,vpnaas,metering +{% endif -%} +{% endif -%} + +{% if neutron_security_groups -%} +allow_overlapping_ips = True +neutron_firewall_driver = neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver +{% endif -%} + +{% include "parts/rabbitmq" %} + +notify_nova_on_port_status_changes = True +notify_nova_on_port_data_changes = True +nova_url = {{ nova_url }} +nova_region_name = {{ region }} +{% if auth_host -%} +nova_admin_username = {{ admin_user }} +nova_admin_tenant_id = {{ admin_tenant_id }} +nova_admin_password = {{ admin_password }} +nova_admin_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0 +{% endif -%} + +[quotas] +quota_driver = neutron.db.quota_db.DbQuotaDriver +{% if neutron_security_groups -%} +quota_items = network,subnet,port,security_group,security_group_rule +{% endif -%} + +[agent] +root_helper = sudo /usr/bin/neutron-rootwrap /etc/neutron/rootwrap.conf + +[keystone_authtoken] +signing_dir = /var/lib/neutron/keystone-signing +{% if service_host -%} +service_protocol = {{ service_protocol }} +service_host = {{ service_host }} +service_port = {{ service_port }} +auth_host = {{ auth_host }} +auth_port = {{ auth_port }} +auth_protocol = {{ auth_protocol }} +admin_tenant_name = {{ admin_tenant_name }} +admin_user = {{ admin_user }} +admin_password = {{ admin_password }} +{% endif -%} + +{% include "parts/section-database" %} + +[service_providers] +service_provider=LOADBALANCER:Haproxy:neutron_lbaas.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default +service_provider=VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default +service_provider=FIREWALL:Iptables:neutron_fwaas.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver:default diff --git a/unit_tests/test_neutron_api_utils.py b/unit_tests/test_neutron_api_utils.py index ba9a096e..9ff7ef45 100644 --- a/unit_tests/test_neutron_api_utils.py +++ b/unit_tests/test_neutron_api_utils.py @@ -1,6 +1,7 @@ from mock import MagicMock, patch from collections import OrderedDict +from copy import deepcopy import charmhelpers.contrib.openstack.templating as templating templating.OSConfigRenderer = MagicMock() @@ -65,10 +66,18 @@ class TestNeutronAPIUtils(CharmTestCase): def test_determine_packages(self): pkg_list = nutils.determine_packages() - expect = nutils.BASE_PACKAGES + expect = deepcopy(nutils.BASE_PACKAGES) expect.extend(['neutron-server', 'neutron-plugin-ml2']) self.assertItemsEqual(pkg_list, expect) + def test_determine_packages_kilo(self): + self.get_os_codename_install_source.return_value = 'kilo' + pkg_list = nutils.determine_packages() + expect = deepcopy(nutils.BASE_PACKAGES) + expect.extend(['neutron-server', 'neutron-plugin-ml2']) + expect.extend(nutils.KILO_PACKAGES) + self.assertItemsEqual(pkg_list, expect) + def test_determine_ports(self): port_list = nutils.determine_ports() self.assertItemsEqual(port_list, [9696]) @@ -169,7 +178,7 @@ class TestNeutronAPIUtils(CharmTestCase): self.apt_upgrade.assert_called_with(options=dpkg_opts, fatal=True, dist=True) - pkgs = nutils.BASE_PACKAGES + pkgs = nutils.determine_packages() pkgs.sort() self.apt_install.assert_called_with(packages=pkgs, options=dpkg_opts,