From 5feb714c32b5b1720941ccc9902493339b672f03 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 24 Mar 2015 11:09:25 -0400 Subject: [PATCH] Introducing ttl to openstack-telemetry ttl is the time_to_live value that will be configured against database. This value indicates the expiry time for ceilometer samples Implements: bluerprint ceilometer-db-cleanup-configuration Change-Id: I1c207e15ec0ca23c2fbd0db10842e600e71d69df --- README.md | 1 + attributes/default.rb | 3 +++ spec/common_spec.rb | 7 +++++++ templates/default/ceilometer.conf.erb | 1 + 4 files changed, 12 insertions(+) diff --git a/README.md b/README.md index d5bedef..065e887 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ Attributes * `openstack['telemetry']['service-credentials']['cafile']` - A PEM encoded Certificate Authority to use when verifying HTTPs connections (for service polling authentication) * `openstack['telemetry']['service-credentials']['insecure']` - Set whether to verify HTTPS connections (for service polling authentication) * `openstack['telemetry']['dbsync_timeout']` - Set dbsync command timeout value +* `openstack['telemetry']['database']['time_to_live']` - Set a time_to_live parameter (ttl) for samples. Set -1 for no expiry The following attributes are defined in attributes/default.rb of the common cookbook, but are documented here due to their relevance: diff --git a/attributes/default.rb b/attributes/default.rb index 90b85d0..b093943 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -143,3 +143,6 @@ when 'debian' 'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'" } end + +# The time to live value for samples which is specified in seconds, override to -1 if no data expiry is required +default['openstack']['telemetry']['database']['time_to_live'] = 1800 diff --git a/spec/common_spec.rb b/spec/common_spec.rb index 7b247ba..4835240 100644 --- a/spec/common_spec.rb +++ b/spec/common_spec.rb @@ -175,6 +175,13 @@ describe 'openstack-telemetry::common' do end end + context 'database' do + it 'has time_to_live set' do + expect(chef_run).to render_config_file(file.name)\ + .with_section_content('database', /^time_to_live=1800$/) + end + end + context 'service_credentials attributes with default values' do it 'sets cafile' do expect(chef_run).not_to render_file(file.name).with_content(/^os_cacert = $/) diff --git a/templates/default/ceilometer.conf.erb b/templates/default/ceilometer.conf.erb index 8fd440f..5b131b1 100644 --- a/templates/default/ceilometer.conf.erb +++ b/templates/default/ceilometer.conf.erb @@ -61,6 +61,7 @@ periodic_interval = <%= node["openstack"]["telemetry"]["periodic_interval"] %> [database] connection=<%= @database_connection %> +time_to_live=<%= node["openstack"]["telemetry"]["database"]["time_to_live"] %> [api] host = <%= @api_bind_host %>