Allows the modification of the nova-api ports

In the api.pp manifest file, several new variables
have been added give the puppet-nova module an interface
for modifying several of the nova-api ports.

Change-Id: I47ca98a554f84855d55a648163f5498f51b33491
Closes-Bug: #1484402
This commit is contained in:
Jay Clark
2015-09-30 11:06:40 -04:00
parent 0d57b76bf6
commit bea74489ce
2 changed files with 70 additions and 43 deletions

View File

@@ -60,10 +60,18 @@
# (optional) IP address for nova-api server to listen
# Defaults to '0.0.0.0'
#
# [*ec2_listen_port*]
# (optional) The port on which the EC2 API will listen.
# Defaults to port 8773
#
# [*metadata_listen*]
# (optional) IP address for metadata server to listen
# Defaults to '0.0.0.0'
#
# [*metadata_listen_port*]
# (optional) The port on which the metadata API will listen.
# Defaults to 8775
#
# [*enabled_apis*]
# (optional) A comma separated list of apis to enable
# Defaults to 'ec2,osapi_compute,metadata'
@@ -91,6 +99,10 @@
# (optional) Number of workers for OpenStack API service
# Defaults to $::processorcount
#
# [*osapi_compute_listen_port*]
# (optional) The port on which the OpenStack API will listen.
# Defaults to port 8774
#
# [*ec2_workers*]
# (optional) Number of workers for EC2 service
# Defaults to $::processorcount
@@ -158,40 +170,43 @@
#
class nova::api(
$admin_password,
$enabled = true,
$manage_service = true,
$ensure_package = 'present',
$auth_uri = false,
$identity_uri = false,
$auth_version = false,
$admin_tenant_name = 'services',
$admin_user = 'nova',
$api_bind_address = '0.0.0.0',
$metadata_listen = '0.0.0.0',
$enabled_apis = 'ec2,osapi_compute,metadata',
$keystone_ec2_url = false,
$volume_api_class = 'nova.volume.cinder.API',
$cinder_catalog_info = 'volumev2:cinderv2:publicURL',
$use_forwarded_for = false,
$osapi_compute_workers = $::processorcount,
$ec2_workers = $::processorcount,
$metadata_workers = $::processorcount,
$sync_db = true,
$enabled = true,
$manage_service = true,
$ensure_package = 'present',
$auth_uri = false,
$identity_uri = false,
$auth_version = false,
$admin_tenant_name = 'services',
$admin_user = 'nova',
$api_bind_address = '0.0.0.0',
$ec2_listen_port = 8773,
$osapi_compute_listen_port = 8774,
$metadata_listen = '0.0.0.0',
$metadata_listen_port = 8775,
$enabled_apis = 'ec2,osapi_compute,metadata',
$keystone_ec2_url = false,
$volume_api_class = 'nova.volume.cinder.API',
$cinder_catalog_info = 'volumev2:cinderv2:publicURL',
$use_forwarded_for = false,
$osapi_compute_workers = $::processorcount,
$ec2_workers = $::processorcount,
$metadata_workers = $::processorcount,
$sync_db = true,
$neutron_metadata_proxy_shared_secret = undef,
$osapi_v3 = false,
$default_floating_pool = 'nova',
$pci_alias = undef,
$ratelimits = undef,
$osapi_v3 = false,
$default_floating_pool = 'nova',
$pci_alias = undef,
$ratelimits = undef,
$ratelimits_factory =
'nova.api.openstack.compute.limits:RateLimitingMiddleware.factory',
$validate = false,
$validation_options = {},
$validate = false,
$validation_options = {},
# DEPRECATED PARAMETER
$auth_protocol = 'http',
$auth_port = 35357,
$auth_host = '127.0.0.1',
$auth_admin_prefix = false,
$conductor_workers = undef,
$auth_protocol = 'http',
$auth_port = 35357,
$auth_host = '127.0.0.1',
$auth_admin_prefix = false,
$conductor_workers = undef,
) {
include ::nova::db
@@ -222,19 +237,22 @@ class nova::api(
}
nova_config {
'DEFAULT/enabled_apis': value => $enabled_apis;
'DEFAULT/volume_api_class': value => $volume_api_class;
'DEFAULT/ec2_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_listen': value => $api_bind_address;
'DEFAULT/metadata_listen': value => $metadata_listen;
'DEFAULT/osapi_volume_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_workers': value => $osapi_compute_workers;
'DEFAULT/ec2_workers': value => $ec2_workers;
'DEFAULT/metadata_workers': value => $metadata_workers;
'DEFAULT/use_forwarded_for': value => $use_forwarded_for;
'DEFAULT/default_floating_pool': value => $default_floating_pool;
'osapi_v3/enabled': value => $osapi_v3;
'cinder/catalog_info': value => $cinder_catalog_info;
'DEFAULT/enabled_apis': value => $enabled_apis;
'DEFAULT/volume_api_class': value => $volume_api_class;
'DEFAULT/ec2_listen': value => $api_bind_address;
'DEFAULT/ec2_listen_port': value => $ec2_listen_port;
'DEFAULT/osapi_compute_listen': value => $api_bind_address;
'DEFAULT/metadata_listen': value => $metadata_listen;
'DEFAULT/metadata_listen_port': value => $metadata_listen_port;
'DEFAULT/osapi_compute_listen_port': value => $osapi_compute_listen_port;
'DEFAULT/osapi_volume_listen': value => $api_bind_address;
'DEFAULT/osapi_compute_workers': value => $osapi_compute_workers;
'DEFAULT/ec2_workers': value => $ec2_workers;
'DEFAULT/metadata_workers': value => $metadata_workers;
'DEFAULT/use_forwarded_for': value => $use_forwarded_for;
'DEFAULT/default_floating_pool': value => $default_floating_pool;
'osapi_v3/enabled': value => $osapi_v3;
'cinder/catalog_info': value => $cinder_catalog_info;
}
if ($neutron_metadata_proxy_shared_secret){

View File

@@ -58,8 +58,11 @@ describe 'nova::api' do
it 'configures various stuff' do
is_expected.to contain_nova_config('DEFAULT/ec2_listen').with('value' => '0.0.0.0')
is_expected.to contain_nova_config('DEFAULT/ec2_listen_port').with('value' => '8773')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '0.0.0.0')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8774')
is_expected.to contain_nova_config('DEFAULT/metadata_listen').with('value' => '0.0.0.0')
is_expected.to contain_nova_config('DEFAULT/metadata_listen_port').with('value' => '8775')
is_expected.to contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '0.0.0.0')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '5')
is_expected.to contain_nova_config('DEFAULT/ec2_workers').with('value' => '5')
@@ -94,6 +97,9 @@ describe 'nova::api' do
:admin_password => 'passw0rd2',
:api_bind_address => '192.168.56.210',
:metadata_listen => '127.0.0.1',
:metadata_listen_port => 8875,
:osapi_compute_listen_port => 8874,
:ec2_listen_port => 8873,
:volume_api_class => 'nova.volume.cinder.API',
:use_forwarded_for => false,
:ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)',
@@ -148,8 +154,11 @@ describe 'nova::api' do
it 'configures various stuff' do
is_expected.to contain_nova_config('DEFAULT/ec2_listen').with('value' => '192.168.56.210')
is_expected.to contain_nova_config('DEFAULT/ec2_listen_port').with('value' => '8873')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen').with('value' => '192.168.56.210')
is_expected.to contain_nova_config('DEFAULT/osapi_compute_listen_port').with('value' => '8874')
is_expected.to contain_nova_config('DEFAULT/metadata_listen').with('value' => '127.0.0.1')
is_expected.to contain_nova_config('DEFAULT/metadata_listen_port').with('value' => '8875')
is_expected.to contain_nova_config('DEFAULT/osapi_volume_listen').with('value' => '192.168.56.210')
is_expected.to contain_nova_config('DEFAULT/use_forwarded_for').with('value' => false)
is_expected.to contain_nova_config('DEFAULT/osapi_compute_workers').with('value' => '1')