Create dedicate class to manage dr service plugin
... to support options used by the plugin. Change-Id: I77a4ad4040d43f73d6242bb03e82d0800fe0fc4d
This commit is contained in:
parent
3a974aa691
commit
9b8cf8cb1c
@ -178,11 +178,6 @@
|
||||
# (Optional) Allow auto scheduling networks to DHCP agent
|
||||
# Defaults to $facts['os_service_default'].
|
||||
#
|
||||
# [*ensure_dr_package*]
|
||||
# (Optional) Ensures installation of Neutron Dynamic Routing package before starting API service.
|
||||
# Set to true to ensure installation of the package that is required to start neutron service if bgp service_plugin is enabled.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*service_providers*]
|
||||
# (Optional) (Array) Configures the service providers for neutron server.
|
||||
# Defaults to $facts['os_service_default']
|
||||
@ -244,6 +239,14 @@
|
||||
# speficied on the router.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*ensure_dr_package*]
|
||||
# (Optional) Ensures installation of Neutron Dynamic Routing package before
|
||||
# starting API service. Set to true to ensure installation of the package
|
||||
# that is required to start neutron service if bgp service_plugin is enabled.
|
||||
# Defaults to false
|
||||
#
|
||||
class neutron::server (
|
||||
$package_ensure = 'present',
|
||||
Boolean $enabled = true,
|
||||
@ -277,7 +280,6 @@ class neutron::server (
|
||||
$l3_ha_network_type = $facts['os_service_default'],
|
||||
$l3_ha_network_physical_name = $facts['os_service_default'],
|
||||
$network_auto_schedule = $facts['os_service_default'],
|
||||
Boolean $ensure_dr_package = false,
|
||||
$service_providers = $facts['os_service_default'],
|
||||
$auth_strategy = 'keystone',
|
||||
$enable_proxy_headers_parsing = $facts['os_service_default'],
|
||||
@ -289,6 +291,8 @@ class neutron::server (
|
||||
$igmp_flood_unregistered = $facts['os_service_default'],
|
||||
$enable_default_route_ecmp = $facts['os_service_default'],
|
||||
$enable_default_route_bfd = $facts['os_service_default'],
|
||||
# DEPRECATED PARAMETERS
|
||||
Boolean $ensure_dr_package = false,
|
||||
) inherits neutron::params {
|
||||
|
||||
include neutron::deps
|
||||
@ -302,6 +306,8 @@ class neutron::server (
|
||||
}
|
||||
|
||||
if $ensure_dr_package {
|
||||
warning("The ensure_dr_package parameter is deprecated. \
|
||||
Use the neutron::services::dr class instead.")
|
||||
ensure_packages('neutron-dynamic-routing', {
|
||||
ensure => $package_ensure,
|
||||
name => $::neutron::params::dynamic_routing_package,
|
||||
|
51
manifests/services/dr.pp
Normal file
51
manifests/services/dr.pp
Normal file
@ -0,0 +1,51 @@
|
||||
# This class installs and configures dynamic routing Neutron Plugin.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) Ensure state for package.
|
||||
# Defaults to 'present'.
|
||||
#
|
||||
# [*bgp_drscheduler_driver*]
|
||||
# (optional) Driver used for scheduling BGP speakers to BGP DrAgent.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*sync_db*]
|
||||
# Whether 'neutron-db-manage' should run to create and/or synchronize the
|
||||
# database with neutron-vpnaas specific tables.
|
||||
# Default to false
|
||||
#
|
||||
class neutron::services::dr (
|
||||
$package_ensure = 'present',
|
||||
$bgp_drscheduler_driver = $facts['os_service_default'],
|
||||
Boolean $sync_db = false,
|
||||
) {
|
||||
|
||||
include neutron::deps
|
||||
include neutron::params
|
||||
|
||||
ensure_packages('neutron-dynamic-routing', {
|
||||
ensure => $package_ensure,
|
||||
name => $::neutron::params::dynamic_routing_package,
|
||||
tag => ['openstack', 'neutron-package'],
|
||||
})
|
||||
|
||||
neutron_config {
|
||||
'DEFAULT/bgp_drscheduler_driver': value => $bgp_drscheduler_driver;
|
||||
}
|
||||
|
||||
if $sync_db {
|
||||
exec { 'dr-db-sync':
|
||||
command => 'neutron-db-manage --subproject neutron-dynamic-routing upgrade head',
|
||||
path => '/usr/bin',
|
||||
user => $::neutron::params::user,
|
||||
subscribe => [
|
||||
Anchor['neutron::install::end'],
|
||||
Anchor['neutron::config::end'],
|
||||
Anchor['neutron::dbsync::begin']
|
||||
],
|
||||
notify => Anchor['neutron::dbsync::end'],
|
||||
refreshonly => true
|
||||
}
|
||||
}
|
||||
}
|
9
releasenotes/notes/services-dr-d443a31d5f1dd7cc.yaml
Normal file
9
releasenotes/notes/services-dr-d443a31d5f1dd7cc.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``neutron::services::dr`` class has been added.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``neutron::server::ensure_dr_package`` parmaeter has been deprecated in
|
||||
favor of the ``neutron::services::dr`` class.
|
71
spec/classes/neutron_services_dr_spec.rb
Normal file
71
spec/classes/neutron_services_dr_spec.rb
Normal file
@ -0,0 +1,71 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'neutron::services::dr' do
|
||||
|
||||
shared_examples 'neutron dr service plugin' do
|
||||
context 'with default params' do
|
||||
it 'installs dr package' do
|
||||
should contain_package('neutron-dynamic-routing').with(
|
||||
:ensure => 'installed',
|
||||
:name => platform_params[:dynamic_routing_package],
|
||||
:tag => ['openstack', 'neutron-package'],
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures neutron.conf' do
|
||||
should contain_neutron_config('DEFAULT/bgp_drscheduler_driver').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
|
||||
it 'does not run neutron-db-manage' do
|
||||
should_not contain_exec('dr-db-sync')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with db sync enabled' do
|
||||
let :params do
|
||||
{
|
||||
:sync_db => true
|
||||
}
|
||||
end
|
||||
|
||||
it 'runs neutron-db-manage' do
|
||||
should contain_exec('dr-db-sync').with(
|
||||
:command => 'neutron-db-manage --subproject neutron-dynamic-routing upgrade head',
|
||||
:path => '/usr/bin',
|
||||
:user => 'neutron',
|
||||
:subscribe => ['Anchor[neutron::install::end]',
|
||||
'Anchor[neutron::config::end]',
|
||||
'Anchor[neutron::dbsync::begin]'
|
||||
],
|
||||
:notify => 'Anchor[neutron::dbsync::end]',
|
||||
:refreshonly => 'true',
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
let (:platform_params) do
|
||||
case facts[:os]['family']
|
||||
when 'Debian'
|
||||
{
|
||||
:dynamic_routing_package => 'python3-neutron-dynamic-routing',
|
||||
}
|
||||
when 'RedHat'
|
||||
{
|
||||
:dynamic_routing_package => 'python3-neutron-dynamic-routing',
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'neutron dr service plugin'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user