Allow specifying the API port

Change-Id: I7050209ab4f9a42f07580a10f562dd67c0c84712
Closes-Bug: #1483605
This commit is contained in:
Matt Fischer 2016-09-24 13:31:57 -06:00
parent 2e600672c3
commit de5fd6f500
3 changed files with 31 additions and 7 deletions

View File

@ -192,6 +192,11 @@
# try_sleep: 10
# Defaults to {}
#
# [*osapi_volume_listen_port*]
# (optional) What port the API listens on. Defaults to $::os_service_default
# If this value is modified the catalog URLs in the keystone::auth class
# will also need to be changed to match.
#
class cinder::api (
$keystone_enabled = true,
$nova_catalog_info = 'compute:Compute Service:publicURL',
@ -226,6 +231,7 @@ class cinder::api (
$key_file = $::os_service_default,
$ca_file = $::os_service_default,
$auth_strategy = 'keystone',
$osapi_volume_listen_port = $::os_service_default,
# DEPRECATED PARAMETERS
$validation_options = {},
$keystone_tenant = undef,
@ -331,13 +337,14 @@ class cinder::api (
}
cinder_config {
'DEFAULT/osapi_volume_listen': value => $bind_host;
'DEFAULT/osapi_volume_workers': value => $service_workers;
'DEFAULT/os_region_name': value => $os_region_name;
'DEFAULT/default_volume_type': value => $default_volume_type;
'DEFAULT/public_endpoint': value => $public_endpoint;
'DEFAULT/osapi_volume_base_URL': value => $osapi_volume_base_url;
'DEFAULT/osapi_max_limit': value => $osapi_max_limit;
'DEFAULT/osapi_volume_listen': value => $bind_host;
'DEFAULT/osapi_volume_workers': value => $service_workers;
'DEFAULT/os_region_name': value => $os_region_name;
'DEFAULT/default_volume_type': value => $default_volume_type;
'DEFAULT/public_endpoint': value => $public_endpoint;
'DEFAULT/osapi_volume_base_URL': value => $osapi_volume_base_url;
'DEFAULT/osapi_max_limit': value => $osapi_max_limit;
'DEFAULT/osapi_volume_listen_port': value => $osapi_volume_listen_port;
}
cinder_config {

View File

@ -0,0 +1,5 @@
---
features:
- A new parameter allows changing the port that the
cinder API service listens on. If it is changed,
don't forget to update the catalog URLs.

View File

@ -71,6 +71,7 @@ describe 'cinder::api' do
is_expected.to contain_cinder_config('barbican/barbican_endpoint').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('barbican/auth_endpoint').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen_port').with('value' => '<SERVICE DEFAULT>')
end
end
@ -112,6 +113,17 @@ describe 'cinder::api' do
end
end
describe 'with a customized port' do
let :params do
req_params.merge({'osapi_volume_listen_port' => 9999})
end
it 'should customize the port' do
is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen_port').with(
:value => 9999
)
end
end
describe 'with an OpenStack privileged account' do
context 'with all needed params' do