From 2d36ef461f83adbc50a2d8aeece067a4514eacdd Mon Sep 17 00:00:00 2001 From: lqslan Date: Wed, 5 Nov 2014 11:16:17 +0800 Subject: [PATCH] Make ceilometer dbsync command timeout to be an optional parameter The default dbsync command timeout value 3600 seconds may be too small when there are large data in ceilometer database. Make timeout to be optional to fix this problem. Change-Id: Id4e703fab260f8e010ff089e4134e7aab8e21fd2 Closes-bug: #1389111 --- CHANGELOG.md | 1 + README.md | 1 + attributes/default.rb | 2 ++ recipes/collector.rb | 1 + spec/collector-rhel_spec.rb | 5 ++++- spec/collector_spec.rb | 5 ++++- 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d6d49e..2773b9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ h_algorithms to be configurable * Remove old nosql check for running dbsync * Bump Chef gem to 11.16 * Allow rabbit_hosts and rabbit_ha_queues to be configurable +* Allow dbsync_timeout to be configurable ## 10.0.0 * Upgrading to Juno diff --git a/README.md b/README.md index fbf5e5c..d5bedef 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ Attributes * `openstack['telemetry']['api']['auth']['insecure']` - Set whether to verify HTTPS connections * `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 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 74bf4bf..90b85d0 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -68,6 +68,8 @@ default['openstack']['telemetry']['service-credentials']['insecure'] = false default['openstack']['telemetry']['sample_source'] = 'openstack' +default['openstack']['telemetry']['dbsync_timeout'] = 3600 + case node['openstack']['compute']['driver'] when 'libvirt.LibvirtDriver' default['openstack']['telemetry']['hypervisor_inspector'] = 'libvirt' diff --git a/recipes/collector.rb b/recipes/collector.rb index 3ec98a0..afa96eb 100644 --- a/recipes/collector.rb +++ b/recipes/collector.rb @@ -26,6 +26,7 @@ conf_switch = "--config-file #{node["openstack"]["telemetry"]["conf"]}" execute 'database migration' do command "ceilometer-dbsync #{conf_switch}" + timeout node['openstack']['telemetry']['dbsync_timeout'] end platform = node['openstack']['telemetry']['platform'] diff --git a/spec/collector-rhel_spec.rb b/spec/collector-rhel_spec.rb index 60cb510..5e2a28c 100644 --- a/spec/collector-rhel_spec.rb +++ b/spec/collector-rhel_spec.rb @@ -12,8 +12,11 @@ describe 'openstack-telemetry::collector' do include_examples 'expect-runs-common-recipe' it 'executes ceilometer dbsync' do + node.set['openstack']['telemetry']['dbsync_timeout'] = 36000 command = 'ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf' - expect(chef_run).to run_execute command + expect(chef_run).to run_execute(command).with( + timeout: 36000 + ) end it 'installs the collector package' do diff --git a/spec/collector_spec.rb b/spec/collector_spec.rb index 78f9d92..0e0f968 100644 --- a/spec/collector_spec.rb +++ b/spec/collector_spec.rb @@ -16,8 +16,11 @@ describe 'openstack-telemetry::collector' do end it 'executes ceilometer dbsync' do + node.set['openstack']['telemetry']['dbsync_timeout'] = 36000 command = 'ceilometer-dbsync --config-file /etc/ceilometer/ceilometer.conf' - expect(chef_run).to run_execute command + expect(chef_run).to run_execute(command).with( + timeout: 36000 + ) end it 'installs python-mysqldb' do