From 2e9a3fbcb4d1ecb56c708ba749aa95c759e6b412 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 3 Sep 2024 13:08:42 +0900 Subject: [PATCH] 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 --- manifests/params.pp | 6 ++- manifests/server.pp | 35 +++++++++++++ .../periodic-workers-c23f48d96acadeda.yaml | 5 ++ spec/classes/neutron_server_spec.rb | 50 ++++++++++++++----- 4 files changed, 83 insertions(+), 13 deletions(-) create mode 100644 releasenotes/notes/periodic-workers-c23f48d96acadeda.yaml diff --git a/manifests/params.pp b/manifests/params.pp index f1ec743f1..b26725ca0 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -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' diff --git a/manifests/server.pp b/manifests/server.pp index be73e7518..b6ad75623 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -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'] + } + } } } } diff --git a/releasenotes/notes/periodic-workers-c23f48d96acadeda.yaml b/releasenotes/notes/periodic-workers-c23f48d96acadeda.yaml new file mode 100644 index 000000000..d061e0890 --- /dev/null +++ b/releasenotes/notes/periodic-workers-c23f48d96acadeda.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``neutron::server`` class now supports installation of + the ``neutron-periodic-workers`` service. diff --git a/spec/classes/neutron_server_spec.rb b/spec/classes/neutron_server_spec.rb index 2176cd562..cccb8fccc 100644 --- a/spec/classes/neutron_server_spec.rb +++ b/spec/classes/neutron_server_spec.rb @@ -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