From 3f6dddf80b8e112688ffad0c2ccf86227bc79f47 Mon Sep 17 00:00:00 2001 From: Lukas Bezdicka Date: Mon, 25 Jan 2016 18:43:55 +0100 Subject: [PATCH] Add ensure_*aas_package booleans for ::neutron::server In case of installation of neutron API service on standalone node while having enabled FWaaS, VPNaaS or LBaaS as service plugins one has to install their packages otherwise the neutron service will fail to start. Change-Id: Id2064026c5ab1b52f3e16043d2f231e66ed4113e Closes-Bug: 1474961 --- manifests/agents/vpnaas.pp | 12 ++--- manifests/server.pp | 68 +++++++++++++++++++++++++++++ spec/classes/neutron_server_spec.rb | 15 +++++++ 3 files changed, 89 insertions(+), 6 deletions(-) diff --git a/manifests/agents/vpnaas.pp b/manifests/agents/vpnaas.pp index 0c83841eb..1dcaa08d5 100644 --- a/manifests/agents/vpnaas.pp +++ b/manifests/agents/vpnaas.pp @@ -102,12 +102,12 @@ class neutron::agents::vpnaas ( } if $::neutron::params::vpnaas_agent_package { - Package['neutron'] -> Package['neutron-vpnaas-agent'] - package { 'neutron-vpnaas-agent': - ensure => $package_ensure, - name => $::neutron::params::vpnaas_agent_package, - tag => ['openstack', 'neutron-package'], - } + Package['neutron'] -> Package['neutron-vpnaas-agent'] + ensure_resource( 'package', 'neutron-vpnaas-agent', { + 'ensure' => $package_ensure, + 'name' => $::neutron::params::vpnaas_agent_package, + 'tag' => ['openstack', 'neutron-package'], + }) } if $manage_service { diff --git a/manifests/server.pp b/manifests/server.pp index f738c3339..d2e82a9f5 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -199,6 +199,26 @@ # (optional) Drivers list to use to send the update notification # Defaults to $::os_service_default. # +# [*ensure_vpnaas_package*] +# (optional) Ensures installation of VPNaaS package before starting API service. +# Set to true to ensure installation of the package that is required to start neutron service if service_plugin is enabled. +# Defaults to false. +# +# [*ensure_fwaas_package*] +# (optional) Ensures installation of FWaaS package before starting API service. +# Set to true to ensure installation of the package that is required to start neutron service if service_plugin is enabled. +# Defaults to false. +# +# [*ensure_lbaas_package*] +# (optional) Ensures installation of LBaaS package before starting API service. +# Set to true to ensure installation of the package that is required to start neutron service if service_plugin is enabled. +# Defaults to false. +# +# [*vpnaas_agent_package*] +# (optional) Use VPNaaS agent package instead of L3 agent package on debian platforms +# RedHat platforms won't take care of this parameter +# true/false +# Defaults to false # === Deprecated Parameters # # [*identity_uri*] @@ -262,6 +282,10 @@ class neutron::server ( $min_l3_agents_per_router = 2, $l3_ha_net_cidr = $::os_service_default, $qos_notification_drivers = $::os_service_default, + $ensure_vpnaas_package = false, + $ensure_fwaas_package = false, + $ensure_lbaas_package = false, + $vpnaas_agent_package = false, # DEPRECATED PARAMETERS $log_dir = undef, $log_file = undef, @@ -278,6 +302,50 @@ class neutron::server ( include ::neutron::db include ::neutron::policy + if $ensure_fwaas_package { + if ($::osfamily == 'Debian') { + # Debian platforms + if $vpnaas_agent_package { + ensure_resource( 'package', $::neutron::params::vpnaas_agent_package, { + 'ensure' => $neutron::package_ensure, + 'tag' => ['openstack', 'neutron-package'], + }) + Package[$::neutron::params::vpnaas_agent_package] -> Neutron_fwaas_service_config<||> + } else { + ensure_resource( 'package', 'neutron-fwaas' , { + 'name' => $::neutron::params::fwaas_package, + 'ensure' => $neutron::package_ensure, + 'tag' => ['openstack', 'neutron-package'], + }) + } + } elsif($::osfamily == 'Redhat') { + # RH platforms + ensure_resource( 'package', 'neutron-fwaas', { + 'name' => $::neutron::params::fwaas_package, + 'ensure' => $neutron::package_ensure, + 'tag' => ['openstack', 'neutron-package'], + }) + } + } + + if $ensure_vpnaas_package { + ensure_resource( 'package', 'neutron-vpnaas-agent', { + 'ensure' => $package_ensure, + 'name' => $::neutron::params::vpnaas_agent_package, + 'tag' => ['openstack', 'neutron-package'], + }) + } + + if $ensure_lbaas_package { + ensure_resource( 'package', 'neutron-lbaas-agent', { + 'ensure' => $package_ensure, + 'name' => $::neutron::params::lbaas_agent_package, + 'tag' => ['openstack', 'neutron-package'], + }) + } + + + Neutron_config<||> ~> Service['neutron-server'] Neutron_api_config<||> ~> Service['neutron-server'] Class['neutron::policy'] ~> Service['neutron-server'] diff --git a/spec/classes/neutron_server_spec.rb b/spec/classes/neutron_server_spec.rb index 2ee0af9a4..5346ad4ff 100644 --- a/spec/classes/neutron_server_spec.rb +++ b/spec/classes/neutron_server_spec.rb @@ -235,6 +235,21 @@ describe 'neutron::server' do end end + shared_examples_for 'VPNaaS, FWaaS and LBaaS package installation' do + before do + params.merge!( + :ensure_vpnaas_package => true, + :ensure_fwaas_package => true, + :ensure_lbaas_package => true + ) + end + it 'should install *aaS packages' do + is_expected.to contain_package('neutron-lbaas-agent') + is_expected.to contain_package('neutron-fwaas') + is_expected.to contain_package('neutron-vpnaas-agent') + end + end + shared_examples_for 'a neutron server without database synchronization' do before do params.merge!(