Skip to content

Commit

Permalink
Merge "add config for caching metadata in memory"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jenkins authored and openstack-gerrit committed Nov 2, 2014
2 parents 6b49584 + 7babb4f commit 23e9e33
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 14 deletions.
46 changes: 32 additions & 14 deletions manifests/agents/metadata.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,32 @@
# (optional) Number of backlog requests to configure the metadata server socket with.
# Defaults to 4096
#
# [*metadata_memory_cache_ttl*]
# (optional) Specifies time in seconds a metadata cache entry is valid in
# memory caching backend.
# Set to 0 will cause cache entries to never expire.
# Set to undef or false to disable cache.
# Defaults to 5
#

class neutron::agents::metadata (
$auth_password,
$shared_secret,
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$debug = false,
$auth_tenant = 'services',
$auth_user = 'neutron',
$auth_url = 'http://localhost:35357/v2.0',
$auth_insecure = false,
$auth_ca_cert = undef,
$auth_region = 'RegionOne',
$metadata_ip = '127.0.0.1',
$metadata_port = '8775',
$metadata_workers = $::processorcount,
$metadata_backlog = '4096'
$package_ensure = 'present',
$enabled = true,
$manage_service = true,
$debug = false,
$auth_tenant = 'services',
$auth_user = 'neutron',
$auth_url = 'http://localhost:35357/v2.0',
$auth_insecure = false,
$auth_ca_cert = undef,
$auth_region = 'RegionOne',
$metadata_ip = '127.0.0.1',
$metadata_port = '8775',
$metadata_workers = $::processorcount,
$metadata_backlog = '4096',
$metadata_memory_cache_ttl = 5,
) {

include neutron::params
Expand All @@ -101,6 +109,16 @@
'DEFAULT/metadata_backlog': value => $metadata_backlog;
}

if $metadata_memory_cache_ttl {
neutron_metadata_agent_config {
'DEFAULT/cache_url': value => "memory://?default_ttl=${metadata_memory_cache_ttl}";
}
} else {
neutron_metadata_agent_config {
'DEFAULT/cache_url': ensure => absent;
}
}

if $auth_ca_cert {
neutron_metadata_agent_config {
'DEFAULT/auth_ca_cert': value => $auth_ca_cert;
Expand Down
1 change: 1 addition & 0 deletions spec/classes/neutron_agents_metadata_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
should contain_neutron_metadata_agent_config('DEFAULT/metadata_workers').with(:value => facts[:processorcount])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_backlog').with(:value => params[:metadata_backlog])
should contain_neutron_metadata_agent_config('DEFAULT/metadata_proxy_shared_secret').with(:value => params[:shared_secret])
should contain_neutron_metadata_agent_config('DEFAULT/cache_url').with(:value => 'memory://?default_ttl=5')
end
end

Expand Down

0 comments on commit 23e9e33

Please sign in to comment.