Add attribute for image api workers setting

- Add an attribute for ['openstack']['image']['api']['workers']
- Adjust the template for glance-api.conf to use this attributes
- Adjust the default value to be a maximum of 8 (but this can be
  overridden)
- Adjust spec tests to set the cpu value so they converge
- Add test to confirm this value can be set
- Add test to confirm the .min[8 , sets a max of 8.
- Add README.md attribute entry

Change-Id: I8bdbd8bc8fe9af7a9ca3bbc8856d5a200ce7be7b
Closes-Bug: #1274884
This commit is contained in:
Andy McCrae 2014-02-13 11:45:43 +00:00
parent e9a6523d88
commit 46b1cf80e2
10 changed files with 23 additions and 1 deletions

View File

@ -110,6 +110,7 @@ Attributes for the Image service are in the ['openstack']['image'] namespace.
* `openstack['image']['service_tenant_name']` - Tenant name used by glance when interacting with keystone - used in the API and registry paste.ini files
* `openstack['image']['service_user']` - User name used by glance when interacting with keystone - used in the API and registry paste.ini files
* `openstack['image']['service_role']` - User role used by glance when interacting with keystone - used in the API and registry paste.ini files
* `openstack['image']['api']['workers']` - Set the number of glance api workers.
* `openstack['image']['api']['show_image_direct_url']` - Allow glance to return URL referencing where data is stored on the backend. Default 'False'
* `openstack['image']['api']['auth']['cache_dir']` - Defaults to `/var/cache/glance/api`. Directory where `auth_token` middleware writes certificates for glance-api
* `openstack['image']['registry']['auth']['cache_dir']` - Defaults to `/var/cache/glance/registry`. Directory where `auth_token` middleware writes certificates for glance-registry

View File

@ -43,6 +43,9 @@ default['openstack']['image']['service_tenant_name'] = 'service'
default['openstack']['image']['service_user'] = 'glance'
default['openstack']['image']['service_role'] = 'admin'
# Set the number of api workers
default['openstack']['image']['api']['workers'] = [8, node['cpu']['total'].to_i].min
# Return the URL that references where the data is stored on the backend.
default['openstack']['image']['api']['show_image_direct_url'] = 'False'

View File

@ -123,6 +123,18 @@ describe 'openstack-image::api' do
/^flavor = keystone\+cachemanagement$/)
end
it 'has configurable api workers setting' do
node.set['openstack']['image']['api']['workers'] = 10
expect(chef_run).to render_file(file.name).with_content(
/^workers = 10$/)
end
it 'confirms default min value is set' do
node.set['cpu']['total'] = 10
expect(chef_run).to render_file(file.name).with_content(
/^workers = 8$/)
end
it 'sets show_image_direct_url appropriately' do
node.set['openstack']['image']['api']['show_image_direct_url'] = 'True'
expect(chef_run).to render_file(file.name).with_content(

View File

@ -8,6 +8,7 @@ describe 'openstack-image::client' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set_unless['cpu']['total'] = 1
runner.converge(described_recipe)
end

View File

@ -8,6 +8,7 @@ describe 'openstack-image::client' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set_unless['cpu']['total'] = 1
runner.converge(described_recipe)
end

View File

@ -5,6 +5,7 @@ describe 'openstack-image::identity_registration' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set_unless['cpu']['total'] = 1
runner.converge(described_recipe)
end

View File

@ -7,6 +7,7 @@ describe 'openstack-image::image_upload' do
let(:options) { UBUNTU_OPTS.merge(step_into: 'openstack_image_image') }
let(:node) { runner.node }
let(:chef_run) do
node.set_unless['cpu']['total'] = 1
runner.converge(described_recipe)
end

View File

@ -6,6 +6,7 @@ describe 'openstack-image::registry' do
let(:runner) { ChefSpec::Runner.new(REDHAT_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set_unless['cpu']['total'] = 1
runner.converge(described_recipe)
end

View File

@ -12,6 +12,7 @@ describe 'openstack-image::registry' do
let(:runner) { ChefSpec::Runner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
node.set_unless['cpu']['total'] = 1
runner.converge(described_recipe)
end

View File

@ -26,7 +26,7 @@ backlog = 4096
# may improve performance (especially if using SSL with
# compression turned on). It is typically recommended to set
# this value to the number of CPUs present on your machine.
workers = <%= node["cpu"]["total"] %>
workers = <%= node["openstack"]["image"]["api"]["workers"] %>
# SQLAlchemy connection string for the reference implementation
# registry server. Any valid SQLAlchemy connection string is fine.