From 5de0025c53ca594d299bf3cff1835e41723b66b9 Mon Sep 17 00:00:00 2001 From: Mark Vanderwiel Date: Fri, 21 Nov 2014 12:18:21 -0600 Subject: [PATCH] Make compute 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 compute database. Make timeout to be optional to fix this problem. Change-Id: I1ca4c594da34134aa3807fca753b955ed0b239bd Related-Bug: #1389111 --- CHANGELOG.md | 1 + README.md | 1 + attributes/default.rb | 3 +++ recipes/nova-setup.rb | 1 + spec/nova-setup_spec.rb | 17 +++++++++++++++-- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2388c4e9..149f8217 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ This file is used to list changes made in each version of cookbook-openstack-com * Updated the nova-networking to start metadata-api * Allow rabbit ssl in the ha case * Move deprecated neutron_*/glance_*/cinder_* configurations to [neutron]/[glance]/[cinder] sections in nova.conf +* Allow dbsync_timeout to be configurable ## 9.3.1 * Move auth configuration from api-paste.ini to nova.conf diff --git a/README.md b/README.md index 6cea9e37..e4f65d01 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ Openstack Compute attributes are in the attribute namespace ["openstack"]["compu * `openstack['compute']['ssl_only'] = Disallow non-encrypted connections * `openstack['compute']['cert'] = SSL certificate file * `openstack['compute']['key'] = SSL key file (if separate from cert) +* `openstack['compute']['dbsync_timeout']` - Set dbsync command timeout value * `openstack["compute"]["compute"]["api"]["protocol"]` - Protocol used for the OS API * `openstack["compute"]["compute"]["api"]["port"]` - Port on which OS API runs * `openstack["compute"]["compute"]["api"]["version"]` - Version of the OS API used diff --git a/attributes/default.rb b/attributes/default.rb index 06cbdf2d..5cda42c6 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -36,6 +36,9 @@ default['openstack']['compute']['ec2_workers'] = nil default['openstack']['compute']['osapi_compute_workers'] = nil default['openstack']['compute']['metadata_workers'] = nil +# Set dbsync command timeout value +default['openstack']['compute']['dbsync_timeout'] = 3600 + # The name of the Chef role that sets up the Keystone Service API default['openstack']['compute']['identity_service_chef_role'] = 'os-identity' diff --git a/recipes/nova-setup.rb b/recipes/nova-setup.rb index bde38d06..2cc5db6f 100644 --- a/recipes/nova-setup.rb +++ b/recipes/nova-setup.rb @@ -28,6 +28,7 @@ nova_user = node['openstack']['compute']['user'] nova_group = node['openstack']['compute']['group'] execute 'nova-manage db sync' do + timeout node['openstack']['compute']['dbsync_timeout'] user nova_user group nova_group command 'nova-manage db sync' diff --git a/spec/nova-setup_spec.rb b/spec/nova-setup_spec.rb index 91e2170c..0d7ca808 100644 --- a/spec/nova-setup_spec.rb +++ b/spec/nova-setup_spec.rb @@ -11,8 +11,21 @@ describe 'openstack-compute::nova-setup' do include_context 'compute_stubs' include_examples 'expect_runs_nova_common_recipe' - it 'runs db migrations' do - expect(chef_run).to run_execute('nova-manage db sync').with(user: 'nova', group: 'nova') + it 'runs db migrations with default timeout' do + expect(chef_run).to run_execute('nova-manage db sync').with( + user: 'nova', + group: 'nova', + timeout: 3600 + ) + end + + it 'runs db migrations with timeout override' do + node.set['openstack']['compute']['dbsync_timeout'] = 1234 + expect(chef_run).to run_execute('nova-manage db sync').with( + user: 'nova', + group: 'nova', + timeout: 1234 + ) end it 'adds nova network ipv4 addresses' do