Merge "Add support for running neutron api by httpd+mod_wsgi"

This commit is contained in:
Zuul 2021-11-17 03:47:44 +00:00 committed by Gerrit Code Review
commit feba1ff2ee
5 changed files with 147 additions and 42 deletions

View File

@ -90,11 +90,11 @@ class neutron::keystone::auth (
include neutron::deps
if $configure_endpoint {
Keystone_endpoint["${region}/${service_name}::${service_type}"] ~> Service <| tag == 'neutron-server-eventlet' |>
Keystone_endpoint["${region}/${service_name}::${service_type}"] -> Anchor['neutron::service::end']
}
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| tag == 'neutron-server-eventlet' |>
Keystone_user_role["${auth_name}@${tenant}"] -> Anchor['neutron::service::end']
}
keystone::resource::service_identity { 'neutron':

View File

@ -75,7 +75,7 @@ class neutron::params {
$mlnx_agent_service = 'neutron-mlnx-agent'
} elsif($::osfamily == 'Debian') {
$package_name = 'neutron-common'
if $::os_package_type =='debian' {
if $::operatingsystem == 'Debian' {
$ml2_server_package = false
$server_service = false
$server_package = false

View File

@ -403,19 +403,9 @@ class neutron::server (
tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
}
} elsif $service_name == 'httpd' {
include apache::params
service { 'neutron-server':
ensure => 'stopped',
name => $::neutron::params::server_service,
enable => false,
hasstatus => true,
hasrestart => true,
tag => ['neutron-service', 'neutron-db-sync-service'],
}
Service <| title == 'httpd' |> { tag +> 'neutron-service' }
# we need to make sure neutron-server is stopped before trying to start apache
Service[$::neutron::params::server_service] -> Service[$service_name]
fail('Use api_service_name and rpc_service_name to run api service by httpd')
} else {
warning('Support for arbitaly service name is deprecated')
# backward compatibility so operators can customize the service name.
service { 'neutron-server':
ensure => $service_ensure,
@ -427,14 +417,54 @@ class neutron::server (
}
}
} else {
if $api_service_name {
if $::neutron::params::server_service {
# we need to make sure neutron-server is stopped before trying to
# start separate services.
service { 'neutron-server':
ensure => $service_ensure,
name => $api_service_name,
enable => $enabled,
ensure => 'stopped',
name => $::neutron::params::server_service,
enable => false,
hasstatus => true,
hasrestart => true,
tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
tag => ['neutron-service'],
}
}
if $api_service_name {
if $api_service_name == 'httpd' {
include apache::params
Service <| title == 'httpd' |> { tag +> 'neutron-service' }
if $::neutron::params::server_service {
Service['neutron-server'] -> Service['httpd']
}
if $::neutron::params::api_service_name {
# we need to make sure api service is stopped before trying to
# start apache
service { 'neutron-api':
ensure => 'stopped',
name => $::neutron::params::api_service_name,
enable => false,
hasstatus => true,
hasrestart => true,
tag => ['neutron-service'],
}
Service['neutron-api'] -> Service['httpd']
}
} else {
service { 'neutron-api':
ensure => $service_ensure,
name => $api_service_name,
enable => $enabled,
hasstatus => true,
hasrestart => true,
tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
}
if $::neutron::params::server_service {
Service['neutron-server'] -> Service['neutron-api']
}
}
}
@ -447,6 +477,10 @@ class neutron::server (
hasrestart => true,
tag => ['neutron-service', 'neutron-db-sync-service'],
}
if $::neutron::params::server_service {
Service['neutron-server'] -> Service['neutron-rpc-server']
}
}
}
@ -470,6 +504,6 @@ class neutron::server (
'try_sleep' => '2',
}
}
create_resources('openstacklib::service_validation', $validation_cmd, {'subscribe' => 'Service[neutron-server]'})
create_resources('openstacklib::service_validation', $validation_cmd, {'subscribe' => 'Anchor[neutron::service::end]'})
}
}

View File

