vpnaas: Support scheduler options

Change-Id: Ie436b3a6f41a6e6b9a5e63fc3b7770795585ce82
This commit is contained in:
Takashi Kajinami 2024-09-21 12:52:43 +09:00
parent 3a974aa691
commit 7221506302
3 changed files with 54 additions and 5 deletions

View File

@ -11,6 +11,19 @@
# Must be in form: <service_type>:<name>:<driver>[:default] # Must be in form: <service_type>:<name>:<driver>[:default]
# Defaults to $facts['os_service_default'] # Defaults to $facts['os_service_default']
# #
# [*vpn_scheduler_driver*]
# (optional) Driver to use for scheduling router to a VPN agent.
# Defaults to $facts['os_service_default']
#
# [*vpn_auto_schedule*]
# (optional) Allow auto scheduling of routers to VPN agent.
# Defaults to $facts['os_service_default']
#
# [*allow_automatic_vpnagent_failover*]
# (optional) Automatically reschedule routers from offline VPN agents to
# online VPN agents.
# Defaults to $facts['os_service_default']
#
# [*sync_db*] # [*sync_db*]
# Whether 'neutron-db-manage' should run to create and/or synchronize the # Whether 'neutron-db-manage' should run to create and/or synchronize the
# database with neutron-vpnaas specific tables. # database with neutron-vpnaas specific tables.
@ -22,10 +35,13 @@
# Defaults to false. # Defaults to false.
# #
class neutron::services::vpnaas ( class neutron::services::vpnaas (
$package_ensure = 'present', $package_ensure = 'present',
$service_providers = $facts['os_service_default'], $service_providers = $facts['os_service_default'],
Boolean $sync_db = false, $vpn_scheduler_driver = $facts['os_service_default'],
Boolean $purge_config = false, $vpn_auto_schedule = $facts['os_service_default'],
$allow_automatic_vpnagent_failover = $facts['os_service_default'],
Boolean $sync_db = false,
Boolean $purge_config = false,
) { ) {
include neutron::deps include neutron::deps
@ -48,7 +64,10 @@ class neutron::services::vpnaas (
} }
neutron_vpnaas_service_config { neutron_vpnaas_service_config {
'service_providers/service_provider': value => $service_providers_real; 'service_providers/service_provider': value => $service_providers_real;
'DEFAULT/vpn_scheduler_driver': value => $vpn_scheduler_driver;
'DEFAULT/vpn_auto_schedule': value => $vpn_auto_schedule;
'DEFAULT/allow_automatic_vpnagent_failover': value => $allow_automatic_vpnagent_failover;
} }
if $sync_db { if $sync_db {

View File

@ -0,0 +1,9 @@
---
features:
- |
The following parameters have been added to
the ``neutron::services::vpnaas`` class.
- ``vpn_scheduler_driver``
- ``vpn_auto_schedule``
- ``allow_automatic_vpnagent_failover``

View File

@ -17,6 +17,9 @@ describe 'neutron::services::vpnaas' do
).with_value( ).with_value(
'VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default' 'VPN:openswan:neutron_vpnaas.services.vpn.service_drivers.ipsec.IPsecVPNDriver:default'
) )
should contain_neutron_vpnaas_service_config('DEFAULT/vpn_scheduler_driver').with_value('<SERVICE DEFAULT>')
should contain_neutron_vpnaas_service_config('DEFAULT/vpn_auto_schedule').with_value('<SERVICE DEFAULT>')
should contain_neutron_vpnaas_service_config('DEFAULT/allow_automatic_vpnagent_failover').with_value('<SERVICE DEFAULT>')
end end
it 'does not run neutron-db-manage' do it 'does not run neutron-db-manage' do
@ -59,6 +62,24 @@ describe 'neutron::services::vpnaas' do
).with_value(['provider1', 'provider2']) ).with_value(['provider1', 'provider2'])
end end
end end
context 'with parameters' do
let :params do
{
:vpn_scheduler_driver => 'neutron_vpnaas.scheduler.vpn_agent_scheduler.LeastRoutersScheduler',
:vpn_auto_schedule => true,
:allow_automatic_vpnagent_failover => false,
}
end
it 'configures neutron_vpnaas.conf' do
should contain_neutron_vpnaas_service_config('DEFAULT/vpn_scheduler_driver').with_value(
'neutron_vpnaas.scheduler.vpn_agent_scheduler.LeastRoutersScheduler'
)
should contain_neutron_vpnaas_service_config('DEFAULT/vpn_auto_schedule').with_value(true)
should contain_neutron_vpnaas_service_config('DEFAULT/allow_automatic_vpnagent_failover').with_value(false)
end
end
end end
on_supported_os({ on_supported_os({