add more settings to glance api, registry, rabbitmq

settings added:

delayed_delete
scrub_time
signing_dir
token_cache_time
image_cache_stall_time
image_cache_max_size
kombu_reconnect_delay

Change-Id: Id7a6894e5bb12fc7697dfe23e5f9d4a44a719086
This commit is contained in:
Mykyta Karpin 2015-10-19 18:07:43 +03:00
parent 118d6b5824
commit 938e7679e6
6 changed files with 131 additions and 15 deletions

View File

@ -58,10 +58,24 @@
# (optional) The protocol of the Glance registry service.
# Default: http
#
# [*scrub_time*]
# (optional) The amount of time in seconds to delay before performing a delete.
# Defaults to $::os_service_default.
#
# [*delayed_delete*]
# (optional) Turn on/off delayed delete.
# Defaults to $::os_service_default.
#
# [*auth_type*]
# (optional) Type is authorization being used.
# Defaults to 'keystone'
#
# [*auth_region*]
# (optional) The region for the authentication service.
# If "use_user_token" is not in effect and using keystone auth,
# then region name can be specified.
# Defaults to 'RegionOne'.
#
# [*auth_host*]
# (optional) DEPRECATED Host running auth service.
# Defaults to '127.0.0.1'.
@ -142,6 +156,15 @@
# (optional) If set, use this value for max_overflow with sqlalchemy.
# Defaults to undef.
#
# [*image_cache_max_size*]
# (optional) The upper limit (the maximum size of accumulated cache in bytes) beyond which pruner,
# if running, starts cleaning the images cache.
# Defaults to $::os_service_default.
#
# [*image_cache_stall_time*]
# (optional) The amount of time to let an image remain in the cache without being accessed.
# Defaults to $::os_service_default.
#
# [*use_syslog*]
# (optional) Use syslog for logging.
# Defaults to undef
@ -189,6 +212,16 @@
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
#
# [*signing_dir*]
# (optional) Directory used to cache files related to PKI tokens.
# Defaults to $::os_service_default.
#
# [*token_cache_time*]
# (optional) In order to prevent excessive effort spent validating tokens,
# the middleware caches previously-seen tokens for a configurable duration (in seconds).
# Set to -1 to disable caching completely.
# Defaults to $::os_service_default.
#
# [*validate*]
# (optional) Whether to validate the service is working after any service refreshes
# Defaults to false
@ -223,7 +256,10 @@ class glance::api(
$registry_host = '0.0.0.0',
$registry_port = '9191',
$registry_client_protocol = 'http',
$scrub_time = $::os_service_default,
$delayed_delete = $::os_service_default,
$auth_type = 'keystone',
$auth_region = 'RegionOne',
$auth_uri = false,
$identity_uri = false,
$pipeline = 'keystone',
@ -247,8 +283,12 @@ class glance::api(
$database_max_retries = undef,
$database_retry_interval = undef,
$database_max_overflow = undef,
$image_cache_max_size = $::os_service_default,
$image_cache_stall_time = $::os_service_default,
$image_cache_dir = '/var/lib/glance/image-cache',
$os_region_name = 'RegionOne',
$signing_dir = $::os_service_default,
$token_cache_time = $::os_service_default,
$validate = false,
$validation_options = {},
# DEPRECATED PARAMETERS
@ -292,6 +332,8 @@ class glance::api(
require => Class['glance']
}
warning('Default value for auth_region parameter is different from OpenStack project defaults')
# basic service config
glance_api_config {
'DEFAULT/bind_host': value => $bind_host;
@ -299,7 +341,10 @@ class glance::api(
'DEFAULT/backlog': value => $backlog;
'DEFAULT/workers': value => $workers;
'DEFAULT/show_image_direct_url': value => $show_image_direct_url;
'DEFAULT/scrub_time': value => $scrub_time;
'DEFAULT/delayed_delete': value => $delayed_delete;
'DEFAULT/image_cache_dir': value => $image_cache_dir;
'DEFAULT/auth_region': value => $auth_region;
'glance_store/os_region_name': value => $os_region_name;
}
@ -315,9 +360,11 @@ class glance::api(
}
glance_cache_config {
'DEFAULT/verbose': value => pick($verbose, false);
'DEFAULT/debug': value => pick($debug, false);
'glance_store/os_region_name': value => $os_region_name;
'DEFAULT/verbose': value => pick($verbose, false);
'DEFAULT/debug': value => pick($debug, false);
'DEFAULT/image_cache_stall_time': value => $image_cache_stall_time;
'DEFAULT/image_cache_max_size': value => $image_cache_max_size;
'glance_store/os_region_name': value => $os_region_name;
}
# configure api service to connect registry service
@ -403,8 +450,10 @@ class glance::api(
if $auth_type == 'keystone' {
glance_api_config {
'keystone_authtoken/admin_tenant_name': value => $keystone_tenant;
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password, secret => true;
'keystone_authtoken/admin_user': value => $keystone_user;
'keystone_authtoken/admin_password': value => $keystone_password, secret => true;
'keystone_authtoken/token_cache_time': value => $token_cache_time;
'keystone_authtoken/signing_dir': value => $signing_dir;
}
glance_cache_config {
'DEFAULT/auth_url' : value => $auth_url;

View File

@ -58,6 +58,11 @@
# available on some distributions.
# Defaults to 'TLSv1'
#
# [*kombu_reconnect_delay*]
# (optional) How long to wait before reconnecting in response to an AMQP
# consumer cancel notification.
# Defaults to $::os_service_default.
#
# [*rabbit_notification_exchange*]
# Defaults to 'glance'
#
@ -88,6 +93,7 @@ class glance::notify::rabbitmq(
$kombu_ssl_certfile = undef,
$kombu_ssl_keyfile = undef,
$kombu_ssl_version = 'TLSv1',
$kombu_reconnect_delay = $::os_service_default,
$rabbit_notification_exchange = 'glance',
$rabbit_notification_topic = 'notifications',
$rabbit_durable_queues = false,
@ -125,6 +131,7 @@ class glance::notify::rabbitmq(
'oslo_messaging_rabbit/rabbit_notification_topic': value => $rabbit_notification_topic;
'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold;
'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate;
'oslo_messaging_rabbit/kombu_reconnect_delay': value => $kombu_reconnect_delay;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues_real;
}

View File

@ -149,6 +149,20 @@
# (Optional) Run db sync on the node.
# Defaults to true
#
# [*os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
#
# [*signing_dir*]
# Directory used to cache files related to PKI tokens.
# Defaults to $::os_service_default.
#
# [*token_cache_time*]
# In order to prevent excessive effort spent validating tokens,
# the middleware caches previously-seen tokens for a configurable duration (in seconds).
# Set to -1 to disable caching completely.
# Defaults to $::os_service_default.
#
class glance::registry(
$keystone_password,
$package_ensure = 'present',
@ -182,11 +196,14 @@ class glance::registry(
$key_file = false,
$ca_file = false,
$sync_db = true,
$os_region_name = 'RegionOne',
$signing_dir = $::os_service_default,
$token_cache_time = $::os_service_default,
# DEPRECATED PARAMETERS
$auth_host = '127.0.0.1',
$auth_port = '35357',
$auth_admin_prefix = false,
$auth_protocol = 'http',
$auth_host = '127.0.0.1',
$auth_port = '35357',
$auth_admin_prefix = false,
$auth_protocol = 'http',
) inherits glance {
include ::glance::registry::logging
@ -215,10 +232,13 @@ class glance::registry(
require => Class['glance']
}
warning('Default value for os_region_name parameter is different from OpenStack project defaults')
glance_registry_config {
'DEFAULT/workers': value => $workers;
'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port;
'DEFAULT/workers': value => $workers;
'DEFAULT/bind_host': value => $bind_host;
'DEFAULT/bind_port': value => $bind_port;
'glance_store/os_region_name': value => $os_region_name;
}
if $identity_uri {
@ -292,8 +312,10 @@ class glance::registry(
if $auth_type == 'keystone' {
glance_registry_config {
'keystone_authtoken/admin_tenant_name': value => $keystone_tenant;
'keystone_authtoken/admin_user' : value => $keystone_user;
'keystone_authtoken/admin_password' : value => $keystone_password, secret => true;
'keystone_authtoken/admin_user': value => $keystone_user;
'keystone_authtoken/admin_password': value => $keystone_password, secret => true;
'keystone_authtoken/token_cache_time': value => $token_cache_time;
'keystone_authtoken/signing_dir': value => $signing_dir;
}
}

View File

@ -22,6 +22,7 @@ describe 'glance::api' do
:log_file => '/var/log/glance/api.log',
:log_dir => '/var/log/glance',
:auth_type => 'keystone',
:auth_region => 'RegionOne',
:enabled => true,
:manage_service => true,
:backlog => '4096',
@ -32,11 +33,17 @@ describe 'glance::api' do
:keystone_tenant => 'services',
:keystone_user => 'glance',
:keystone_password => 'ChangeMe',
:token_cache_time => '<SERVICE DEFAULT>',
:show_image_direct_url => false,
:purge_config => false,
:known_stores => false,
:delayed_delete => '<SERVICE DEFAULT>',
:scrub_time => '<SERVICE DEFAULT>',
:image_cache_dir => '/var/lib/glance/image-cache',
:image_cache_stall_time => '<SERVICE DEFAULT>',
:image_cache_max_size => '<SERVICE DEFAULT>',
:os_region_name => 'RegionOne',
:signing_dir => '<SERVICE DEFAULT>',
:pipeline => 'keystone',
}
end
@ -51,6 +58,7 @@ describe 'glance::api' do
:registry_port => '9111',
:registry_client_protocol => 'https',
:auth_type => 'not_keystone',
:auth_region => 'RegionOne2',
:enabled => false,
:backlog => '4095',
:workers => '5',
@ -60,9 +68,15 @@ describe 'glance::api' do
:keystone_tenant => 'admin2',
:keystone_user => 'admin2',
:keystone_password => 'ChangeMe2',
:token_cache_time => '300',
:show_image_direct_url => true,
:delayed_delete => 'true',
:scrub_time => '10',
:image_cache_dir => '/tmp/glance',
:image_cache_stall_time => '10',
:image_cache_max_size => '10737418240',
:os_region_name => 'RegionOne2',
:signing_dir => '/path/to/dir',
:pipeline => 'keystone2',
}
].each do |param_set|
@ -102,6 +116,10 @@ describe 'glance::api' do
'registry_port',
'registry_client_protocol',
'show_image_direct_url',
'delayed_delete',
'scrub_time',
'image_cache_dir',
'auth_region'
].each do |config|
is_expected.to contain_glance_api_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end
@ -111,6 +129,8 @@ describe 'glance::api' do
[
'registry_host',
'registry_port',
'image_cache_stall_time',
'image_cache_max_size',
].each do |config|
is_expected.to contain_glance_cache_config("DEFAULT/#{config}").with_value(param_hash[config.intern])
end
@ -146,7 +166,7 @@ describe 'glance::api' do
if params[:auth_type] == 'keystone'
is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
['admin_tenant_name', 'admin_user', 'admin_password'].each do |config|
['admin_tenant_name', 'admin_user', 'admin_password', 'token_cache_time', 'signing_dir'].each do |config|
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
end
is_expected.to contain_glance_api_config('keystone_authtoken/admin_password').with_value(param_hash[:keystone_password]).with_secret(true)

View File

@ -28,6 +28,7 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_notification_topic').with_value('notifications') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/heartbeat_rate').with_value('2') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
end
describe 'when passing params and use ssl' do
@ -39,6 +40,7 @@ describe 'glance::notify::rabbitmq' do
:rabbit_port => '5673',
:rabbit_use_ssl => true,
:rabbit_durable_queues => true,
:kombu_reconnect_delay => '5.0'
}
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') }
@ -49,6 +51,7 @@ describe 'glance::notify::rabbitmq' do
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') }
it { is_expected.to contain_glance_api_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('5.0') }
end
end

View File

@ -30,6 +30,9 @@ describe 'glance::registry' do
:keystone_password => 'ChangeMe',
:purge_config => false,
:sync_db => true,
:os_region_name => 'RegionOne',
:signing_dir => '<SERVICE DEFAULT>',
:token_cache_time => '<SERVICE DEFAULT>',
}
end
@ -49,6 +52,9 @@ describe 'glance::registry' do
:keystone_user => 'admin',
:keystone_password => 'ChangeMe',
:sync_db => false,
:os_region_name => 'RegionOne2',
:signing_dir => '/path/to/dir',
:token_cache_time => '300',
}
].each do |param_set|
@ -103,6 +109,15 @@ describe 'glance::registry' do
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_user").with_value(param_hash[:keystone_user])
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password])
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_password").with_value(param_hash[:keystone_password]).with_secret(true)
is_expected.to contain_glance_registry_config("keystone_authtoken/token_cache_time").with_value(param_hash[:token_cache_time])
is_expected.to contain_glance_registry_config("keystone_authtoken/signing_dir").with_value(param_hash[:signing_dir])
end
end
it 'is_expected.to lay down default glance_store registry config' do
[
'os_region_name',
].each do |config|
is_expected.to contain_glance_registry_config("glance_store/#{config}").with_value(param_hash[config.intern])
end
end
end