Add memcached_servers parameter

This patch is aim to add memcached_servers parameter in glance-api
and glance-registry service.

Change-Id: I4f671ebcda63007fa13f86655b9988648592b68b
This commit is contained in:
Xingchao Yu 2016-01-12 19:07:01 +08:00
parent 429c256ebc
commit f444097a71
4 changed files with 18 additions and 1 deletions

View File

@ -203,6 +203,11 @@
# (optional) Directory used to cache files related to PKI tokens.
# Defaults to $::os_service_default.
#
# [*memcached_servers*]
# (optinal) a list of memcached server(s) to use for caching. If left undefined,
# tokens will instead be cached in-process.
# 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).
@ -249,6 +254,7 @@ class glance::api(
$auth_region = $::os_service_default,
$auth_uri = 'http://127.0.0.1:5000/',
$identity_uri = 'http://127.0.0.1:35357/',
$memcached_servers = $::os_service_default,
$pipeline = 'keystone',
$keystone_tenant = 'services',
$keystone_user = 'glance',
@ -384,6 +390,7 @@ class glance::api(
'keystone_authtoken/signing_dir': value => $signing_dir;
'keystone_authtoken/auth_uri': value => $auth_uri;
'keystone_authtoken/identity_uri': value => $identity_uri;
'keystone_authtoken/memcached_servers': value => join(any2array($memcached_servers), ',');
}
glance_cache_config {
'DEFAULT/auth_url' : value => $auth_uri;

View File

@ -141,6 +141,11 @@
# Directory used to cache files related to PKI tokens.
# Defaults to $::os_service_default.
#
# [*memcached_servers*]
# (optinal) a list of memcached server(s) to use for caching. If left undefined,
# tokens will instead be cached in-process.
# 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).
@ -182,6 +187,7 @@ class glance::registry(
$sync_db = true,
$os_region_name = $::os_service_default,
$signing_dir = $::os_service_default,
$memcached_servers = $::os_service_default,
$token_cache_time = $::os_service_default,
) inherits glance {
@ -240,6 +246,7 @@ class glance::registry(
'keystone_authtoken/signing_dir': value => $signing_dir;
'keystone_authtoken/auth_uri': value => $auth_uri;
'keystone_authtoken/identity_uri': value => $identity_uri;
'keystone_authtoken/memcached_servers': value => join(any2array($memcached_servers), ',');
}
}

View File

@ -31,6 +31,7 @@ describe 'glance::api' do
:keystone_user => 'glance',
:keystone_password => 'ChangeMe',
:token_cache_time => '<SERVICE DEFAULT>',
:memcached_servers => '<SERVICE DEFAULT>',
:show_image_direct_url => false,
:show_multiple_locations => '<SERVICE DEFAULT>',
:location_strategy => '<SERVICE DEFAULT>',
@ -158,7 +159,7 @@ describe 'glance::api' do
it 'is_expected.to configure itself for keystone if that is the auth_type' do
if params[:auth_type] == 'keystone'
is_expected.to contain('paste_deploy/flavor').with_value('keystone+cachemanagement')
is_expected.to contain_glance_api_config('keystone_authtoken/memcached_servers').with_value(param_hash[:memcached_servers])
['admin_tenant_name', 'admin_user', 'admin_password', 'token_cache_time', 'signing_dir', 'auth_uri', 'identity_uri'].each do |config|
is_expected.to contain_glance_api_config("keystone_authtoken/#{config}").with_value(param_hash[config.intern])
end

View File

@ -31,6 +31,7 @@ describe 'glance::registry' do
:os_region_name => '<SERVICE DEFAULT>',
:signing_dir => '<SERVICE DEFAULT>',
:token_cache_time => '<SERVICE DEFAULT>',
:memcached_servers => '<SERVICE DEFAULT>',
}
end
@ -99,6 +100,7 @@ describe 'glance::registry' do
end
if param_hash[:auth_type] == 'keystone'
is_expected.to contain_glance_registry_config("paste_deploy/flavor").with_value('keystone')
is_expected.to contain_glance_registry_config('keystone_authtoken/memcached_servers').with_value(param_hash[:memcached_servers])
is_expected.to contain_glance_registry_config("keystone_authtoken/admin_tenant_name").with_value(param_hash[:keystone_tenant])
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])