Support neutron-periodic-workers

The neutron-periodic-workers service was added to neutron to run some
periodic tasks required by plugins. Update the server class to support
installation and management of the service.

Depends-on: https://review.opendev.org/c/openstack/neutron/+/922110
Change-Id: I8ae07b2edc6af98875c2a732385ad3a87db33cbd
This commit is contained in:
Takashi Kajinami 2024-09-03 13:08:42 +09:00
parent a4d9425fe8
commit 2e9a3fbcb4
4 changed files with 83 additions and 13 deletions

View File

@ -31,7 +31,9 @@ class neutron::params {
$api_package_name = undef
$api_service_name = undef
$rpc_package_name = 'openstack-neutron-rpc-server'
$rpc_service_name = 'neutron-rpc-server.service'
$rpc_service_name = 'neutron-rpc-server'
$periodic_workers_package_name = 'openstack-neutron-periodic-workers'
$periodic_workers_service_name = 'neutron-periodic-workers'
$ml2_server_package = 'openstack-neutron-ml2'
$ovs_agent_package = 'openstack-neutron-openvswitch'
$ovs_cleanup_service = 'neutron-ovs-cleanup'
@ -86,6 +88,8 @@ class neutron::params {
$bagpipe_bgp_package = undef
$bagpipe_bgp_service = undef
}
$periodic_workers_package_name = undef
$periodic_workers_service_name = undef
$dynamic_routing_package = 'python3-neutron-dynamic-routing'
$bgp_dragent_package = 'neutron-bgp-dragent'
$bgpvpn_bagpipe_package = 'python3-networking-bagpipe'

View File

@ -55,6 +55,16 @@
# be set with a value, so that an RPC server will run.
# Defaults to $::neutron::params::rpc_service_name
#
# [*periodic_workers_package_name*]
# (Optional) Name of the package for neutron-periodic-workers.
# Defaults to $::neutron::params::peiodic_workers_package_name
#
# [*periodic_workers_service_name*]
# (Optional) Name of the service for the periodic workers.
# If service_name is set to false, this parameter must
# be set with a value, so that an RPC server will run.
# Defaults to $::neutron::params::peiodic_workers_service_name
#
# [*sync_db*]
# (Optional) Run neutron-db-manage on api nodes after installing the package.
# Defaults to false
@ -244,6 +254,8 @@ class neutron::server (
$api_service_name = $::neutron::params::api_service_name,
$rpc_package_name = $::neutron::params::rpc_package_name,
$rpc_service_name = $::neutron::params::rpc_service_name,
$periodic_workers_package_name = $::neutron::params::periodic_workers_package_name,
$periodic_workers_service_name = $::neutron::params::periodic_workers_service_name,
Boolean $sync_db = false,
$api_workers = $facts['os_workers'],
$rpc_workers = $facts['os_workers'],
@ -356,6 +368,14 @@ class neutron::server (
tag => ['openstack', 'neutron-package'],
}
}
if $periodic_workers_package_name {
package { 'neutron-periodic-workers':
ensure => $package_ensure,
name => $periodic_workers_package_name,
tag => ['openstack', 'neutron-package'],
}
}
}
if ($auth_strategy == 'keystone') {
@ -475,6 +495,21 @@ class neutron::server (
Service['neutron-server'] -> Service['neutron-rpc-server']
}
}
if $periodic_workers_service_name {
service { 'neutron-periodic-workers':
ensure => $service_ensure,
name => $periodic_workers_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['neutron-service'],
}
if $::neutron::params::server_service {
Service['neutron-server'] -> Service['neutron-periodic-workers']
}
}
}
}
}

View File

@ -0,0 +1,5 @@
---
features:
- |
The ``neutron::server`` class now supports installation of
the ``neutron-periodic-workers`` service.

View File

@ -273,7 +273,6 @@ describe 'neutron::server' do
params.merge!(
:service_name => false,
:api_service_name => 'httpd',
:rpc_service_name => 'neutron-rpc-server',
)
end
@ -302,12 +301,36 @@ describe 'neutron::server' do
)
end
should contain_service('neutron-rpc-server').with(
:ensure => 'running',
:name => 'neutron-rpc-server',
:enable => true,
:tag => ['neutron-service'],
)
if platform_params.has_key?(:rpc_package_name)
should contain_package('neutron-rpc-server').with(
:name => platform_params[:rpc_package_name],
:ensure => 'present',
:tag => ['openstack', 'neutron-package'],
)
end
if platform_params.has_key?(:rpc_service_name)
should contain_service('neutron-rpc-server').with(
:ensure => 'running',
:name => platform_params[:rpc_service_name],
:enable => true,
:tag => ['neutron-service'],
)
end
if platform_params.has_key?(:periodic_workers_package_name)
should contain_package('neutron-periodic-workers').with(
:name => platform_params[:periodic_workers_package_name],
:ensure => 'present',
:tag => ['openstack', 'neutron-package'],
)
end
if platform_params.has_key?(:periodic_workers_service_name)
should contain_service('neutron-periodic-workers').with(
:ensure => 'running',
:name => platform_params[:periodic_workers_service_name],
:enable => true,
:tag => ['neutron-service'],
)
end
end
end
@ -416,13 +439,13 @@ describe 'neutron::server' do
{
:server_package => 'neutron-server',
:server_service => 'neutron-server',
:rpc_service_name => 'neutron-rpc-server',
:dynamic_routing_package => 'python3-neutron-dynamic-routing',
:vpnaas_agent_package => 'python3-neutron-vpnaas',
}
else
{
:api_service_name => 'neutron-api',
:rpc_package_name => 'neutron-rpc-server',
:rpc_service_name => 'neutron-rpc-server',
:dynamic_routing_package => 'python3-neutron-dynamic-routing',
:vpnaas_agent_package => 'python3-neutron-vpnaas',
@ -430,10 +453,13 @@ describe 'neutron::server' do
end
when 'RedHat'
{
:server_service => 'neutron-server',
:rpc_service_name => 'neutron-rpc-server',
:dynamic_routing_package => 'python3-neutron-dynamic-routing',
:vpnaas_agent_package => 'openstack-neutron-vpnaas',
:server_service => 'neutron-server',
:rpc_package_name => 'openstack-neutron-rpc-server',
:rpc_service_name => 'neutron-rpc-server',
:periodic_workers_package_name => 'openstack-neutron-periodic-workers',
:periodic_workers_service_name => 'neutron-periodic-workers',
:dynamic_routing_package => 'python3-neutron-dynamic-routing',
:vpnaas_agent_package => 'openstack-neutron-vpnaas',
}
end
end