@ -0,0 +1,17 @@
---
features:
- |
Now ``neutron::server::api_service_name`` can accept and handle ``httpd``
as a valid service name, to run api service by httpd+mod_wsgi.
upgrade:
- |
The ``neutron::server::service_name`` parameter no longer accepts
``httpd`` as a valid service name. To run api service by httpd,
the ``neutron::server::api_service_name`` parameter should be used instead
along with the ``neutron::server::rpc_service_name``.
deprecations:
- |
Usage of arbitaly service name for the ``neutron::server::service_name``
has been deprecated and will be removed in a future release.

View File

@ -49,16 +49,36 @@ describe 'neutron::server' do
end
it 'configures neutron server service' do
should contain_service('neutron-server').with(
:name => platform_params[:server_service],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
)
should contain_service('neutron-server').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-server').that_notifies('Anchor[neutron::service::end]')
if platform_params.has_key?(:server_service)
should contain_service('neutron-server').with(
:name => platform_params[:server_service],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
)
should contain_service('neutron-server').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-server').that_notifies('Anchor[neutron::service::end]')
else
should contain_service('neutron-api').with(
:name => platform_params[:api_service_name],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service', 'neutron-db-sync-service', 'neutron-server-eventlet'],
)
should contain_service('neutron-api').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-api').that_notifies('Anchor[neutron::service::end]')
should contain_service('neutron-rpc-server').with(
:name => platform_params[:rpc_service_name],
:enable => true,
:ensure => 'running',
:tag => ['neutron-service', 'neutron-db-sync-service'],
)
should contain_service('neutron-rpc-server').that_subscribes_to('Anchor[neutron::service::begin]')
should contain_service('neutron-rpc-server').that_notifies('Anchor[neutron::service::end]')
end
should_not contain_class('neutron::db::sync')
should contain_service('neutron-server').with_name('neutron-server')
should contain_neutron_config('DEFAULT/api_workers').with_value(facts[:os_workers])
should contain_neutron_config('DEFAULT/rpc_workers').with_value(facts[:os_workers])
should contain_neutron_config('DEFAULT/rpc_state_report_workers').with_value('<SERVICE DEFAULT>')
@ -80,7 +100,12 @@ describe 'neutron::server' do
end
it 'should not start/stop service' do
should contain_service('neutron-server').without_ensure
if platform_params.has_key?(:server_service)
should contain_service('neutron-server').without_ensure
else
should contain_service('neutron-api').without_ensure
should contain_service('neutron-rpc-server').without_ensure
end
end
end
@ -219,7 +244,11 @@ describe 'neutron::server' do
context 'when running neutron-api in wsgi' do
before :each do
params.merge!( :service_name => 'httpd' )
params.merge!(
:service_name => false,
:api_service_name => 'httpd',
:rpc_service_name => 'neutron-rpc-server',
)
end
let :pre_condition do
@ -231,11 +260,27 @@ describe 'neutron::server' do
end
it 'configures neutron-api service with Apache' do
should contain_service('neutron-server').with(
:ensure => 'stopped',
:name => platform_params[:server_service],
:enable => false,
:tag => ['neutron-service', 'neutron-db-sync-service'],
if platform_params.has_key?(:server_service)
should contain_service('neutron-server').with(
:ensure => 'stopped',
:name => platform_params[:server_service],
:enable => false,
:tag => ['neutron-service'],
)
else
should contain_service('neutron-api').with(
:ensure => 'stopped',
:name => platform_params[:api_service_name],
:enable => false,
:tag => ['neutron-service'],
)
end
should contain_service('neutron-rpc-server').with(
:ensure => 'running',
:name => 'neutron-rpc-server',
:enable => true,
:tag => ['neutron-service', 'neutron-db-sync-service'],
)
end
end
@ -332,13 +377,22 @@ describe 'neutron::server' do
let (:platform_params) do
case facts[:osfamily]
when 'Debian'
{
:server_package => 'neutron-server',
:server_service => 'neutron-server'
}
if facts[:operatingsystem] == 'Ubuntu'
{
:server_package => 'neutron-server',
:server_service => 'neutron-server',
:rpc_service_name => 'neutron-rpc-server',
}
else
{
:api_service_name => 'neutron-api',
:rpc_service_name => 'neutron-rpc-server',
}
end
when 'RedHat'
{
:server_service => 'neutron-server'
:server_service => 'neutron-server',
:rpc_service_name => 'neutron-rpc-server',
}
end
end