diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eecd0d..c8a8938 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This file is used to list changes made in each version of cookbook-openstack-ima * Add support for multiple rabbit mq hosts * Make auth_version to be v2.0 in configuration file * Set the default cinder version to be v2 +* stores in glance-api.conf configurable with node attribute ## 9.2.0 * python_packages database client attributes have been migrated to the -common cookbook diff --git a/README.md b/README.md index b5db7e9..80960f5 100644 --- a/README.md +++ b/README.md @@ -134,6 +134,7 @@ Attributes for the Image service are in the ['openstack']['image'] namespace. * `openstack['image']['upload_image']['']` - URL location of the `` image. There can be multiple instances of this line to define multiple imagess (eg natty, maverick, fedora17 etc) --- example `openstack['image']['upload_image']['natty']` - "http://c250663.r63.cf1.rackcdn.com/ubuntu-11.04-server-uec-amd64-multinic.tar.gz" * `openstack['image']['api']['default_store']` - Toggles the backend storage type. Currently supported is "file", "swift" and "rbd". +* `openstack['image']['api']['stores']` - List of which store classes and store class locations are currently known to glance at startup * `openstack['image']['api']['block-storage']['cinder_catalog_info']` - Info to match when looking for cinder in the service catalog * `openstack['image']['api']['block-storage']['cinder_api_insecure']` - Allow to perform insecure SSL requests to cinder (boolean value) * `openstack['image']['api']['block-storage']['cinder_ca_certificates_file']` - Location of ca certicates file to use for cinder client requests diff --git a/attributes/default.rb b/attributes/default.rb index ac04793..00233c3 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -107,6 +107,8 @@ default['openstack']['image']['api']['caching'] = false default['openstack']['image']['api']['cache_management'] = false default['openstack']['image']['api']['default_store'] = 'file' +# List of which store classes and store class locations are currently known to glance at startup +default['openstack']['image']['api']['stores'] = ['file', 'http'] default['openstack']['image']['filesystem_store_datadir'] = '/var/lib/glance/images' default['openstack']['image']['filesystem_store_metadata_file'] = nil diff --git a/spec/api_spec.rb b/spec/api_spec.rb index 9d5a634..e267306 100644 --- a/spec/api_spec.rb +++ b/spec/api_spec.rb @@ -131,6 +131,15 @@ describe 'openstack-image::api' do end end + it 'uses default stores attribute' do + expect(chef_run).to render_file(file.name).with_content(/^stores = file, http$/) + end + + it 'sets the stores attribute' do + node.set['openstack']['image']['api']['stores'] = ['swift'] + expect(chef_run).to render_file(file.name).with_content(/^stores = swift$/) + end + it 'uses default filesystem_store_metadata_file attribute' do expect(chef_run).not_to render_file(file.name).with_content(/^filesystem_store_metadata_file =/) end diff --git a/templates/default/glance-api.conf.erb b/templates/default/glance-api.conf.erb index 07f64d8..97e6fcc 100644 --- a/templates/default/glance-api.conf.erb +++ b/templates/default/glance-api.conf.erb @@ -9,26 +9,6 @@ verbose = <%= node["openstack"]["image"]["verbose"] %> #debug = False debug = <%= node["openstack"]["image"]["debug"] %> -# Which backend scheme should Glance use by default is not specified -# in a request to add a new image to Glance? Known schemes are determined -# by the known_stores option below. -# Default: 'file' -default_store = <%= node["openstack"]["image"]["api"]["default_store"] %> - -# List of which store classes and store class locations are -# currently known to glance at startup. -# Existing but disabled stores: -# glance.store.rbd.Store, -# glance.store.s3.Store, -# glance.store.swift.Store, -# glance.store.sheepdog.Store, -# glance.store.cinder.Store, -# glance.store.gridfs.Store, -# glance.store.vmware_datastore.Store, -#known_stores = glance.store.filesystem.Store, -# glance.store.http.Store - - # Maximum image size (in bytes) that may be uploaded through the # Glance API server. Defaults to 1 TB. # WARNING: this value should only be increased after careful consideration @@ -320,6 +300,26 @@ qpid_topology_version=<%= node["openstack"]["mq"]["image"]["qpid"]["topology_ver <% end %> <% end %> +[glance_store] +# Which backend scheme should Glance use by default is not specified +# in a request to add a new image to Glance? Known schemes are determined +# by the stores option below. +# Default: 'file' +default_store = <%= node["openstack"]["image"]["api"]["default_store"] %> + +# List of which store classes and store class locations are +# currently known to glance at startup. +# Existing but disabled stores: +# rbd, +# s3, +# swift, +# sheepdog, +# cinder, +# gridfs, +# vmware_datastore, +#stores = file, http +stores = <%= node["openstack"]["image"]["api"]["stores"].join(', ') %> + # ============ Filesystem Store Options ======================== # Directory that the Filesystem backend store