Add ensure_lbaas_package to neutron::server

Adds a new parameter ensure_lbaas_package same as for the other
service provider plugins. This can be used to only install the
LBaaS package and not the agents so that the neutron-server can
load the plugin.

Change-Id: I7f074fe3f8d3935d18f640de0d8a256f39ea8b11
This commit is contained in:
Tobias Urdin 2018-08-29 13:44:20 +02:00
parent eb4c4407fb
commit c70e4fa7f2
4 changed files with 58 additions and 3 deletions

View File

@ -86,6 +86,7 @@ class neutron::params {
} }
$libreswan_package = 'libreswan' $libreswan_package = 'libreswan'
$l3_agent_package = false $l3_agent_package = false
$lbaas_package = false
$fwaas_package = 'openstack-neutron-fwaas' $fwaas_package = 'openstack-neutron-fwaas'
$neutron_wsgi_script_path = '/var/www/cgi-bin/neutron' $neutron_wsgi_script_path = '/var/www/cgi-bin/neutron'
$neutron_wsgi_script_source = '/usr/bin/neutron-api' $neutron_wsgi_script_source = '/usr/bin/neutron-api'
@ -105,6 +106,7 @@ class neutron::params {
$rpc_package_name = 'neutron-rpc-server' $rpc_package_name = 'neutron-rpc-server'
$rpc_service_name = 'neutron-rpc-server' $rpc_service_name = 'neutron-rpc-server'
$dynamic_routing_package = 'python3-neutron-dynamic-routing' $dynamic_routing_package = 'python3-neutron-dynamic-routing'
$lbaas_package = 'python3-neutron-lbaas'
} else { } else {
$ml2_server_package = 'neutron-plugin-ml2' $ml2_server_package = 'neutron-plugin-ml2'
$server_service = 'neutron-server' $server_service = 'neutron-server'
@ -114,6 +116,7 @@ class neutron::params {
$rpc_package_name = false $rpc_package_name = false
$rpc_service_name = false $rpc_service_name = false
$dynamic_routing_package = 'python-neutron-dynamic-routing' $dynamic_routing_package = 'python-neutron-dynamic-routing'
$lbaas_package = 'python-neutron-lbaas'
} }
$bgp_dragent_package = 'neutron-bgp-dragent' $bgp_dragent_package = 'neutron-bgp-dragent'
$ovs_agent_package = 'neutron-openvswitch-agent' $ovs_agent_package = 'neutron-openvswitch-agent'

View File

@ -192,6 +192,11 @@
# (Optional) Allow auto scheduling networks to DHCP agent # (Optional) Allow auto scheduling networks to DHCP agent
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
# [*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 lbaasv2 service_plugin is enabled.
# Defaults to false.
#
# [*ensure_vpnaas_package*] # [*ensure_vpnaas_package*]
# (Optional) Ensures installation of VPNaaS package before starting API service. # (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. # Set to true to ensure installation of the package that is required to start neutron service if service_plugin is enabled.
@ -276,6 +281,7 @@ class neutron::server (
$max_l3_agents_per_router = 3, $max_l3_agents_per_router = 3,
$l3_ha_net_cidr = $::os_service_default, $l3_ha_net_cidr = $::os_service_default,
$network_auto_schedule = $::os_service_default, $network_auto_schedule = $::os_service_default,
$ensure_lbaas_package = false,
$ensure_vpnaas_package = false, $ensure_vpnaas_package = false,
$ensure_fwaas_package = false, $ensure_fwaas_package = false,
$ensure_dr_package = false, $ensure_dr_package = false,
@ -332,6 +338,25 @@ class neutron::server (
} }
} }
if $ensure_lbaas_package {
if $::neutron::params::lbaas_package {
ensure_packages('neutron-lbaas', {
ensure => $package_ensure,
name => $::neutron::params::lbaas_package,
tag => ['openstack', 'neutron-package']
})
} elsif $::neutron::params::lbaasv2_agent_package {
# RedHat package ships LBaaS and agent in same package
# so we install it here, it's fine because RedHat doesn't
# start services by default.
ensure_packages('neutron-lbaasv2-agent', {
ensure => $package_ensure,
name => $::neutron::params::lbaasv2_agent_package,
tag => ['openstack', 'neutron-package'],
})
}
}
if $ensure_vpnaas_package { if $ensure_vpnaas_package {
ensure_resource( 'package', 'neutron-vpnaas-agent', { ensure_resource( 'package', 'neutron-vpnaas-agent', {
'ensure' => $package_ensure, 'ensure' => $package_ensure,

View File

@ -0,0 +1,5 @@
---
features:
- |
Added new parameter neutron::server::ensure_lbaas_package that if set to true
will install the neutron LBaaS package so that you can load that service_provider.

View File

@ -258,16 +258,14 @@ describe 'neutron::server' do
end end
shared_examples_for 'VPNaaS, FWaaS and LBaaS package installation' do shared_examples_for 'VPNaaS and FWaaS package installation' do
before do before do
params.merge!( params.merge!(
:ensure_vpnaas_package => true, :ensure_vpnaas_package => true,
:ensure_fwaas_package => true, :ensure_fwaas_package => true,
:ensure_lbaas_package => true
) )
end end
it 'should install *aaS packages' do it 'should install *aaS packages' do
is_expected.to contain_package('neutron-lbaasv2-agent')
is_expected.to contain_package('neutron-fwaas') is_expected.to contain_package('neutron-fwaas')
is_expected.to contain_package('neutron-vpnaas-agent') is_expected.to contain_package('neutron-vpnaas-agent')
end end
@ -295,6 +293,28 @@ describe 'neutron::server' do
end end
end end
shared_examples_for 'neutron server lbaas debian' do
before do
params.merge!( :ensure_lbaas_package => true )
end
it 'should install lbaas package' do
is_expected.to contain_package('neutron-lbaas')
is_expected.not_to contain_package('neutron-lbaasv2-agent')
end
end
shared_examples_for 'neutron server lbaas redhat' do
before do
params.merge!( :ensure_lbaas_package => true )
end
it 'should install lbaasv2-agent package' do
is_expected.not_to contain_package('neutron-lbaas')
is_expected.to contain_package('neutron-lbaasv2-agent')
end
end
shared_examples_for 'a neutron server without database synchronization' do shared_examples_for 'a neutron server without database synchronization' do
before do before do
params.merge!( params.merge!(
@ -321,6 +341,7 @@ describe 'neutron::server' do
it_configures 'a neutron server' it_configures 'a neutron server'
it_configures 'a neutron server without database synchronization' it_configures 'a neutron server without database synchronization'
it_configures 'neutron server dynamic routing debian' it_configures 'neutron server dynamic routing debian'
it_configures 'neutron server lbaas debian'
end end
context 'on RedHat platforms' do context 'on RedHat platforms' do
@ -338,5 +359,6 @@ describe 'neutron::server' do
it_configures 'a neutron server' it_configures 'a neutron server'
it_configures 'a neutron server without database synchronization' it_configures 'a neutron server without database synchronization'
it_configures 'neutron server dynamic routing redhat' it_configures 'neutron server dynamic routing redhat'
it_configures 'neutron server lbaas redhat'
end end
end end