From de5fd6f5006f61b583b51e32272656eade30a459 Mon Sep 17 00:00:00 2001 From: Matt Fischer Date: Sat, 24 Sep 2016 13:31:57 -0600 Subject: [PATCH] Allow specifying the API port Change-Id: I7050209ab4f9a42f07580a10f562dd67c0c84712 Closes-Bug: #1483605 --- manifests/api.pp | 21 ++++++++++++------- ..._specifying_api_port-b519d1df6d00e71c.yaml | 5 +++++ spec/classes/cinder_api_spec.rb | 12 +++++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 releasenotes/notes/allow_specifying_api_port-b519d1df6d00e71c.yaml diff --git a/manifests/api.pp b/manifests/api.pp index c988caa6..6f21a0b9 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -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 { diff --git a/releasenotes/notes/allow_specifying_api_port-b519d1df6d00e71c.yaml b/releasenotes/notes/allow_specifying_api_port-b519d1df6d00e71c.yaml new file mode 100644 index 00000000..0d91856f --- /dev/null +++ b/releasenotes/notes/allow_specifying_api_port-b519d1df6d00e71c.yaml @@ -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. diff --git a/spec/classes/cinder_api_spec.rb b/spec/classes/cinder_api_spec.rb index b093bd3d..9e65ca5a 100644 --- a/spec/classes/cinder_api_spec.rb +++ b/spec/classes/cinder_api_spec.rb @@ -71,6 +71,7 @@ describe 'cinder::api' do is_expected.to contain_cinder_config('barbican/barbican_endpoint').with_value('') is_expected.to contain_cinder_config('barbican/auth_endpoint').with_value('') is_expected.to contain_cinder_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => '') + is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen_port').with('value' => '') 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