From adaee02815771f5d89975212b8cea24b68750618 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 3 Jan 2017 11:38:22 -0500 Subject: [PATCH] Allow db sync timeouts to be configurable As Openstack projects continue to have longer database migration chains, the Puppet default timeout of 300 seconds for an execution is becoming too short a duration on some hardware, leading to timeouts. As projects continue to add more migration scripts without "pruning" the base, timeouts will continue to become more frequent unless this time can be expanded. The proposed change adds a configuration option db_sync_timeout which maintains the Puppet default of 300 but allows TripleO to change the timeout to something higher. Change-Id: I6b30a4d9e3ca25d9a473e4eb614a8769fa4567e7 --- manifests/db/sync.pp | 9 ++++++- .../add_db_sync_timeout-d9f8a809ca76ac67.yaml | 3 +++ spec/classes/neutron_db_sync_spec.rb | 26 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/add_db_sync_timeout-d9f8a809ca76ac67.yaml diff --git a/manifests/db/sync.pp b/manifests/db/sync.pp index 616c80fe6..6e6a8b9bc 100644 --- a/manifests/db/sync.pp +++ b/manifests/db/sync.pp @@ -10,8 +10,14 @@ # 'upgrade heads'. # Defaults to '' # +# [*db_sync_timeout*] +# (optional) Timeout for the execution of the db_sync +# Defaults to 300 +# +# class neutron::db::sync( - $extra_params = '', + $extra_params = '', + $db_sync_timeout = 300, ) { include ::neutron::deps @@ -23,6 +29,7 @@ class neutron::db::sync( refreshonly => true, try_sleep => 5, tries => 10, + timeout => $db_sync_timeout, logoutput => on_failure, subscribe => [ Anchor['neutron::install::end'], diff --git a/releasenotes/notes/add_db_sync_timeout-d9f8a809ca76ac67.yaml b/releasenotes/notes/add_db_sync_timeout-d9f8a809ca76ac67.yaml new file mode 100644 index 000000000..0e40087d2 --- /dev/null +++ b/releasenotes/notes/add_db_sync_timeout-d9f8a809ca76ac67.yaml @@ -0,0 +1,3 @@ +--- +features: + - Adds db_sync_timeout parameter to neutron db sync \ No newline at end of file diff --git a/spec/classes/neutron_db_sync_spec.rb b/spec/classes/neutron_db_sync_spec.rb index dc07e58a1..7bbf798c9 100644 --- a/spec/classes/neutron_db_sync_spec.rb +++ b/spec/classes/neutron_db_sync_spec.rb @@ -11,6 +11,7 @@ describe 'neutron::db::sync' do :refreshonly => 'true', :try_sleep => 5, :tries => 10, + :timeout => 300, :logoutput => 'on_failure', :subscribe => ['Anchor[neutron::install::end]', 'Anchor[neutron::config::end]', @@ -33,6 +34,31 @@ describe 'neutron::db::sync' do :refreshonly => 'true', :try_sleep => 5, :tries => 10, + :timeout => 300, + :logoutput => 'on_failure', + :subscribe => ['Anchor[neutron::install::end]', + 'Anchor[neutron::config::end]', + 'Anchor[neutron::dbsync::begin]'], + :notify => 'Anchor[neutron::dbsync::end]', + ) + } + end + + describe "overriding db_sync_timeout" do + let :params do + { + :db_sync_timeout => 750, + } + end + + it { + is_expected.to contain_exec('neutron-db-sync').with( + :command => 'neutron-db-manage upgrade heads', + :path => '/usr/bin', + :refreshonly => 'true', + :try_sleep => 5, + :tries => 10, + :timeout => 750, :logoutput => 'on_failure', :subscribe => ['Anchor[neutron::install::end]', 'Anchor[neutron::config::end]',