refactoring final step

* removed rubocop exceptions in recipes and regenerated the
  .rubocop_todo.yaml containing all remaining exceptions
* removed fedora, suse as supported platform
* adapted optimized endpoint logic
* moved endpoints from openstack-common to default attr
* bumbed openstack-common and identity to higher version
  due to refactoring
* moved version up to 13.0.0
* adapt the specs (unit tests) to work again
* added new logic into templates/default/glance-*.conf.erb
* refactored attributes throughout all recipes that were connected to
  the attributes used for the glance-*.conf.erb template to adapt the new
  template attribute syntax
* moved all attibutes/default.rb that were used in glance-*.conf.erb to
  attributes/glance_*_conf.rb
* removed all attributes from default.rb and glance-*.conf.erb which are set
  as default in attributes, openstack doc and used to render the template
* seperated filestore config and deployment from default api recipe and made it
  optional (e.g. swift_store)
* removed service config templates in favor of openstack-service.conf.erb from
  common cookbook
* removed default support for most filestore backends in favor of an easily
  wrappable cookbook structure which allow the configuration of filestore
  backends in wrappers

Depends-On: I3262b2e6f792f37c32a446e6567790b82bdd4613
Depends-On: I0547182085eed91d05384fdd7734408a839a9a2c
Implements: blueprint cookbook-refactoring
Change-Id: Ifa5a7f4e1df47a3961976e64f654224864c3dcb4
This commit is contained in:
Christoph Albers 2015-12-07 15:19:53 +01:00
parent a2bbb0bd87
commit 6823eb84cb
26 changed files with 606 additions and 2882 deletions

View File

@ -1,11 +1,34 @@
# This configuration was generated by `rubocop --auto-gen-config`
# on 2015-05-29 10:08:48 -0500 using RuboCop version 0.29.1.
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2016-02-04 13:18:09 +0100 using RuboCop version 0.34.2.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 5
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 28
# Offense count: 6
# Configuration parameters: EnforcedStyle, SupportedStyles.
Style/ClassAndModuleChildren:
Enabled: false
Exclude:
- 'recipes/api.rb'
- 'recipes/client.rb'
- 'recipes/identity_registration.rb'
- 'recipes/image_upload.rb'
- 'recipes/registry.rb'
- 'recipes/swift_store.rb'
# Offense count: 6
# Configuration parameters: Exclude.
Style/Documentation:
Exclude:
- 'recipes/api.rb'
- 'recipes/client.rb'
- 'recipes/identity_registration.rb'
- 'recipes/image_upload.rb'
- 'recipes/registry.rb'
- 'recipes/swift_store.rb'

View File

@ -36,17 +36,11 @@ default['openstack']['image']['ssl']['api']['enabled'] = node['openstack']['imag
default['openstack']['image']['ssl']['registry']['enabled'] = node['openstack']['image']['ssl']['enabled']
# Base directory for SSL certficate and key
default['openstack']['image']['ssl']['basedir'] = '/etc/glance/ssl'
# Path of the cert file for SSL.
default['openstack']['image']['ssl']['cert_file'] = "#{node['openstack']['image']['ssl']['basedir']}/certs/sslcert.pem"
# Path of the keyfile for SSL.
default['openstack']['image']['ssl']['key_file'] = "#{node['openstack']['image']['ssl']['basedir']}/private/sslkey.pem"
# Specify server whether SSL certificate is required
default['openstack']['image']['ssl']['cert_required'] = false
# Path of the CA cert file for SSL. Only use if client certificate is required
default['openstack']['image']['ssl']['ca_file'] = "#{node['openstack']['image']['ssl']['basedir']}/certs/sslca.pem"
default['openstack']['image']['verbose'] = 'False'
default['openstack']['image']['debug'] = 'False'
# This is the name of the Chef role that will install the Keystone Service API
default['openstack']['image']['identity_service_chef_role'] = 'os-identity'
@ -56,130 +50,26 @@ default['openstack']['image']['region'] = node['openstack']['region']
# The name of the Chef role that knows about the message queue server
# that Glance uses
default['openstack']['image']['rabbit_server_chef_role'] = 'os-ops-messaging'
default['openstack']['image']['service_tenant_name'] = 'service'
default['openstack']['image']['service_user'] = 'glance'
default['openstack']['image']['service_role'] = 'service'
default['openstack']['image']['notification_driver'] = 'noop'
# RPC attributes
# The AMQP exchange to connect to if using RabbitMQ or Qpid
default['openstack']['image']['control_exchange'] = 'openstack'
# Size of RPC thread pool
default['openstack']['image']['rpc_thread_pool_size'] = 64
# Size of RPC connection pool
default['openstack']['image']['rpc_conn_pool_size'] = 30
# Seconds to wait for a response from call or multicall
default['openstack']['image']['rpc_response_timeout'] = 60
case node['openstack']['mq']['service_type']
when 'rabbitmq'
default['openstack']['image']['rpc_backend'] = 'rabbit'
when 'qpid'
default['openstack']['image']['rpc_backend'] = 'qpid'
end
# Set the number of api workers
default['openstack']['image']['api']['workers'] = [8, node['cpu']['total'].to_i].min
# Set the number of registry workers
default['openstack']['image']['registry']['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'
default['openstack']['image']['service_role'] = 'admin'
# Supported values for the 'container_format' image attribute
default['openstack']['image']['api']['container_formats'] = %w(ami ari aki bare ovf ova docker dockerref)
# Supported values for the 'disk_format' image attribute
default['openstack']['image']['api']['disk_formats'] = %w(ami ari aki vhd vmdk raw qcow2 vdi iso)
default['openstack']['image']['api']['auth']['version'] = node['openstack']['api']['auth']['version']
default['openstack']['image']['registry']['auth']['version'] = node['openstack']['api']['auth']['version']
# Keystone PKI signing directories
# XXX keystoneclient wants these dirs to exist even if it doesn't use them
default['openstack']['image']['api']['auth']['cache_dir'] = '/var/cache/glance/api'
default['openstack']['image']['registry']['auth']['cache_dir'] = '/var/cache/glance/registry'
# A list of memcached server(s) to use for caching
default['openstack']['image']['api']['auth']['memcached_servers'] = nil
default['openstack']['image']['registry']['auth']['memcached_servers'] = nil
# Whether token data should be authenticated or authenticated and encrypted. Acceptable values are MAC or ENCRYPT
default['openstack']['image']['api']['auth']['memcache_security_strategy'] = nil
default['openstack']['image']['registry']['auth']['memcache_security_strategy'] = nil
# This string is used for key derivation
default['openstack']['image']['api']['auth']['memcache_secret_key'] = nil
default['openstack']['image']['registry']['auth']['memcache_secret_key'] = nil
# Hash algorithms to use for hashing PKI tokens
default['openstack']['image']['api']['auth']['hash_algorithms'] = 'md5'
default['openstack']['image']['registry']['auth']['hash_algorithms'] = 'md5'
# A PEM encoded Certificate Authority to use when verifying HTTPs connections
default['openstack']['image']['api']['auth']['cafile'] = nil
default['openstack']['image']['registry']['auth']['cafile'] = nil
# Verify HTTPS connections
default['openstack']['image']['api']['auth']['insecure'] = false
default['openstack']['image']['registry']['auth']['insecure'] = false
# Whether to use any of the default caching pipelines from the paste configuration file
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
# The following two attributes are only available when filesystem_store_metadata_file is specified but
# not exist
# An opaque string. In order for this module to know that the remote FS is the same one that is mounted
# locally it must share information with the nova-compute deployment. Both glance and nova-compute must
# be configured with an unqiue matching string. For example: '00000000-0000-0000-0000-000000000000'
default['openstack']['image']['filesystem_store_metadata_id'] = nil
# The location at which the file system is locally mounted. Nova-compute will directly access Glance images
# from this local filesystem path. For example: '/mount/some_fs/images'
default['openstack']['image']['filesystem_store_metadata_mountpoint'] = nil
default['openstack']['image']['api']['swift']['container'] = 'glance'
default['openstack']['image']['api']['swift']['large_object_size'] = '200'
default['openstack']['image']['api']['swift']['large_object_chunk_size'] = '200'
default['openstack']['image']['api']['swift']['enable_snet'] = 'False'
default['openstack']['image']['api']['swift']['store_region'] = nil
default['openstack']['image']['api']['cache']['image_cache_max_size'] = '10737418240'
# Info to match when looking for cinder in the service catalog
default['openstack']['image']['api']['block-storage']['cinder_catalog_info'] = 'volumev2:cinderv2:publicURL'
# Allow to perform insecure SSL requests to cinder (boolean value)
default['openstack']['image']['api']['block-storage']['cinder_api_insecure'] = false
# Location of ca certicates file to use for cinder client requests
default['openstack']['image']['api']['block-storage']['cinder_ca_certificates_file'] = nil
# Directory for the Image Cache
default['openstack']['image']['cache']['dir'] = '/var/lib/glance/image-cache/'
# Number of seconds until an incomplete image is considered stalled an
# eligible for reaping
default['openstack']['image']['cache']['stall_time'] = 86400
# Number of seconds to leave invalid images around before they are eligible to be reaped
default['openstack']['image']['cache']['grace_period'] = 3600
# Ceph Options
default['openstack']['image']['api']['rbd']['ceph_conf'] = '/etc/ceph/ceph.conf'
default['openstack']['image']['api']['rbd']['user'] = 'glance'
default['openstack']['image']['api']['rbd']['pool'] = 'images'
default['openstack']['image']['api']['rbd']['chunk_size'] = '8'
# API to use for accessing data. Default value points to sqlalchemy
# package.
default['openstack']['image']['data_api'] = 'glance.db.sqlalchemy.api'
# Default Image Locations
default['openstack']['image']['upload_images'] = ['cirros']
default['openstack']['image']['upload_image']['precise'] = 'http://cloud-images.ubuntu.com/precise/current/precise-server-cloudimg-amd64-disk1.img'
@ -200,21 +90,13 @@ default['openstack']['image']['syslog']['config_facility'] = 'local2'
# vmware attributes
default['openstack']['image']['api']['vmware']['secret_name'] = 'openstack_vmware_secret_name'
default['openstack']['image']['api']['vmware']['vmware_server_host'] = ''
default['openstack']['image']['api']['vmware']['vmware_server_username'] = ''
default['openstack']['image']['api']['vmware']['vmware_datacenter_path'] = ''
default['openstack']['image']['api']['vmware']['vmware_datastore_name'] = ''
default['openstack']['image']['api']['vmware']['vmware_api_retry_count'] = 10
default['openstack']['image']['api']['vmware']['vmware_task_poll_interval'] = 5
default['openstack']['image']['api']['vmware']['vmware_store_image_dir'] = '/openstack_glance'
default['openstack']['image']['api']['vmware']['vmware_api_insecure'] = false
# cron output redirection
default['openstack']['image']['cron']['redirection'] = '> /dev/null 2>&1'
# platform-specific settings
case platform_family
when 'fedora', 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
when 'rhel' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['image']['user'] = 'glance'
default['openstack']['image']['group'] = 'glance'
default['openstack']['image']['platform'] = {
@ -254,3 +136,20 @@ when 'debian'
'package_overrides' => "-o Dpkg::Options::='--force-confold' -o Dpkg::Options::='--force-confdef'"
}
end
# ******************** OpenStack Image Endpoints ******************************
# The OpenStack Image (Glance) endpoints
%w(public internal admin).each do |ep_type|
%w(image_api image_registry).each do |service|
default['openstack']['endpoints'][service][ep_type]['scheme'] = 'http'
default['openstack']['endpoints']['image_api'][ep_type]['path'] = ''
default['openstack']['endpoints']['image_registry'][ep_type]['path'] = '/v2'
end
%w(endpoints bind_service).each do |type|
default['openstack'][type]['image_registry'][ep_type]['host'] = '127.0.0.1'
default['openstack'][type]['image_registry'][ep_type]['port'] = 9191
default['openstack'][type]['image_api'][ep_type]['host'] = '127.0.0.1'
default['openstack'][type]['image_api'][ep_type]['port'] = 9292
end
end

View File

@ -0,0 +1,22 @@
default['openstack']['image_api']['conf'].tap do |conf|
# [DEFAULT] section
if node['openstack']['image']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
else
conf['DEFAULT']['log_file'] = '/var/log/glance/api.log'
end
conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type']
# [glance_store] section
conf['glance_store']['default_store'] = 'file'
# [paste_deploy] section
conf['paste_deploy']['flavor'] = 'keystone'
# [keystone_authtoken] section
conf['keystone_authtoken']['auth_plugin'] = 'v2password'
conf['keystone_authtoken']['region_name'] = node['openstack']['region']
conf['keystone_authtoken']['username'] = 'glance'
conf['keystone_authtoken']['tenant_name'] = 'service'
conf['keystone_authtoken']['signing_dir'] = '/var/cache/glance/api'
end

View File

@ -0,0 +1,9 @@
default['openstack']['image-cache']['conf'].tap do |conf|
# [DEFAULT] section
if node['openstack']['image']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
else
conf['DEFAULT']['log_file'] = '/var/log/glance/image-cache.log'
end
conf['DEFAULT']['image_cache_dir'] = '/var/lib/glance/image-cache/' # none in docs
end

View File

@ -0,0 +1,19 @@
default['openstack']['image_registry']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['rpc_backend'] = node['openstack']['mq']['service_type']
if node['openstack']['image']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
else
conf['DEFAULT']['log_file'] = '/var/log/glance/registry.log'
end
# [paste_deploy] section
conf['paste_deploy']['flavor'] = 'keystone'
# [keystone_authtoken] section
conf['keystone_authtoken']['auth_plugin'] = 'v2password'
conf['keystone_authtoken']['region_name'] = node['openstack']['region']
conf['keystone_authtoken']['username'] = 'glance'
conf['keystone_authtoken']['tenant_name'] = 'service'
conf['keystone_authtoken']['signing_dir'] = '/var/cache/glance/registry' # none in docs
end

View File

@ -0,0 +1,9 @@
default['openstack']['image-scrubber']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['verbose'] = false
if node['openstack']['image']['syslog']['use']
conf['DEFAULT']['log_config'] = '/etc/openstack/logging.conf'
else
conf['DEFAULT']['log_file'] = '/var/log/glance/scrubber.log'
end
end

View File

@ -4,17 +4,16 @@ maintainer_email 'openstack-dev@lists.openstack.org'
license 'Apache 2.0'
description 'Installs and configures the Glance Image Registry and Delivery Service'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '12.0.0'
version '13.0.0'
recipe 'openstack-image::api', 'Installs packages required for a glance api server'
recipe 'openstack-image::client', 'Install packages required for glance client'
recipe 'openstack-image::registry', 'Installs packages required for a glance registry server'
recipe 'openstack-image::identity_registration', 'Registers Glance endpoints and service with Keystone'
recipe 'openstack-image::image_upload', 'Upload image using glance image-create command'
%w(ubuntu fedora redhat centos suse).each do |os|
%w(ubuntu redhat centos).each do |os|
supports os
end
depends 'openstack-common', '>= 12.0.0'
depends 'openstack-identity', '>= 12.0.0'
depends 'ceph', '>= 0.8.1'
depends 'openstack-common', '>= 13.0.0'
depends 'openstack-identity', '>= 13.0.0'

View File

@ -31,7 +31,7 @@ action :upload do
url = new_resource.image_url
public = new_resource.image_public
ep = endpoint 'image-api'
ep = public_endpoint 'image_api'
api = ep.to_s.gsub(ep.path, '') # remove trailing /v2
type = new_resource.image_type
@ -79,7 +79,7 @@ def _upload_image_bare(name, api, url, public, type)
end
# TODO(chrislaco) This refactor is in the works via Craig Tracey
def _upload_ami(name, api, url, public) # rubocop:disable MethodLength
def _upload_ami(name, api, url, public)
glance_cmd = "glance --insecure --os-username #{@user} --os-password #{@pass} --os-tenant-name #{@tenant} --os-image-url #{api} --os-auth-url #{@ks_uri}"
aki_fmt = '--container-format aki --disk-format aki'
ari_fmt = '--container-format ari --disk-format ari'

View File

@ -19,31 +19,20 @@
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
require 'uri'
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end
include_recipe 'openstack-identity::client'
if node['openstack']['image']['syslog']['use']
include_recipe 'openstack-common::logging'
end
platform_options = node['openstack']['image']['platform']
package 'python-keystoneclient' do
options platform_options['package_overrides']
action :upgrade
end
package 'curl' do
options platform_options['package_overrides']
action :upgrade
end
platform_options['image_packages'].each do |pkg|
package pkg do
action :upgrade
@ -51,182 +40,126 @@ platform_options['image_packages'].each do |pkg|
end
end
if node['openstack']['image']['api']['default_store'] == 'swift'
platform_options['swift_packages'].each do |pkg|
package pkg do
action :upgrade
options platform_options['package_overrides']
end
end
elsif node['openstack']['image']['api']['default_store'] == 'rbd'
include_recipe 'ceph'
caps = { 'mon' => 'allow r',
'osd' => "allow class-read object_prefix rbd_children, allow rwx pool=#{node['openstack']['image']['api']['rbd']['pool']}" }
ceph_client node['openstack']['image']['api']['rbd']['user'] do
name node['openstack']['image']['api']['rbd']['user']
caps caps
keyname "client.#{node['openstack']['image']['api']['rbd']['user']}"
filename "/etc/ceph/ceph.client.#{node['openstack']['image']['api']['rbd']['user']}.keyring"
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
action :add
notifies :restart, 'service[glance-api]'
end
end
service 'glance-api' do
service_name platform_options['image_api_service']
supports status: true, restart: true
action :enable
end
directory '/etc/glance' do
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00700
end
directory node['openstack']['image']['api']['auth']['cache_dir'] do
directory node['openstack']['image_api']['conf']['keystone_authtoken']['signing_dir'] do
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00700
recursive true
end
glance = node['openstack']['image']
identity_endpoint = internal_endpoint 'identity-internal'
identity_admin_endpoint = admin_endpoint 'identity-admin'
service_pass = get_password 'service', 'openstack-image'
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['api']['auth']['version']
identity_uri = identity_uri_transform(identity_admin_endpoint)
db_user = node['openstack']['db']['image']['username']
db_pass = get_password 'db', 'glance'
sql_connection = db_uri('image', db_user, db_pass)
mq_service_type = node['openstack']['mq']['image']['service_type']
if mq_service_type == 'rabbitmq'
node['openstack']['mq']['image']['rabbit']['ha'] && (rabbit_hosts = rabbit_servers)
mq_password = get_password 'user', node['openstack']['mq']['image']['rabbit']['userid']
elsif mq_service_type == 'qpid'
mq_password = get_password 'user', node['openstack']['mq']['image']['qpid']['username']
end
registry_endpoint = internal_endpoint 'image-registry'
api_bind = internal_endpoint 'image-api-bind'
cinder_endpoint = internal_endpoint 'block-storage-api'
# Possible combinations of options here
# - default_store=file
# * no other options required
# - default_store=swift
# * if swift_store_auth_address is not defined
# - default to local swift
# * else if swift_store_auth_address is defined
# - get swift_store_auth_address, swift_store_user, swift_store_key, and
# swift_store_auth_version from the node attributes and use them to connect
# to the swift compatible API service running elsewhere - possibly
# Rackspace Cloud Files.
if glance['api']['swift_store_auth_address'].nil?
swift_store_auth_address = auth_uri
swift_store_user = "#{glance['service_tenant_name']}_#{glance['service_user']}"
swift_user_tenant = nil
swift_store_key = service_pass
swift_store_auth_version = 2
else
swift_store_auth_address = glance['api']['swift_store_auth_address']
swift_user_tenant = glance['api']['swift_user_tenant']
swift_store_user = glance['api']['swift_store_user']
swift_store_key = get_password 'service', swift_store_user
swift_store_auth_version = glance['api']['swift_store_auth_version']
end
glance_flavor = 'keystone'
if glance['api']['cache_management']
glance_flavor += '+cachemanagement'
elsif glance['api']['caching']
glance_flavor += '+caching'
end
unless node['openstack']['image']['api']['vmware']['vmware_server_host'].empty?
vmware_server_password = get_password 'token', node['openstack']['image']['api']['vmware']['secret_name']
end
if glance['filesystem_store_metadata_file']
template glance['filesystem_store_metadata_file'] do
source 'glance-metadata.json.erb'
owner glance['user']
group glance['group']
mode 00640
not_if { ::File.exist?(glance['filesystem_store_metadata_file']) }
if node['openstack']['image_api']['conf']['glance_store']['default_store'] == 'file'
node.default['openstack']['image_api']['conf']['glance_store']['filesystem_store_datadir'] =
'/var/lib/glance/images'
directory node['openstack']['image_api']['conf']['glance_store']['filesystem_store_datadir'] do
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00750
recursive true
end
end
identity_endpoint = public_endpoint 'identity'
node.default['openstack']['image_api']['conf_secrets']
.[]('keystone_authtoken')['password'] =
get_password 'service', 'openstack-image'
auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version']
db_user = node['openstack']['db']['image']['username']
db_pass = get_password 'db', 'glance'
node.default['openstack']['image_api']['conf_secrets']
.[]('database')['connection'] =
db_uri('image', db_user, db_pass)
if node['openstack']['image_api']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
user = node['openstack']['mq']['image']['rabbit']['userid']
node.default['openstack']['image_api']['conf_secrets']
.[]('oslo_messaging_rabbit')['rabbit_userid'] = user
node.default['openstack']['image_api']['conf_secrets']
.[]('oslo_messaging_rabbit')['rabbit_password'] =
get_password 'user', user
end
registry_endpoint = internal_endpoint 'image_registry'
api_bind = node['openstack']['bind_service']['image_api']['internal']
node.default['openstack']['image_api']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['bind_host'] = api_bind.host
conf['DEFAULT']['bind_port'] = api_bind.port
conf['DEFAULT']['registry_host'] = registry_endpoint.host
conf['DEFAULT']['registry_port'] = registry_endpoint.port
conf['DEFAULT']['registry_client_protocol'] = registry_endpoint.scheme
# [keystone_authtoken] section
conf['keystone_authtoken']['auth_url'] = auth_url
end
node.default['openstack']['image_cache']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['registry_host'] = registry_endpoint.host
conf['DEFAULT']['registry_port'] = registry_endpoint.port
end
node.default['openstack']['image_scrubber']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['registry_host'] = registry_endpoint.host
conf['DEFAULT']['registry_port'] = registry_endpoint.port
end
# merge all config options and secrets
glance_api_conf = merge_config_options 'image_api'
glance_cache_conf = merge_config_options 'image_cache'
glance_scrubber_conf = merge_config_options 'image_scrubber'
template '/etc/glance/glance-api.conf' do
source 'glance-api.conf.erb'
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00640
variables(
api_bind_address: api_bind.host,
api_bind_port: api_bind.port,
registry_ip_address: registry_endpoint.host,
registry_port: registry_endpoint.port,
registry_scheme: registry_endpoint.scheme,
sql_connection: sql_connection,
glance_flavor: glance_flavor,
auth_uri: auth_uri,
identity_uri: identity_uri,
cinder_endpoint: cinder_endpoint,
service_pass: service_pass,
rabbit_hosts: rabbit_hosts,
swift_store_key: swift_store_key,
swift_user_tenant: swift_user_tenant,
swift_store_user: swift_store_user,
swift_store_auth_address: swift_store_auth_address,
swift_store_auth_version: swift_store_auth_version,
notification_driver: node['openstack']['image']['notification_driver'],
mq_service_type: mq_service_type,
mq_password: mq_password,
vmware_server_password: vmware_server_password
service_config: glance_api_conf
)
notifies :restart, 'service[glance-api]', :immediately
end
template '/etc/glance/glance-cache.conf' do
source 'glance-cache.conf.erb'
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00640
variables(
registry_ip_address: registry_endpoint.host,
registry_port: registry_endpoint.port,
vmware_server_password: vmware_server_password
service_config: glance_cache_conf
)
notifies :restart, 'service[glance-api]', :immediately
end
template '/etc/glance/glance-scrubber.conf' do
source 'glance-scrubber.conf.erb'
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00640
variables(
registry_ip_address: registry_endpoint.host,
registry_port: registry_endpoint.port
service_config: glance_scrubber_conf
)
end
%w(image_api image_cache image_scrubber).each do |service|
# delete all secrets saved in the attribute
# node['openstack']['pi]['conf_secrets'] after creating the glance-api.conf
ruby_block "delete all attributes in node['openstack']['#{service}']['conf_secrets']" do
block do
node.rm('openstack', service, 'conf_secrets')
end
end
end
# Configure glance-cache-pruner to run every 30 minutes
cron 'glance-cache-pruner' do
minute '*/30'
@ -248,11 +181,13 @@ directory node['openstack']['image']['cache']['dir'] do
mode 00755
end
if node['openstack']['image']['api']['default_store'] == 'file'
directory node['openstack']['image']['filesystem_store_datadir'] do
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00750
recursive true
end
service 'glance-api' do
service_name platform_options['image_api_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, [
'template[/etc/glance/glance-scrubber.conf]',
'template[/etc/glance/glance-cache.conf]',
'template[/etc/glance/glance-api.conf]'
]
end

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end
@ -26,7 +26,6 @@ platform_options = node['openstack']['image']['platform']
platform_options['image_client_packages'].each do |pkg|
package pkg do
options platform_options['package_overrides']
action :upgrade
end
end

View File

@ -22,24 +22,26 @@
require 'uri'
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end
identity_admin_endpoint = admin_endpoint 'identity-admin'
identity_admin_endpoint = admin_endpoint 'identity'
token = get_password 'token', 'openstack_identity_bootstrap_token'
auth_url = ::URI.decode identity_admin_endpoint.to_s
api_internal_endpoint = internal_endpoint 'image-api'
api_public_endpoint = public_endpoint 'image-api'
api_admin_endpoint = admin_endpoint 'image-api'
api_internal_endpoint = internal_endpoint 'image_api'
api_public_endpoint = public_endpoint 'image_api'
api_admin_endpoint = admin_endpoint 'image_api'
service_pass = get_password 'service', 'openstack-image'
service_tenant_name = node['openstack']['image']['service_tenant_name']
service_user = node['openstack']['image']['service_user']
service_tenant_name =
node['openstack']['image_api']['conf']['keystone_authtoken']['tenant_name']
service_user =
node['openstack']['image_api']['conf']['keystone_authtoken']['username']
service_role = node['openstack']['image']['service_role']
region = node['openstack']['image']['region']
region = node['openstack']['region']
# Register Image Service
openstack_identity_register 'Register Image Service' do
@ -48,7 +50,6 @@ openstack_identity_register 'Register Image Service' do
service_name 'glance'
service_type 'image'
service_description 'Glance Image Service'
action :create_service
end
@ -61,7 +62,6 @@ openstack_identity_register 'Register Image Endpoint' do
endpoint_adminurl api_admin_endpoint.to_s
endpoint_internalurl api_internal_endpoint.to_s
endpoint_publicurl api_public_endpoint.to_s
action :create_endpoint
end
@ -72,7 +72,6 @@ openstack_identity_register 'Register Service Tenant' do
tenant_name service_tenant_name
tenant_description 'Service Tenant'
tenant_enabled true # Not required as this is the default
action :create_tenant
end
@ -85,7 +84,6 @@ openstack_identity_register "Register #{service_user} User" do
user_pass service_pass
# String until https://review.openstack.org/#/c/29498/ merged
user_enabled true
action :create_user
end
@ -96,6 +94,5 @@ openstack_identity_register "Grant '#{service_role}' Role to #{service_user} Use
tenant_name service_tenant_name
user_name service_user
role_name service_role
action :grant_role
end

View File

@ -18,7 +18,7 @@
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end
@ -33,16 +33,15 @@ platform_options['image_client_packages'].each do |pkg|
end
end
identity_endpoint = internal_endpoint 'identity-internal'
package 'curl' do
options platform_options['package_overrides']
action :upgrade
end
# For glance client, only identity v2 is supported. See discussion on
# https://bugs.launchpad.net/openstack-chef/+bug/1207504
# So here auth_uri can not be transformed.
auth_uri = identity_endpoint.to_s
admin_user = node['openstack']['identity']['admin_user']
admin_pass = get_password 'user', admin_user
admin_tenant = node['openstack']['identity']['admin_tenant_name']
auth_uri = public_endpoint('identity').to_s
admin_user = node['openstack']['image_api']['conf']['keystone_authtoken']['username']
admin_pass = get_password 'service', 'openstack-image'
admin_tenant = node['openstack']['image_api']['conf']['keystone_authtoken']['tenant_name']
node['openstack']['image']['upload_images'].each do |img|
type = 'unknown'

View File

@ -20,7 +20,7 @@
# limitations under the License.
#
class ::Chef::Recipe # rubocop:disable Documentation
class ::Chef::Recipe
include ::Openstack
end
@ -37,33 +37,30 @@ end
db_user = node['openstack']['db']['image']['username']
db_pass = get_password 'db', 'glance'
sql_connection = db_uri('image', db_user, db_pass)
node.default['openstack']['image_registry']['conf_secrets']
.[]('database')['connection'] =
db_uri('image', db_user, db_pass)
mq_service_type = node['openstack']['mq']['image']['service_type']
if mq_service_type == 'rabbitmq'
node['openstack']['mq']['image']['rabbit']['ha'] && (rabbit_hosts = rabbit_servers)
mq_password = get_password 'user', node['openstack']['mq']['image']['rabbit']['userid']
elsif mq_service_type == 'qpid'
mq_password = get_password 'user', node['openstack']['mq']['image']['qpid']['username']
if node['openstack']['image_registry']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
user = node['openstack']['mq']['image']['rabbit']['userid']
node.default['openstack']['image_registry']['conf_secrets']
.[]('oslo_messaging_rabbit')['rabbit_userid'] = user
node.default['openstack']['image_registry']['conf_secrets']
.[]('oslo_messaging_rabbit')['rabbit_password'] =
get_password 'user', user
end
identity_endpoint = internal_endpoint 'identity-internal'
identity_admin_endpoint = admin_endpoint 'identity-admin'
registry_bind = internal_endpoint 'image-registry-bind'
service_pass = get_password 'service', 'openstack-image'
identity_endpoint = public_endpoint 'identity'
registry_bind = node['openstack']['bind_service']['image_registry']['internal']
auth_uri = auth_uri_transform identity_endpoint.to_s, node['openstack']['image']['registry']['auth']['version']
identity_uri = identity_uri_transform(identity_admin_endpoint)
node.default['openstack']['image_registry']['conf_secrets']
.[]('keystone_authtoken')['password'] =
get_password 'service', 'openstack-image'
auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version']
glance_user = node['openstack']['image']['user']
glance_group = node['openstack']['image']['group']
package 'curl' do
options platform_options['package_overrides']
action :upgrade
end
db_type = node['openstack']['db']['image']['service_type']
node['openstack']['db']['python_packages'][db_type].each do |pkg|
package pkg do
@ -79,59 +76,46 @@ platform_options['image_packages'].each do |pkg|
end
end
directory node['openstack']['image']['registry']['auth']['cache_dir'] do
directory node['openstack']['image_registry']['conf']['keystone_authtoken']['signing_dir'] do
owner glance_user
group glance_group
mode 00700
recursive true
end
service 'glance-registry' do
service_name platform_options['image_registry_service']
supports status: true, restart: true
action :enable
end
file '/var/lib/glance/glance.sqlite' do
action :delete
not_if { node['openstack']['db']['image']['service_type'] == 'sqlite' }
end
directory '/etc/glance' do
owner glance_user
group glance_group
mode 00700
node.default['openstack']['image_registry']['conf'].tap do |conf|
# [DEFAULT] section
conf['DEFAULT']['bind_host'] = registry_bind.host
conf['DEFAULT']['bind_port'] = registry_bind.port
# [keystone_authtoken] section
conf['keystone_authtoken']['auth_url'] = auth_url
end
# merge all config options and secrets to be used in the nova.conf.erb
glance_registry_conf_options = merge_config_options 'image_registry'
template '/etc/glance/glance-registry.conf' do
source 'glance-registry.conf.erb'
source 'openstack-service.conf.erb'
cookbook 'openstack-common'
owner node['openstack']['image']['user']
group node['openstack']['image']['group']
mode 00640
variables(
:registry_bind_address => registry_bind.host,
:registry_bind_port => registry_bind.port,
:sql_connection => sql_connection,
:auth_uri => auth_uri,
:identity_uri => identity_uri,
notification_driver: node['openstack']['image']['notification_driver'],
mq_service_type: mq_service_type,
mq_password: mq_password,
'service_pass' => service_pass,
rabbit_hosts: rabbit_hosts
service_config: glance_registry_conf_options
)
notifies :restart, 'service[glance-registry]', :immediately
end
# Having to manually version the database because of Ubuntu bug
# https://bugs.launchpad.net/ubuntu/+source/glance/+bug/981111
execute 'glance-manage version_control 0' do
user glance_user
group glance_group
not_if 'glance-manage db_version', user: glance_user, group: glance_group
only_if { platform_family?('debian') }
# delete all secrets saved in the attribute
# node['openstack']['image_registry']['conf_secrets'] after creating the glance-registry.conf
ruby_block "delete all attributes in node['openstack']['image_registry']['conf_secrets']" do
block do
node.rm(:openstack, :image_registry, :conf_secrets)
end
end
execute 'glance-manage db_sync' do
@ -139,3 +123,10 @@ execute 'glance-manage db_sync' do
group glance_group
only_if { node['openstack']['db']['image']['migrate'] }
end
service 'glance-registry' do
service_name platform_options['image_registry_service']
supports status: true, restart: true
action [:enable, :start]
subscribes :restart, 'template[/etc/glance/glance-registry.conf]'
end

48
recipes/swift_store.rb Normal file
View File

@ -0,0 +1,48 @@
# encoding: UTF-8
#
# Cookbook Name:: openstack-image
# Recipe:: swift_store
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class ::Chef::Recipe
include ::Openstack
end
platform_options = node['openstack']['image']['platform']
platform_options['swift_packages'].each do |pkg|
package pkg do
action :upgrade
options platform_options['package_overrides']
end
end
identity_endpoint = public_endpoint 'identity'
swift_store_auth_address =
auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version']
tenant = node['openstack']['image_api']['conf']['keystone_authtoken']['tenant_name']
user = node['openstack']['image_api']['conf']['keystone_authtoken']['user']
swift_store_user = "#{tenant}_#{user}"
swift_user_tenant = nil
node.default['openstack']['image_api']['conf_secrets']
.[]('glance_store')['swift_store_key'] =
get_password 'service', 'openstack-image'
swift_store_auth_version = 2
node.default['openstack']['image_api']['conf']['glance_store'].tap do |store|
store['default_store'] = 'swift'
store['swift_store_auth_version'] = swift_store_auth_version
store['swift_store_auth_address'] = swift_store_auth_address
store['swift_store_user'] = "#{swift_user_tenant}:#{swift_store_user}"
end

View File

@ -19,13 +19,7 @@ describe 'openstack-image::api' do
expect(chef_run).not_to upgrade_package('openstack-swift')
end
it 'upgrades swift package if openstack/image/api/default_store is swift' do
node.set['openstack']['image']['api']['default_store'] = 'swift'
expect(chef_run).to upgrade_package('openstack-swift')
end
it 'starts glance api on boot' do
it do
expect(chef_run).to enable_service('openstack-glance-api')
end
end

View File

@ -1,501 +1,132 @@
# encoding: UTF-8
require_relative 'spec_helper'
shared_context 'vmware settings configurator' do
before do
node.set['openstack']['image']['api']['vmware']['vmware_server_host'] = 'vmware_server_host_value'
node.set['openstack']['image']['api']['vmware']['secret_name'] = 'vmware_secret_name'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'vmware_secret_name')
.and_return('vmware_server_password_value')
end
%w(server_host server_username server_password datacenter_path datastore_name api_retry_count
task_poll_interval store_image_dir api_insecure).each do |attr|
it "sets the vmware #{attr} attribute" do
node.set['openstack']['image']['api']['vmware']["vmware_#{attr}"] = "vmware_#{attr}_value"
expect(chef_run).to render_file(file_name).with_content(/^vmware_#{attr} = vmware_#{attr}_value$/)
end
end
end
describe 'openstack-image::api' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
let(:chef_run) do
cached(:chef_run) do
runner.converge(described_recipe)
end
include Helpers
include_context 'image-stubs'
include_examples 'common-logging-recipe'
include_examples 'common-packages'
include_examples 'image-lib-cache-directory'
include_examples 'glance-directory'
it do
expect(chef_run).to create_directory('/var/cache/glance/api').with(
user: 'glance',
group: 'glance',
mode: 00700
)
expect(chef_run).to include_recipe('openstack-identity::client')
end
it 'does not upgrade swift package by default' do
expect(chef_run).not_to upgrade_package('python-swift')
it do
expect(chef_run).to upgrade_package('glance')
end
it 'starts glance api on boot' do
expect(chef_run).to enable_service('glance-api')
it do
expect(chef_run).to create_directory('/etc/glance')
.with(
user: 'glance',
group: 'glance',
mode: 00700
)
end
describe 'using swift for default_store' do
before do
node.set['openstack']['image']['api']['default_store'] = 'swift'
end
it 'upgrades swift package if openstack/image/api/default_store is swift' do
expect(chef_run).to upgrade_package('python-swift')
end
it 'honors platform package name and option overrides for swift packages' do
node.set['openstack']['image']['platform']['package_overrides'] = '--override1 --override2'
node.set['openstack']['image']['platform']['swift_packages'] = ['my-swift']
expect(chef_run).to upgrade_package('my-swift').with(options: '--override1 --override2')
end
it do
expect(chef_run).to create_directory('/var/lib/glance/images')
.with(
user: 'glance',
group: 'glance',
mode: 00750,
recursive: true
)
end
describe 'using rbd for default_store' do
before do
node.set['openstack']['image']['api']['default_store'] = 'rbd'
node.set['ceph']['config']['fsid'] = '00000000-0000-0000-0000-000000000000'
end
it 'includes the ceph package' do
expect(chef_run).to include_recipe('ceph')
end
end
it 'starts glance api on boot' do
expect(chef_run).to enable_service('glance-api')
it do
expect(chef_run).to create_directory('/var/cache/glance/api')
.with(
user: 'glance',
group: 'glance',
mode: 00700,
recursive: true
)
end
describe 'glance-api.conf' do
let(:file) { chef_run.template('/etc/glance/glance-api.conf') }
it 'creates glance-api.conf' do
expect(chef_run).to create_template(file.name).with(
user: 'glance',
group: 'glance',
mode: 00640
)
it do
expect(chef_run).to create_template(file.name)
.with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'glance',
group: 'glance',
mode: 00640
)
end
context 'template contents' do
include_context 'endpoint-stubs'
include_context 'sql-stubs'
it_behaves_like 'custom template banner displayer' do
let(:file_name) { file.name }
end
context 'glance-api configuration with ssl enabled' do
default_opts = {
cert_file: '/etc/glance/ssl/certs/sslcert.pem',
key_file: '/etc/glance/ssl/private/sslkey.pem'
}
it 'configures SSL cert and key file when api is enabled for ssl' do
node.set['openstack']['image']['ssl']['api']['enabled'] = true
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
it 'configures SSL cert and key file when glance is enabled ssl' do
node.set['openstack']['image']['ssl']['enabled'] = true
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
end
context 'glance-api configuration with ssl disabled' do
default_opts = {
cert_file: '/etc/glance/ssl/certs/sslcert.pem',
key_file: '/etc/glance/ssl/private/sslkey.pem'
}
it 'does not set cert or key file' do
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
end
context 'glance-registry configuration with ssl enabled' do
it 'sets registry client protocol to https' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^registry_client_protocol = https$/)
end
context 'glance-registry with cert required' do
it 'configures CA cert file' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
node.set['openstack']['image']['ssl']['cert_required'] = true
node.set['openstack']['image']['registry']['auth']['cafile'] = '/etc/glance/ssl/certs/sslca.pem'
r = line_regexp('registry_client_ca_file = /etc/glance/ssl/certs/sslca.pem')
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
context 'glance-registry key and cert files' do
default_opts = {
registry_client_cert_file: '/etc/glance/ssl/certs/sslcert.pem',
registry_client_key_file: '/etc/glance/ssl/private/sslkey.pem'
}
it 'configures registry client key and cert files' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
it 'does not configure registry client key and cert files when nil or empty' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
node.set['openstack']['openstack']['image']['ssl']['cert_file'] = nil
node.set['openstack']['openstack']['image']['ssl']['key_file'] = ''
default_opts.each do |key|
r = line_regexp("#{key} =")
expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
end
context 'glance-registry with cert not required' do
it 'does not configure CA cert file' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
node.set['openstack']['image']['ssl']['cert_required'] = false
node.set['openstack']['image']['registry']['auth']['cafile'] = '/etc/glance/ssl/certs/sslca.pem'
r = line_regexp('registry_client_ca_file = /etc/glance/ssl/certs/sslca.pem')
expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
context 'glance-registry with certificate validation enabled' do
it 'enables SSL in insecure mode' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
node.set['openstack']['image']['registry']['auth']['insecure'] = false
r = line_regexp('registry_client_insecure = false')
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
context 'glance-registry with certificate validation disabled' do
it 'enables SSL in secure mode' do
node.set['openstack']['endpoints']['image-registry']['scheme'] = 'https'
node.set['openstack']['image']['registry']['auth']['insecure'] = true
r = line_regexp('registry_client_insecure = true')
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
end
context 'glance-registry configuration with ssl disabled' do
it 'sets registry client protocol to http' do
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^registry_client_protocol = http$/)
end
end
context 'commonly named attributes' do
%w(verbose debug filesystem_store_datadir).each do |attr|
it "sets the #{attr} attribute" do
node.set['openstack']['image'][attr] = "#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{attr} = #{attr}_value$/)
end
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
it 'sets the filesystem_store_metadata_file attribute' do
node.set['openstack']['image']['filesystem_store_metadata_file'] = '/etc/glance/images.json'
expect(chef_run).to render_file(file.name).with_content(%r{^filesystem_store_metadata_file = /etc/glance/images.json$})
end
context 'api related attributes' do
%w(default_store workers show_image_direct_url).each do |attr|
it "sets the #{attr} attribute" do
node.set['openstack']['image']['api'][attr] = "#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{attr} = #{attr}_value$/)
end
end
end
it 'sets container and disk formats attributes' do
%w(container_formats disk_formats).each do |attr|
node.set['openstack']['image']['api'][attr] = ["#{attr}_value1", "#{attr}_value2"]
expect(chef_run).to render_config_file(file.name).with_section_content('image_format', /^#{attr} = #{attr}_value1,#{attr}_value2$/)
end
end
it 'sets port and host attributes' do
[
/^bind_port = 9292$/,
/^bind_host = 127.0.0.1$/,
/^registry_port = 9191$/,
/^registry_host = 127.0.0.1$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
.with_section_content('DEFAULT', line)
end
end
it 'sets a connection attribute' do
expect(chef_run).to render_file(file.name).with_content(/^connection = sql_connection_value$/)
end
it_behaves_like 'syslog use' do
let(:log_file_name) { 'api.log' }
end
context 'syslog use' do
it 'shows log_config if syslog use is enabled' do
node.set['openstack']['image']['syslog']['use'] = true
expect(chef_run).to render_file(file.name).with_content(%r{^log_config = /etc/openstack/logging.conf$})
end
it 'shows log_file if syslog use is disabled' do
node.set['openstack']['image']['syslog']['use'] = false
expect(chef_run).to render_file(file.name).with_content(%r{^log_file = /var/log/glance/api.log$})
end
end
it_behaves_like 'messaging' do
let(:file_name) { file.name }
end
context 'cinder storage options' do
it 'sets default attributes' do
expect(chef_run).to render_file(file.name).with_content(/^cinder_catalog_info = volumev2:cinderv2:publicURL$/)
expect(chef_run).to render_file(file.name).with_content(%r{^cinder_endpoint_template = http://127.0.0.1:8776/v2/%\(tenant_id\)s$})
expect(chef_run).to render_file(file.name).with_content(/^cinder_ca_certificates_file = $/)
expect(chef_run).to render_file(file.name).with_content(/^cinder_api_insecure = false$/)
end
it 'uses insecure mode' do
node.set['openstack']['image']['api']['block-storage']['cinder_api_insecure'] = true
expect(chef_run).to render_file(file.name).with_content(/^cinder_api_insecure = true$/)
end
it 'uses cafile' do
node.set['openstack']['image']['api']['block-storage']['cinder_ca_certificates_file'] = 'dir/to/path'
expect(chef_run).to render_file(file.name).with_content(%r{^cinder_ca_certificates_file = dir/to/path$})
end
it 'sets cinder_catalog_info' do
node.set['openstack']['image']['api']['block-storage']['cinder_catalog_info'] = 'volume:cinder:publicURL'
expect(chef_run).to render_file(file.name).with_content(/^cinder_catalog_info = volume:cinder:publicURL$/)
end
end
context 'swift options' do
%w(container large_object_size large_object_chunk_size).each do |attr|
it "sets swift store #{attr} attribute" do
node.set['openstack']['image']['api']['swift'][attr] = "swift_store_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^swift_store_#{attr} = swift_store_#{attr}_value$/)
end
end
context 'store auth enabled' do
before do
node.set['openstack']['image']['api']['swift_store_auth_address'] = 'swift_store_auth_address_value'
node.set['openstack']['image']['api']['swift_store_user'] = 'swift_store_user_value'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'swift_store_user_value')
.and_return('swift_store_key_value')
end
%w(auth_address auth_version key).each do |attr|
it "sets the swift #{attr} setting to attributes" do
node.set['openstack']['image']['api']["swift_store_#{attr}"] = "swift_store_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^swift_store_#{attr} = swift_store_#{attr}_value$/)
end
end
it 'sets the store_user attribute' do
node.set['openstack']['image']['api']['swift_user_tenant'] = 'swift_user_tenant_value'
node.set['openstack']['image']['api']['swift_store_user'] = 'swift_store_user_value'
expect(chef_run).to render_file(file.name).with_content(/^swift_store_user = swift_user_tenant_value:swift_store_user_value$/)
end
end
context 'store auth disabled' do
before do
node.set['openstack']['image']['api']['swift_store_auth_address'] = nil
end
it 'sets the auth address' do
expect(chef_run).to render_file(file.name).with_content(%r{^swift_store_auth_address = http://127.0.0.1:5000/v2.0$})
end
it 'sets the auth version' do
expect(chef_run).to render_file(file.name).with_content(/^swift_store_auth_version = 2$/)
end
it 'sets the store user' do
node.set['openstack']['image']['service_tenant_name'] = 'service-tenant-name-value'
node.set['openstack']['image']['service_user'] = 'service-user-value'
expect(chef_run).to render_file(file.name).with_content(/^swift_store_user = :service-tenant-name-value_service-user-value$/)
end
it 'sets the store key' do
expect(chef_run).to render_file(file.name).with_content(/^swift_store_key = admin_password_value$/)
end
end
it 'sets swift enable_snet attribute' do
node.set['openstack']['image']['api']['swift']['enable_snet'] = 'swift_enable_snet_value'
expect(chef_run).to render_file(file.name).with_content(/^swift_enable_snet = swift_enable_snet_value$/)
end
it 'shows store region attribute if it is enabled' do
node.set['openstack']['image']['api']['swift']['store_region'] = 'swift_store_region_value'
expect(chef_run).to render_file(file.name).with_content(/^swift_store_region = swift_store_region_value$/)
end
it 'does not show store region attribute if it is disabled' do
node.set['openstack']['image']['api']['swift']['store_region'] = nil
expect(chef_run).not_to render_file(file.name).with_content(/^swift_store_region =/)
end
end
%w(ceph_conf user pool chunk_size).each do |attr|
it "sets the rbd #{attr} attribute" do
node.set['openstack']['image']['api']['rbd']["#{attr}"] = "rbd_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^rbd_store_#{attr} = rbd_#{attr}_value$/)
end
end
it_behaves_like 'vmware settings configurator' do
let(:file_name) { file.name }
end
it_behaves_like 'keystone attribute setter', 'api'
context 'flavor attribute' do
it 'sets the flavor to keystone with caching disabled' do
node.set['openstack']['image']['api']['cache_management'] = nil
node.set['openstack']['image']['api']['caching'] = nil
expect(chef_run).to render_file(file.name).with_content(/^flavor = keystone$/)
end
it 'sets the flavor to keystone and cachemanagement with cache_management enabled and caching disabled' do
node.set['openstack']['image']['api']['cache_management'] = true
node.set['openstack']['image']['api']['caching'] = nil
expect(chef_run).to render_file(file.name).with_content(/^flavor = keystone\+cachemanagement$/)
end
it 'sets the flavor to keystone and caching with cache_management disabled and caching enabled' do
node.set['openstack']['image']['api']['cache_management'] = nil
node.set['openstack']['image']['api']['caching'] = true
expect(chef_run).to render_file(file.name).with_content(/^flavor = keystone\+caching$/)
end
it 'sets the flavor to keystone and cachemanagement with cache_management and caching enabled' do
node.set['openstack']['image']['api']['cache_management'] = true
node.set['openstack']['image']['api']['caching'] = true
expect(chef_run).to render_file(file.name).with_content(/^flavor = keystone\+cachemanagement$/)
end
end
context 'keystone authtoken attributes with default values' do
it 'sets memcached server(s)' do
expect(chef_run).not_to render_file(file.name).with_content(/^memcached_servers = $/)
end
it 'sets memcache security strategy' do
expect(chef_run).not_to render_file(file.name).with_content(/^memcache_security_strategy = $/)
end
it 'sets memcache secret key' do
expect(chef_run).not_to render_file(file.name).with_content(/^memcache_secret_key = $/)
end
it 'sets cafile' do
expect(chef_run).not_to render_file(file.name).with_content(/^cafile = $/)
end
it 'sets auth version to the default v2.0' do
expect(chef_run).to render_file(file.name).with_content(/^auth_version = v2.0$/)
end
it 'sets insecure' do
expect(chef_run).to render_file(file.name).with_content(/^insecure = false$/)
end
it 'sets token hash algorithms' do
expect(chef_run).to render_file(file.name).with_content(/^hash_algorithms = md5$/)
end
end
context 'keystone authtoken attributes with new values' do
it 'sets memcached server(s)' do
node.set['openstack']['image']['api']['auth']['memcached_servers'] = 'localhost:11211'
expect(chef_run).to render_file(file.name).with_content(/^memcached_servers = localhost:11211$/)
end
it 'sets memcache security strategy' do
node.set['openstack']['image']['api']['auth']['memcache_security_strategy'] = 'MAC'
expect(chef_run).to render_file(file.name).with_content(/^memcache_security_strategy = MAC$/)
end
it 'sets memcache secret key' do
node.set['openstack']['image']['api']['auth']['memcache_secret_key'] = '0123456789ABCDEF'
expect(chef_run).to render_file(file.name).with_content(/^memcache_secret_key = 0123456789ABCDEF$/)
end
it 'sets cafile' do
node.set['openstack']['image']['api']['auth']['cafile'] = 'dir/to/path'
expect(chef_run).to render_file(file.name).with_content(%r{^cafile = dir/to/path$})
end
it 'sets auth version' do
node.set['openstack']['image']['api']['auth']['version'] = 'v3.0'
expect(chef_run).to render_file(file.name).with_content(/^auth_version = v3.0$/)
end
it 'sets insecure' do
node.set['openstack']['image']['api']['auth']['insecure'] = true
expect(chef_run).to render_file(file.name).with_content(/^insecure = true$/)
end
it 'sets token hash algorithms' do
node.set['openstack']['image']['api']['auth']['hash_algorithms'] = 'sha2'
expect(chef_run).to render_file(file.name).with_content(/^hash_algorithms = sha2$/)
end
it do
[
%r{^log_file = /var/log/glance/api.log$},
/^rpc_backend = rabbit$/,
/^bind_host = 127.0.0.1$/,
/^bind_port = 9292$/,
/^registry_host = 127.0.0.1$/,
/^registry_port = 9191$/,
/^registry_client_protocol = http$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
end
end
it 'notifies glance-api restart' do
expect(file).to notify('service[glance-api]').to(:restart)
it do
[
%r{^filesystem_store_datadir = /var/lib/glance/images$},
/^default_store = file$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('glance_store', line)
end
end
it do
[
/^flavor = keystone$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('paste_deploy', line)
end
end
it do
[
/^auth_plugin = v2password$/,
/^region_name = RegionOne$/,
/^username = glance$/,
/^tenant_name = service$/,
%r{^signing_dir = /var/cache/glance/api$},
%r{^auth_url = http://127.0.0.1:5000/v2.0$},
/^password = glance-pass$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('keystone_authtoken', line)
end
end
it do
[
%r{^connection = mysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$}
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('database', line)
end
end
it do
[
/^rabbit_userid = guest$/,
/^rabbit_password = mq-pass$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('oslo_messaging_rabbit', line)
end
end
end
@ -503,75 +134,26 @@ describe 'openstack-image::api' do
let(:file) { chef_run.template('/etc/glance/glance-cache.conf') }
it 'creates glance-cache.conf' do
expect(chef_run).to create_template(file.name).with(
user: 'glance',
group: 'glance',
mode: 00640
)
expect(chef_run).to create_template(file.name)
.with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'glance',
group: 'glance',
mode: 00640
)
end
context 'template contents' do
include_context 'endpoint-stubs'
it_behaves_like 'custom template banner displayer' do
let(:file_name) { file.name }
end
%w(verbose debug).each do |attr|
it "sets the #{attr} attribute" do
node.set['openstack']['image'][attr] = "#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{attr} = #{attr}_value$/)
end
end
context 'cache attributes' do
%w(dir stall_time).each do |attr|
it "sets the #{attr} cache attribute" do
node.set['openstack']['image']['cache'][attr] = "image_cache_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^image_cache_#{attr} = image_cache_#{attr}_value$/)
end
end
it 'sets the image_cache_invalid_entry_grace_period attribute' do
node.set['openstack']['image']['cache']['grace_period'] = 'grace_period_value'
expect(chef_run).to render_file(file.name).with_content(/^image_cache_invalid_entry_grace_period = grace_period_value$/)
end
it 'sets the image_cache_max_size attribute' do
node.set['openstack']['image']['api']['cache']['image_cache_max_size'] = 'max_size_value'
expect(chef_run).to render_file(file.name).with_content(/^image_cache_max_size = max_size_value$/)
end
end
context 'syslog options' do
it 'sets the log_config attribute if syslog use is enabled' do
node.set['openstack']['image']['syslog']['use'] = true
expect(chef_run).to render_file(file.name).with_content(%r{^log_config = /etc/openstack/logging.conf$})
end
it 'sets the log_file attribute if syslog use is disabled' do
node.set['openstack']['image']['syslog']['use'] = false
expect(chef_run).to render_file(file.name).with_content(%r{^log_file = /var/log/glance/image-cache.log$})
end
end
it 'sets port and host attributes' do
it do
[
/^registry_port = 9191$/,
/^registry_host = 127.0.0.1$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
end
end
it_behaves_like 'vmware settings configurator' do
let(:file_name) { file.name }
end
end
it 'notifies glance-api restart' do
expect(file).to notify('service[glance-api]').to(:restart)
end
end
@ -579,70 +161,77 @@ describe 'openstack-image::api' do
let(:file) { chef_run.template('/etc/glance/glance-scrubber.conf') }
it 'creates glance-scrubber.conf' do
expect(chef_run).to create_template(file.name).with(
user: 'glance',
group: 'glance',
mode: 00640
)
expect(chef_run).to create_template(file.name)
.with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'glance',
group: 'glance',
mode: 00640
)
end
context 'template contents' do
include_context 'endpoint-stubs'
it 'sets port and host attributes' do
it do
[
/^registry_port = 9191$/,
/^registry_host = 127.0.0.1$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
end
end
end
end
it 'has glance-cache-pruner cronjob running every 30 minutes' do
cron = chef_run.cron('glance-cache-pruner')
expect(cron.command).to eq '/usr/bin/glance-cache-pruner > /dev/null 2>&1'
expect(cron.minute).to eq '*/30'
it do
expect(chef_run).to create_cron('glance-cache-pruner')
.with(
command: '/usr/bin/glance-cache-pruner > /dev/null 2>&1',
minute: '*/30'
)
end
it 'has glance-cache-cleaner to run at 00:01 each day' do
cron = chef_run.cron('glance-cache-cleaner')
expect(cron.command).to eq '/usr/bin/glance-cache-cleaner > /dev/null 2>&1'
expect(cron.minute).to eq '01'
expect(cron.hour).to eq '00'
it do
expect(chef_run).to create_cron('glance-cache-cleaner')
.with(
command: '/usr/bin/glance-cache-cleaner > /dev/null 2>&1',
minute: '01',
hour: '00'
)
end
describe 'glance-metadata.json' do
let(:file) { chef_run.template('/etc/glance/glance-metadata.json') }
it do
expect(chef_run).to create_directory('/var/lib/glance/image-cache/')
.with(
user: 'glance',
group: 'glance',
mode: 00755,
recursive: true
)
end
it 'not to create glance-metadata.json by default' do
expect(chef_run).not_to create_template('/etc/glance/glance-metadata.json')
%w(image_api image_cache image_scrubber).each do |service|
it do
expect(chef_run).to run_ruby_block(
"delete all attributes in node['openstack']['#{service}']['conf_secrets']"
)
end
end
context 'create right glance-metadata.json file' do
before do
node.set['openstack']['image']['filesystem_store_metadata_file'] = '/etc/glance/glance-metadata.json'
end
it do
expect(chef_run).to enable_service('glance-api')
end
it 'create glance-metadata.json' do
expect(chef_run).to create_template(file.name).with(
user: 'glance',
group: 'glance',
mode: 00640
)
end
it do
expect(chef_run).to start_service('glance-api')
end
it 'configure id and mountpoint for image filesystem metadata' do
%w(id mountpoint).each do |attr|
node.set['openstack']['image']["filesystem_store_metadata_#{attr}"] = "metadata_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/"#{attr}": "metadata_#{attr}_value"/)
end
end
end
it do
resource = chef_run.service('glance-api')
expect(resource).to subscribe_to('template[/etc/glance/glance-api.conf]')
expect(resource).to subscribe_to('template[/etc/glance/glance-cache.conf]')
expect(resource).to subscribe_to('template[/etc/glance/glance-scrubber.conf]')
end
end
end

View File

@ -33,15 +33,14 @@ describe 'openstack-image::identity_registration' do
end
it 'with custom region override' do
node.set['openstack']['image']['region'] = 'imageRegion'
node.set['openstack']['region'] = 'imageRegion'
expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint')
.with(endpoint_region: 'imageRegion')
end
it 'with different public url' do
public_url = 'https://public.host:123/public_path'
node.set['openstack']['endpoints']['public']['image-api']['uri'] = public_url
node.set['openstack']['endpoints']['image_api']['public']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint')
.with(auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
@ -55,9 +54,7 @@ describe 'openstack-image::identity_registration' do
it 'with different admin url' do
admin_url = 'http://admin.host:456/admin_path'
node.set['openstack']['endpoints']['admin']['image-api']['uri'] = admin_url
node.set['openstack']['endpoints']['identity-admin']['uri'] = 'http://127.0.0.1:35357/v2.0'
node.set['openstack']['endpoints']['image_api']['admin']['uri'] = admin_url
expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint')
.with(auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
@ -71,8 +68,7 @@ describe 'openstack-image::identity_registration' do
it 'with different internal url' do
internal_url = 'http://internal.host:789/internal_path'
node.set['openstack']['endpoints']['internal']['image-api']['uri'] = internal_url
node.set['openstack']['endpoints']['image_api']['internal']['uri'] = internal_url
expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint')
.with(auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
@ -88,11 +84,9 @@ describe 'openstack-image::identity_registration' do
internal_url = 'http://internal.host:789/internal_path'
admin_url = 'http://admin.host:456/admin_path'
public_url = 'https://public.host:123/public_path'
node.set['openstack']['endpoints']['internal']['image-api']['uri'] = internal_url
node.set['openstack']['endpoints']['admin']['image-api']['uri'] = admin_url
node.set['openstack']['endpoints']['identity-admin']['uri'] = 'http://127.0.0.1:35357/v2.0'
node.set['openstack']['endpoints']['public']['image-api']['uri'] = public_url
node.set['openstack']['endpoints']['image_api']['internal']['uri'] = internal_url
node.set['openstack']['endpoints']['image_api']['admin']['uri'] = admin_url
node.set['openstack']['endpoints']['image_api']['public']['uri'] = public_url
expect(chef_run).to create_endpoint_openstack_identity_register('Register Image Endpoint')
.with(auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
@ -126,12 +120,12 @@ describe 'openstack-image::identity_registration' do
)
end
it 'grants service role to service user for service tenant' do
expect(chef_run).to grant_role_openstack_identity_register("Grant 'service' Role to glance User for service Tenant")
it 'grants admin role to service user for service tenant' do
expect(chef_run).to grant_role_openstack_identity_register("Grant 'admin' Role to glance User for service Tenant")
.with(auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'service',
role_name: 'service',
role_name: 'admin',
user_name: 'glance'
)
end

View File

@ -11,10 +11,8 @@ describe 'openstack-image::image_upload' do
include_context 'image-stubs'
include_examples 'common-logging-recipe'
it 'upgrades the client packages' do
expect(chef_run).to upgrade_package('python-glanceclient')
it do
expect(chef_run).to upgrade_package('curl')
end
it 'uploads the cirros image' do
@ -22,7 +20,11 @@ describe 'openstack-image::image_upload' do
image_url: 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img',
image_name: 'cirros',
image_type: 'qcow',
image_public: true
image_public: true,
identity_user: 'glance',
identity_pass: 'glance-pass',
identity_tenant: 'service',
identity_uri: 'http://127.0.0.1:5000/v2.0'
)
end
@ -35,7 +37,7 @@ describe 'openstack-image::image_upload' do
it 'uploads the tar image' do
node.set['openstack']['image']['upload_images'] = ['imageName']
node.set['openstack']['image']['upload_image']['imageName'] = 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz'
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-tenant-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep imageName').and_return(false)
stub_command('glance --insecure --os-username glance --os-password glance-pass --os-tenant-name service --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep imageName').and_return(false)
expect(chef_run).to upload_openstack_image_image('Image setup for imageName').with(
image_url: 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-uec.tar.gz',
image_name: 'imageName',
@ -50,7 +52,7 @@ describe 'openstack-image::image_upload' do
node.set['openstack']['image']['upload_images'] = ["#{image_type}_imageName"]
node.set['openstack']['image']['upload_image']["#{image_type}_imageName"] = "image_file.#{image_type}"
node.set['openstack']['image']['upload_image_type']["#{image_type}_imageName"] = "#{image_type}"
stub_command("glance --insecure --os-username admin --os-password admin-pass --os-tenant-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep #{image_type}_imageName").and_return(false)
stub_command("glance --insecure --os-username glance --os-password glance-pass --os-tenant-name service --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep #{image_type}_imageName").and_return(false)
expect(chef_run).to upload_openstack_image_image("Image setup for #{image_type}_imageName").with(
image_url: "image_file.#{image_type}",
image_name: "#{image_type}_imageName",
@ -66,8 +68,8 @@ describe 'openstack-image::image_upload' do
node.set['openstack']['image']['upload_image_type']['raw_imageName'] = 'raw'
node.set['openstack']['image']['upload_image']['vdi_imageName'] = 'image_file.vdi'
node.set['openstack']['image']['upload_image_type']['vdi_imageName'] = 'vdi'
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-tenant-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep raw_imageName').and_return(false)
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-tenant-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep vdi_imageName').and_return(false)
stub_command('glance --insecure --os-username glance --os-password glance-pass --os-tenant-name service --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep raw_imageName').and_return(false)
stub_command('glance --insecure --os-username glance --os-password glance-pass --os-tenant-name service --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep vdi_imageName').and_return(false)
expect(chef_run).to upload_openstack_image_image('Image setup for raw_imageName').with(
image_url: 'image_file.raw',
image_name: 'raw_imageName',

View File

@ -15,11 +15,24 @@ describe 'openstack-image::registry' do
runner.converge(described_recipe)
end
include Helpers
include_context 'image-stubs'
include_examples 'common-logging-recipe'
include_examples 'common-packages'
include_examples 'glance-directory'
it 'converges when configured to use sqlite' do
node.set['openstack']['db']['image']['service_type'] = 'sqlite'
expect { chef_run }.to_not raise_error
end
it 'upgrades mysql python package' do
expect(chef_run).to upgrade_package('python-mysqldb')
end
%w(db2 postgresql).each do |service_type|
it "upgrades #{service_type} python packages if chosen" do
node.set['openstack']['db']['image']['service_type'] = service_type
node.set['openstack']['db']['python_packages'][service_type] = ["my-#{service_type}-py"]
expect(chef_run).to upgrade_package("my-#{service_type}-py")
end
end
it do
expect(chef_run).to create_directory('/var/cache/glance/registry').with(
@ -29,59 +42,12 @@ describe 'openstack-image::registry' do
)
end
it 'converges when configured to use sqlite' do
node.set['openstack']['db']['image']['service_type'] = 'sqlite'
expect { chef_run }.to_not raise_error
end
it 'upgrades mysql python package' do
expect(chef_run).to upgrade_package('python-mysqldb')
end
it 'honors package name and option overrides for mysql python packages' do
node.set['openstack']['image']['platform']['package_overrides'] = '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes'
node.set['openstack']['db']['python_packages']['mysql'] = ['my-mysql-py']
expect(chef_run).to upgrade_package('my-mysql-py').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
end
%w(db2 postgresql).each do |service_type|
it "upgrades #{service_type} python packages if chosen" do
node.set['openstack']['db']['image']['service_type'] = service_type
node.set['openstack']['db']['python_packages'][service_type] = ["my-#{service_type}-py"]
expect(chef_run).to upgrade_package("my-#{service_type}-py")
end
end
it 'starts glance registry on boot' do
expect(chef_run).to enable_service('glance-registry')
end
describe 'version_control' do
let(:cmd) { 'glance-manage version_control 0' }
it 'versions the database' do
stub_command('glance-manage db_version').and_return(false)
expect(chef_run).to run_execute(cmd).with(user: 'glance', group: 'glance')
end
it 'does not version when glance-manage db_version false' do
stub_command('glance-manage db_version').and_return(true)
expect(chef_run).not_to run_execute(cmd)
end
end
it 'deletes glance.sqlite' do
expect(chef_run).to delete_file('/var/lib/glance/glance.sqlite')
end
it 'does not delete glance.sqlite when configured to use sqlite' do
node.set['openstack']['db']['image']['service_type'] = 'sqlite'
expect(chef_run).not_to delete_file('/var/lib/glance/glance.sqlite')
end
@ -90,6 +56,8 @@ describe 'openstack-image::registry' do
it 'creates glance-registry.conf' do
expect(chef_run).to create_template(file.name).with(
source: 'openstack-service.conf.erb',
cookbook: 'openstack-common',
user: 'glance',
group: 'glance',
mode: 00640
@ -97,177 +65,71 @@ describe 'openstack-image::registry' do
end
context 'template contents' do
include_context 'endpoint-stubs'
include_context 'sql-stubs'
it_behaves_like 'custom template banner displayer' do
let(:file_name) { file.name }
end
%w(verbose debug data_api).each do |attr|
it "sets the #{attr} attribute" do
node.set['openstack']['image'][attr] = "#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{attr} = #{attr}_value$/)
end
end
it 'sets port and host attributes' do
it do
[
/^rpc_backend = rabbit$/,
%r{^log_file = /var/log/glance/registry.log$},
/^bind_port = 9191$/,
/^bind_host = 127.0.0.1$/
].each do |line|
expect(chef_run).to render_config_file(file.name)\
expect(chef_run).to render_config_file(file.name)
.with_section_content('DEFAULT', line)
end
end
it 'sets the workers attribute' do
node.set['openstack']['image']['registry']['workers'] = 123
expect(chef_run).to render_file(file.name).with_content(/^workers = 123$/)
end
it 'sets the connection attribute' do
expect(chef_run).to render_file(file.name).with_content(/^connection = sql_connection_value$/)
end
it_behaves_like 'syslog use' do
let(:log_file_name) { 'registry.log' }
end
it_behaves_like 'messaging' do
let(:file_name) { file.name }
end
it_behaves_like 'keystone attribute setter', 'registry'
context 'keystone authtoken attributes with default values' do
it 'sets memcached server(s)' do
expect(chef_run).not_to render_file(file.name).with_content(/^memcached_servers = $/)
end
it 'sets memcache security strategy' do
expect(chef_run).not_to render_file(file.name).with_content(/^memcache_security_strategy = $/)
end
it 'sets memcache secret key' do
expect(chef_run).not_to render_file(file.name).with_content(/^memcache_secret_key = $/)
end
it 'sets cafile' do
expect(chef_run).not_to render_file(file.name).with_content(/^cafile = $/)
end
it 'sets insecure' do
expect(chef_run).to render_file(file.name).with_content(/^insecure = false$/)
end
it 'sets registry auth version to the default v2.0' do
expect(chef_run).to render_file(file.name).with_content(/^auth_version = v2.0$/)
end
it 'sets token hash algorithms' do
expect(chef_run).to render_file(file.name).with_content(/^hash_algorithms = md5$/)
it do
[
/^flavor = keystone$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('paste_deploy', line)
end
end
context 'keystone authtoken attributes with new values' do
it 'sets memcached server(s)' do
node.set['openstack']['image']['registry']['auth']['memcached_servers'] = 'localhost:11211'
expect(chef_run).to render_file(file.name).with_content(/^memcached_servers = localhost:11211$/)
end
it 'sets memcache security strategy' do
node.set['openstack']['image']['registry']['auth']['memcache_security_strategy'] = 'MAC'
expect(chef_run).to render_file(file.name).with_content(/^memcache_security_strategy = MAC$/)
end
it 'sets memcache secret key' do
node.set['openstack']['image']['registry']['auth']['memcache_secret_key'] = '0123456789ABCDEF'
expect(chef_run).to render_file(file.name).with_content(/^memcache_secret_key = 0123456789ABCDEF$/)
end
it 'sets cafile' do
node.set['openstack']['image']['registry']['auth']['cafile'] = 'dir/to/path'
expect(chef_run).to render_file(file.name).with_content(%r{^cafile = dir/to/path$})
end
it 'sets registry auth version' do
node.set['openstack']['image']['registry']['auth']['version'] = 'v3.0'
expect(chef_run).to render_file(file.name).with_content(/^auth_version = v3.0$/)
end
it 'sets insecure' do
node.set['openstack']['image']['registry']['auth']['insecure'] = true
expect(chef_run).to render_file(file.name).with_content(/^insecure = true$/)
end
it 'sets token hash algorithms' do
node.set['openstack']['image']['registry']['auth']['hash_algorithms'] = 'sha2'
expect(chef_run).to render_file(file.name).with_content(/^hash_algorithms = sha2$/)
it do
[
/^auth_plugin = v2password$/,
/^region_name = RegionOne$/,
/^username = glance$/,
/^tenant_name = service$/,
%r{^signing_dir = /var/cache/glance/registry},
%r{^auth_url = http://127.0.0.1:5000/v2.0},
/^password = glance-pass$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('keystone_authtoken', line)
end
end
context 'glance-registry configuration with ssl disabled' do
default_opts = {
cert_file: '/etc/glance/ssl/certs/sslcert.pem',
key_file: '/etc/glance/ssl/private/sslkey.pem'
}
it 'does not set cert or key file' do
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', r)
end
it do
[
%r{^connection = mysql://glance:db-pass@127\.0\.0\.1:3306/glance\?charset=utf8$}
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('database', line)
end
end
context 'glance-registry configuration with ssl enabled' do
default_opts = {
cert_file: '/etc/glance/ssl/certs/sslcert.pem',
key_file: '/etc/glance/ssl/private/sslkey.pem'
}
cert = { 'ca_file' => '/etc/glance/ssl/certs/sslca.pem' }
it 'configures SSL cert and key file when api is enabled for ssl' do
node.set['openstack']['image']['ssl']['registry']['enabled'] = true
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
it 'configures SSL cert and key file when glance is enabled ssl' do
node.set['openstack']['image']['ssl']['enabled'] = true
default_opts.each do |key, val|
r = line_regexp("#{key} = #{val}")
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
context 'with cert required' do
it 'configures CA cert ' do
node.set['openstack']['image']['ssl']['registry']['enabled'] = true
node.set['openstack']['image']['ssl']['cert_required'] = true
r = line_regexp("ca_file = #{cert['ca_file']}")
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', r)
end
end
context 'with cert not required' do
it 'configures CA cert ' do
node.set['openstack']['image']['ssl']['registry']['enabled'] = true
node.set['openstack']['image']['ssl']['cert_required'] = false
r = line_regexp("ca_file = #{cert['ca_file']}")
expect(chef_run).not_to render_config_file(file.name).with_section_content('DEFAULT', r)
end
it do
[
/^rabbit_userid = guest$/,
/^rabbit_password = mq-pass$/
].each do |line|
expect(chef_run).to render_config_file(file.name)
.with_section_content('oslo_messaging_rabbit', line)
end
end
end
it 'notifies glance-registry restart' do
expect(file).to notify('service[glance-registry]').to(:restart)
end
end
it do
expect(chef_run).to run_ruby_block(
"delete all attributes in node['openstack']['image_registry']['conf_secrets']"
)
end
describe 'db_sync' do
let(:cmd) { 'glance-manage db_sync' }
let(:cmd) { 'glance-manage db_sync' }
it 'runs migrations' do
expect(chef_run).to run_execute(cmd).with(user: 'glance', group: 'glance')
@ -275,10 +137,21 @@ describe 'openstack-image::registry' do
it 'does not run migrations when openstack/image/db/migrate is false' do
node.set['openstack']['db']['image']['migrate'] = false
stub_command('glance-manage db_version').and_return(false)
expect(chef_run).not_to run_execute(cmd)
end
end
it do
expect(chef_run).to enable_service('glance-registry')
end
it do
expect(chef_run).to start_service('glance-registry')
end
it do
resource = chef_run.service('glance-registry')
expect(resource).to subscribe_to('template[/etc/glance/glance-registry.conf]')
end
end
end

View File

@ -17,11 +17,6 @@ UBUNTU_OPTS = {
version: '14.04',
log_level: LOG_LEVEL
}
SUSE_OPTS = {
platform: 'suse',
version: '11.3',
log_lovel: LOG_LEVEL
}
# Helper methods
module Helpers
@ -40,41 +35,34 @@ shared_context 'image-stubs' do
allow_any_instance_of(Chef::Recipe).to receive(:address_for)
.with('lo')
.and_return('127.0.1.1')
allow_any_instance_of(Chef::Recipe).to receive(:config_by_role)
.with('rabbitmq-server', 'queue')
.and_return(
'host' => 'rabbit-host', 'port' => 'rabbit-port'
)
allow_any_instance_of(Chef::Recipe).to receive(:rabbit_servers)
.and_return '1.1.1.1:5672,2.2.2.2:5672'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'openstack_identity_bootstrap_token')
.and_return('bootstrap-token')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'openstack_vmware_secret_name')
.and_return 'vmware_secret_name'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('db', anything)
.and_return('')
.with('db', 'glance')
.and_return('db-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'openstack-image')
.and_return('glance-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'guest')
.and_return('mq-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('service', 'rbd-image')
.and_return('rbd-pass')
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin-pass')
allow(Chef::Application).to receive(:fatal!)
stub_command('glance --insecure --os-username admin --os-password admin-pass --os-tenant-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep cirros').and_return('')
stub_command('glance --insecure --os-username glance --os-password glance-pass --os-tenant-name service --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep cirros').and_return('')
end
end
@ -104,10 +92,10 @@ shared_examples 'common-packages' do
end
it 'honors the platform name and option package overrides' do
node.set['openstack']['image']['platform']['package_overrides'] = '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes'
node.set['openstack']['image']['platform']['package_overrides'] = '-o Dpkg::Options:: = \'--force-confold\' -o Dpkg::Options:: = \'--force-confdef\' --force-yes'
node.set['openstack']['image']['platform']['image_packages'] = ['my-glance']
expect(chef_run).to upgrade_package('my-glance').with(options: '-o Dpkg::Options::=\'--force-confold\' -o Dpkg::Options::=\'--force-confdef\' --force-yes')
expect(chef_run).to upgrade_package('my-glance').with(options: '-o Dpkg::Options:: = \'--force-confold\' -o Dpkg::Options:: = \'--force-confdef\' --force-yes')
end
end
@ -190,14 +178,14 @@ shared_examples 'keystone attribute setter' do |version|
context 'auth version' do
it 'shows the version attribute if it is different from v2.0' do
node.set['openstack']['image'][version]['auth']['version'] = 'v3.0'
node.set['openstack']['api']['auth']['version'] = 'v3.0'
expect(chef_run).to render_file(file.name).with_content(/^auth_version = v3.0$/)
end
end
%w(tenant_name user).each do |attr|
it "sets the auth admin #{attr} attribute" do
node.set['openstack']['image']["service_#{attr}"] = "service_#{attr}_value"
node.set['openstack']["image-#{version}"]['conf']['keystone_authtoken']["admin_#{attr}"] = "service_#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^admin_#{attr} = service_#{attr}_value$/)
end
end
@ -207,45 +195,36 @@ shared_examples 'keystone attribute setter' do |version|
end
it 'sets the signing dir attribute' do
node.set['openstack']['image'][version]['auth']['cache_dir'] = 'cache_dir_value'
node.set['openstack']["image-#{version}"]['conf']['keystone_authtoken']['signing_dir'] = 'cache_dir_value'
expect(chef_run).to render_file(file.name).with_content(/^signing_dir = cache_dir_value$/)
end
end
shared_examples 'messaging' do
shared_examples 'messaging' do |version|
context 'messaging' do
before do
node.set['openstack']['image']['notification_driver'] = 'messaging'
end
it 'sets the notifier_strategy attribute' do
node.set['openstack']['mq']['image']['notifier_strategy'] = 'default'
expect(chef_run).to render_file(file.name).with_content(/^notifier_strategy=default$/)
end
it 'has RPC/AMQP defaults set' do
[/^amqp_durable_queues=false$/,
/^amqp_auto_delete=false$/,
/^heartbeat_timeout_threshold=0$/,
/^heartbeat_rate=2$/].each do |line|
expect(chef_run).to render_file(file_name).with_content(line)
end
node.set['openstack']["image-#{version}"]['conf']['DEFAULT']['notifier_strategy'] = 'default'
expect(chef_run).to render_file(file.name).with_content(/^notifier_strategy = default$/)
end
context 'commonly named attributes' do
%w(notification_driver rpc_backend rpc_thread_pool_size
rpc_conn_pool_size rpc_response_timeout control_exchange).each do |attr|
it "sets the #{attr} attribute" do
node.set['openstack']['image'][attr] = "#{attr}_value"
expect(chef_run).to render_file(file.name).with_content(/^#{attr}=#{attr}_value$/)
node.override['openstack']["image-#{version}"]['conf']['DEFAULT'][attr] = "#{attr}_value"
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', /^#{attr} = #{attr}_value$/)
end
end
end
context 'rabbitmq' do
before do
node.set['openstack']['mq']['image']['service_type'] = 'rabbitmq'
node.set['openstack']['mq']['image']['rabbit']['userid'] = 'rabbit_userid_value'
node.set['openstack']["image-#{version}"]['conf']['DEFAULT']['rpc_backend'] = 'rabbit'
node.set['openstack']["image-#{version}"]['conf']['oslo_messaging_rabbit']['rabbit_userid'] = 'rabbit_userid_value'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'rabbit_userid_value')
.and_return('rabbit_password_value')
@ -253,106 +232,19 @@ shared_examples 'messaging' do
%w(host port userid).each do |attr|
it "sets the rabbitmq #{attr} attribute" do
node.set['openstack']['mq']['image']['rabbit'][attr] = "rabbit_#{attr}_value"
node.set['openstack']["image-#{version}"]['conf']['oslo_messaging_rabbit']["rabbit_#{attr}"] = "rabbit_#{attr}_value"
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_#{attr} = rabbit_#{attr}_value$/)
end
end
it 'does not have ha rabbit options set by default' do
[/^rabbit_hosts=/,
/^rabbit_ha_queues=/].each do |line|
expect(chef_run).not_to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
it 'has ha rabbit options set' do
node.set['openstack']['mq']['image']['rabbit']['ha'] = true
[/^rabbit_hosts=1.1.1.1:5672,2.2.2.2:5672$/,
/^rabbit_ha_queues=True/].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
[/^rabbit_host=/,
/^rabbit_port=/].each do |line|
expect(chef_run).not_to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
it 'sets the rabbitmq password' do
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_password = rabbit_password_value$/)
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_password = mq-pass$/)
end
it 'sets the rabbitmq vhost' do
node.set['openstack']['mq']['image']['rabbit']['vhost'] = 'rabbit_vhost_value'
node.set['openstack']["image-#{version}"]['conf']['oslo_messaging_rabbit']['rabbit_virtual_host'] = 'rabbit_vhost_value'
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^rabbit_virtual_host = rabbit_vhost_value$/)
end
it 'sets the rabbitmq notification topics' do
node.set['openstack']['mq']['image']['rabbit']['notification_topic'] = 'helloworld'
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_rabbit', /^notification_topics = helloworld$/)
end
it 'does not have ssl config set' do
[/^rabbit_use_ssl=/,
/^kombu_ssl_version=/,
/^kombu_ssl_keyfile=/,
/^kombu_ssl_certfile=/,
/^kombu_ssl_ca_certs=/,
/^kombu_reconnect_delay=/,
/^kombu_reconnect_timeout=/].each do |line|
expect(chef_run).not_to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
it 'sets ssl config' do
node.set['openstack']['mq']['image']['rabbit']['use_ssl'] = true
node.set['openstack']['mq']['image']['rabbit']['kombu_ssl_version'] = 'TLSv1.2'
node.set['openstack']['mq']['image']['rabbit']['kombu_ssl_keyfile'] = 'keyfile'
node.set['openstack']['mq']['image']['rabbit']['kombu_ssl_certfile'] = 'certfile'
node.set['openstack']['mq']['image']['rabbit']['kombu_ssl_ca_certs'] = 'certsfile'
node.set['openstack']['mq']['image']['rabbit']['kombu_reconnect_delay'] = 123.123
node.set['openstack']['mq']['image']['rabbit']['kombu_reconnect_timeout'] = 123
[/^rabbit_use_ssl=true/,
/^kombu_ssl_version=TLSv1.2$/,
/^kombu_ssl_keyfile=keyfile$/,
/^kombu_ssl_certfile=certfile$/,
/^kombu_ssl_ca_certs=certsfile$/,
/^kombu_reconnect_delay=123.123$/,
/^kombu_reconnect_timeout=123$/].each do |line|
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', line)
end
end
it 'has the default rabbit_retry_interval set' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_retry_interval = 1$/)
end
it 'has the default rabbit_max_retries set' do
expect(chef_run).to render_config_file(file.name).with_section_content('oslo_messaging_rabbit', /^rabbit_max_retries = 0$/)
end
end
context 'qpid' do
before do
node.set['openstack']['mq']['image']['service_type'] = 'qpid'
node.set['openstack']['mq']['image']['qpid']['username'] = 'qpid_username_value'
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'qpid_username_value')
.and_return('qpid_password_value')
end
%w(port username sasl_mechanisms reconnect reconnect_timeout
reconnect_limit reconnect_interval_min reconnect_interval_max reconnect_interval
heartbeat protocol tcp_nodelay topology_version).each do |attr|
it "sets the qpid #{attr} attribute" do
node.set['openstack']['mq']['image']['qpid'][attr] = "qpid_#{attr}_value"
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_qpid', /^qpid_#{attr}\s?=\s?qpid_#{attr}_value$/)
end
end
it 'sets the qpid notification topics' do
node.set['openstack']['mq']['image']['qpid']['notification_topic'] = 'helloworld'
expect(chef_run).to render_config_file(file_name).with_section_content('oslo_messaging_qpid', /^notification_topics=helloworld$/)
end
end
end
end

16
spec/swift_store_spec.rb Normal file
View File

@ -0,0 +1,16 @@
# encoding: UTF-8
require_relative 'spec_helper'
describe 'openstack-image::swift_store' do
describe 'ubuntu' do
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
runner.converge(described_recipe)
end
include_context 'image-stubs'
it do
expect(chef_run).to upgrade_package('python-swift')
end
end
end

View File

@ -1,874 +0,0 @@
<%= node["openstack"]["image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
#verbose = False
verbose = <%= node["openstack"]["image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
#debug = False
debug = <%= node["openstack"]["image"]["debug"] %>
# 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
# and must be set to a value under 8 EB (9223372036854775808).
#image_size_cap = 1099511627776
# Address to bind the API server
#bind_host = 0.0.0.0
bind_host = <%= @api_bind_address %>
# Port the bind the API server to
#bind_port = 9292
bind_port = <%= @api_bind_port %>
# Log to this file. Make sure you do not set the same log file for both the API
# and registry servers!
#
# If `log_file` is omitted and `use_syslog` is false, then log messages are
# sent to stdout as a fallback.
log_file = /var/log/glance/api.log
# Backlog requests when creating socket
backlog = 4096
# TCP_KEEPIDLE value in seconds when creating socket.
# Not supported on OS X.
#tcp_keepidle = 600
# API to use for accessing data. Default value points to sqlalchemy
# package, it is also possible to use: glance.db.registry.api
# data_api = glance.db.sqlalchemy.api
# The number of child process workers that will be
# created to service API requests. The default will be
# equal to the number of CPUs available. (integer value)
#workers = None
workers = <%= node["openstack"]["image"]["api"]["workers"] %>
# Maximum line size of message headers to be accepted.
# max_header_line may need to be increased when using large tokens
# (typically those generated by the Keystone v3 API with big service
# catalogs)
# max_header_line = 16384
# Role used to identify an authenticated user as administrator
#admin_role = admin
# Allow unauthenticated users to access the API with read-only
# privileges. This only applies when using ContextMiddleware.
#allow_anonymous_access = False
# Allow access to version 1 of glance api
#enable_v1_api = True
# Allow access to version 2 of glance api
#enable_v2_api = True
# Return the URL that references where the data is stored on
# the backend storage system. For example, if using the
# file system store a URL of 'file:///path/to/image' will
# be returned to the user in the 'direct_url' meta-data field.
# The default value is false.
#show_image_direct_url = False
show_image_direct_url = <%= node["openstack"]["image"]["api"]["show_image_direct_url"] %>
# Send headers containing user and tenant information when making requests to
# the v1 glance registry. This allows the registry to function as if a user is
# authenticated without the need to authenticate a user itself using the
# auth_token middleware.
# The default value is false.
#send_identity_headers = False
# Directory to use for lock files. Default to a temp directory
# (string value). This setting needs to be the same for both
# glance-scrubber and glance-api.
#lock_path=<None>
# Property Protections config file
# This file contains the rules for property protections and the roles/policies
# associated with it.
# If this config value is not specified, by default, property protections
# won't be enforced.
# If a value is specified and the file is not found, then the glance-api
# service will not start.
#property_protection_file =
# Specify whether 'roles' or 'policies' are used in the
# property_protection_file.
# The default value for property_protection_rule_format is 'roles'.
#property_protection_rule_format = roles
# Specifies how long (in hours) a task is supposed to live in the tasks DB
# after succeeding or failing before getting soft-deleted.
# The default value for task_time_to_live is 48 hours.
# task_time_to_live = 48
# This value sets what strategy will be used to determine the image location
# order. Currently two strategies are packaged with Glance 'location_order'
# and 'store_type'.
#location_strategy = location_order
# ================= Syslog Options ============================
# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
#use_syslog = False
# Facility to use. If unset defaults to LOG_USER.
#syslog_log_facility = LOG_LOCAL0
<% if node["openstack"]["image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
# Log to this file. Make sure you do not set the same log
# file for both the API and registry servers!
log_file = /var/log/glance/api.log
<% end %>
# ================= SSL Options ===============================
<% if node['openstack']['image']['ssl']['api']['enabled'] -%>
# Certificate file to use when starting API server securely
cert_file = <%= node['openstack']['image']['ssl']['cert_file'] %>
# Private key file to use when starting API server securely
key_file = <%= node['openstack']['image']['ssl']['key_file'] %>
<% if node['openstack']['image']['ssl']['cert_required'] -%>
# CA certificate file to use to verify connecting clients
ca_file = <%=node['openstack']['image']['ssl']['ca_file'] %>
<% end -%>
<% end -%>
# ================= Security Options ==========================
# AES key for encrypting store 'location' metadata, including
# -- if used -- Swift or S3 credentials
# Should be set to a random string of length 16, 24 or 32 bytes
#metadata_encryption_key = <16, 24 or 32 char registry metadata key>
# ============ Registry Options ===============================
# Address to find the registry server
#registry_host = 0.0.0.0
registry_host = <%= @registry_ip_address %>
# Port the registry server is listening on
registry_port = <%= @registry_port %>
# What protocol to use when connecting to the registry server?
registry_client_protocol = <%= @registry_scheme %>
<% if @registry_scheme == 'https' -%>
<% unless node["openstack"]["image"]['ssl']['key_file'].to_s.empty? -%>
# The path to the key file to use in SSL connections to the
# registry server, if any. Alternately, you may set the
# GLANCE_CLIENT_KEY_FILE environ variable to a filepath of the key file
registry_client_key_file = <%= node['openstack']['image']['ssl']['key_file'] %>
<% end -%>
<% unless node["openstack"]["image"]['ssl']['cert_file'].to_s.empty? -%>
# The path to the cert file to use in SSL connections to the
# registry server, if any. Alternately, you may set the
# GLANCE_CLIENT_CERT_FILE environ variable to a filepath of the cert file
registry_client_cert_file = <%= node['openstack']['image']['ssl']['cert_file'] %>
<% end -%>
<% if node['openstack']['image']['ssl']['cert_required'] -%>
# The path to the certifying authority cert file to use in SSL connections
# to the registry server, if any. Alternately, you may set the
# GLANCE_CLIENT_CA_FILE environ variable to a filepath of the CA cert file
registry_client_ca_file = <%= node['openstack']['image']['registry']['auth']['cafile'] %>
<% end -%>
# When using SSL in connections to the registry server, do not require
# validation via a certifying authority. This is the registry's equivalent of
# specifying --insecure on the command line using glanceclient for the API
# Default: False
registry_client_insecure = <%= node['openstack']['image']['registry']['auth']['insecure'] %>
<% end -%>
# The period of time, in seconds, that the API server will wait for a registry
# request to complete. A value of '0' implies no timeout.
# Default: 600
#registry_client_timeout = 600
# Whether to automatically create the database tables.
# Default: False
#db_auto_create = False
# Enable DEBUG log messages from sqlalchemy which prints every database
# query and response.
# Default: False
#sqlalchemy_debug = True
# Pass the user's token through for API requests to the registry.
# Default: True
#use_user_token = True
# If 'use_user_token' is not in effect then admin credentials
# can be specified. Requests to the registry on behalf of
# the API will use these credentials.
# Admin user name
#admin_user = None
# Admin password
#admin_password = None
# Admin tenant name
#admin_tenant_name = None
# Keystone endpoint
#auth_url = None
# Keystone region
#auth_region = None
# Auth strategy
#auth_strategy = keystone
# ============ Notification System Options =====================
# Driver or drivers to handle sending notifications. Set to
# 'messaging' to send notifications to a message queue.
# notification_driver = noop
notifier_strategy=<%= node["openstack"]["mq"]["image"]["notifier_strategy"] %>
notification_driver=<%= @notification_driver %>
<% if @notification_driver == "messaging" %>
# Default publisher_id for outgoing notifications.
# default_publisher_id = image.localhost
# Messaging driver used for 'messaging' notifications driver
#rpc_backend=rabbit
rpc_backend=<%= node["openstack"]["image"]["rpc_backend"] %>
# Size of RPC greenthread pool. (integer value)
#rpc_thread_pool_size=64
rpc_thread_pool_size=<%= node["openstack"]["image"]["rpc_thread_pool_size"] %>
# Seconds to wait for a response from a call. (integer value)
#rpc_response_timeout=60
rpc_response_timeout=<%= node["openstack"]["image"]["rpc_response_timeout"] %>
# The default exchange under which topics are scoped. May be
# overridden by an exchange name specified in the
# transport_url option. (string value)
#control_exchange=openstack
control_exchange=<%= node["openstack"]["image"]["control_exchange"] %>
<% 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
# writes image data to
#filesystem_store_datadir = /var/lib/glance/images/
filesystem_store_datadir = <%= node["openstack"]["image"]["filesystem_store_datadir"] %>
# A list of directories where image data can be stored.
# This option may be specified multiple times for specifying multiple store
# directories. Either one of filesystem_store_datadirs or
# filesystem_store_datadir option is required. A priority number may be given
# after each directory entry, separated by a ":".
# When adding an image, the highest priority directory will be selected, unless
# there is not enough space available in cases where the image size is already
# known. If no priority is given, it is assumed to be zero and the directory
# will be considered for selection last. If multiple directories have the same
# priority, then the one with the most free space available is selected.
# If same store is specified multiple times then BadStoreConfiguration
# exception will be raised.
#filesystem_store_datadirs = /var/lib/glance/images/:1
<% unless node["openstack"]["image"]["filesystem_store_metadata_file"].nil? %>
filesystem_store_metadata_file = <%= node["openstack"]["image"]["filesystem_store_metadata_file"] %>
<% end %>
# ============ Swift Store Options =============================
# Version of the authentication service to use
# Valid versions are '2' for keystone and '1' for swauth and rackspace
#swift_store_auth_version = 2
swift_store_auth_version = <%= @swift_store_auth_version %>
# Address where the Swift authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'https://'
# For swauth, use something like '127.0.0.1:8080/v1.0/'
#swift_store_auth_address = 127.0.0.1:5000/v2.0/
swift_store_auth_address = <%= @swift_store_auth_address %>
# User to authenticate against the Swift authentication service
# If you use Swift authentication service, set it to 'account':'user'
# where 'account' is a Swift storage account and 'user'
# is a user in that account
#swift_store_user = jdoe:jdoe
swift_store_user = <%= @swift_user_tenant %>:<%= @swift_store_user %>
# Auth key for the user authenticating against the
# Swift authentication service
#swift_store_key = a86850deb2742ec3cb41518e26aa2d89
swift_store_key = <%= @swift_store_key %>
# Container within the account that the account should use
# for storing images in Swift
#swift_store_container = glance
swift_store_container = <%= node["openstack"]["image"]["api"]["swift"]["container"] %>
# Do we create the container if it does not exist?
#swift_store_create_container_on_put = False
swift_store_create_container_on_put = True
# What size, in MB, should Glance start chunking image files
# and do a large object manifest in Swift? By default, this is
# the maximum object size in Swift, which is 5GB
#swift_store_large_object_size = 5120
swift_store_large_object_size = <%= node["openstack"]["image"]["api"]["swift"]["large_object_size"] %>
# swift_store_config_file = glance-swift.conf
# This file contains references for each of the configured
# Swift accounts/backing stores. If used, this option can prevent
# credentials being stored in the database. Using Swift references
# is disabled if this config is left blank.
# The reference to the default Swift parameters to use for adding new images.
# default_swift_reference = 'ref1'
# When doing a large object manifest, what size, in MB, should
# Glance write chunks to Swift? This amount of data is written
# to a temporary disk buffer during the process of chunking
# the image file, and the default is 200MB
#swift_store_large_object_chunk_size = 200
swift_store_large_object_chunk_size = <%= node["openstack"]["image"]["api"]["swift"]["large_object_chunk_size"] %>
# Whether to use ServiceNET to communicate with the Swift storage servers.
# (If you aren't RACKSPACE, leave this False!)
#
# To use ServiceNET for authentication, prefix hostname of
# `swift_store_auth_address` with 'snet-'.
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
#swift_enable_snet = False
swift_enable_snet = <%= node["openstack"]["image"]["api"]["swift"]["enable_snet"] %>
# If set to True enables multi-tenant storage mode which causes Glance images
# to be stored in tenant specific Swift accounts.
#swift_store_multi_tenant = False
# A list of swift ACL strings that will be applied as both read and
# write ACLs to the containers created by Glance in multi-tenant
# mode. This grants the specified tenants/users read and write access
# to all newly created image objects. The standard swift ACL string
# formats are allowed, including:
# <tenant_id>:<username>
# <tenant_name>:<username>
# *:<username>
# Multiple ACLs can be combined using a comma separated list, for
# example: swift_store_admin_tenants = service:glance,*:admin
#swift_store_admin_tenants =
# The region of the swift endpoint to be used for single tenant. This setting
# is only necessary if the tenant has multiple swift endpoints.
#swift_store_region =
<% unless node["openstack"]["image"]["api"]["swift"]["store_region"].nil? %>
swift_store_region = <%= node["openstack"]["image"]["api"]["swift"]["store_region"] %>
<% end %>
# If set to False, disables SSL layer compression of https swift requests.
# Setting to 'False' may improve performance for images which are already
# in a compressed format, eg qcow2. If set to True, enables SSL layer
# compression (provided it is supported by the target swift proxy).
#swift_store_ssl_compression = True
# The number of times a Swift download will be retried before the
# request fails
#swift_store_retry_get_count = 0
# Bypass SSL verification for Swift
#swift_store_auth_insecure = False
# ============ S3 Store Options =============================
# Address where the S3 authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'http://'
s3_store_host = 127.0.0.1:8080/v1.0/
# User to authenticate against the S3 authentication service
s3_store_access_key = <20-char AWS access key>
# Auth key for the user authenticating against the
# S3 authentication service
s3_store_secret_key = <40-char AWS secret key>
# Container within the account that the account should use
# for storing images in S3. Note that S3 has a flat namespace,
# so you need a unique bucket name for your glance images. An
# easy way to do this is append your AWS access key to "glance".
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
# your AWS access key if you use it in your bucket name below!
s3_store_bucket = <lowercased 20-char aws access key>glance
# Do we create the bucket if it does not exist?
s3_store_create_bucket_on_put = False
# When sending images to S3, the data will first be written to a
# temporary buffer on disk. By default the platform's temporary directory
# will be used. If required, an alternative directory can be specified here.
#s3_store_object_buffer_dir = /path/to/dir
# When forming a bucket url, boto will either set the bucket name as the
# subdomain or as the first token of the path. Amazon's S3 service will
# accept it as the subdomain, but Swift's S3 middleware requires it be
# in the path. Set this to 'path' or 'subdomain' - defaults to 'subdomain'.
#s3_store_bucket_url_format = subdomain
# Size, in MB, should S3 start chunking image files
# and do a multipart upload in S3. The default is 100MB.
#s3_store_large_object_size = 100
# Multipart upload part size, in MB, should S3 use when uploading
# parts. The size must be greater than or equal to
# 5MB. The default is 10MB.
#s3_store_large_object_chunk_size = 10
# The number of thread pools to perform a multipart upload
# in S3. The default is 10.
#s3_store_thread_pools = 10
# ============ RBD Store Options =============================
# Ceph configuration file path
# If using cephx authentication, this file should
# include a reference to the right keyring
# in a client.<USER> section
#rbd_store_ceph_conf = /etc/ceph/ceph.conf
rbd_store_ceph_conf = <%= node["openstack"]["image"]["api"]["rbd"]["ceph_conf"] %>
# RADOS user to authenticate as (only applicable if using cephx)
# If <None>, a default will be chosen based on the client. section
# in rbd_store_ceph_conf
#rbd_store_user = <None>
rbd_store_user = <%= node["openstack"]["image"]["api"]["rbd"]["user"] %>
# RADOS pool in which images are stored
#rbd_store_pool = images
rbd_store_pool = <%= node["openstack"]["image"]["api"]["rbd"]["pool"] %>
# RADOS images will be chunked into objects of this size (in megabytes).
# For best performance, this should be a power of two
#rbd_store_chunk_size = 8
rbd_store_chunk_size = <%= node["openstack"]["image"]["api"]["rbd"]["chunk_size"] %>
# ============ Sheepdog Store Options =============================
sheepdog_store_address = localhost
sheepdog_store_port = 7000
# Images will be chunked into objects of this size (in megabytes).
# For best performance, this should be a power of two
sheepdog_store_chunk_size = 64
# ============ Cinder Store Options ===============================
# Info to match when looking for cinder in the service catalog
# Format is : separated values of the form:
# <service_type>:<service_name>:<endpoint_type> (string value)
cinder_catalog_info = <%= node['openstack']['image']['api']['block-storage']['cinder_catalog_info'] %>
# Override service catalog lookup with template for cinder endpoint
# e.g. http://localhost:8776/v1/%(project_id)s (string value)
cinder_endpoint_template = <%= @cinder_endpoint.scheme %>://<%= @cinder_endpoint.host %>:<%= @cinder_endpoint.port %><%= @cinder_endpoint.path %>
# Region name of this node (string value)
#os_region_name = <None>
# Location of ca certicates file to use for cinder client requests
# (string value)
cinder_ca_certificates_file = <%= node['openstack']['image']['api']['block-storage']['cinder_ca_certificates_file'] %>
# Number of cinderclient retries on failed http calls (integer value)
#cinder_http_retries = 3
# Allow to perform insecure SSL requests to cinder (boolean value)
cinder_api_insecure = <%= node['openstack']['image']['api']['block-storage']['cinder_api_insecure'] %>
# ============ VMware Datastore Store Options =====================
# ESX/ESXi or vCenter Server target system.
# The server value can be an IP address or a DNS name
# e.g. 127.0.0.1, 127.0.0.1:443, www.vmware-infra.com
#vmware_server_host = <None>
vmware_server_host = <%= node['openstack']['image']['api']['vmware']['vmware_server_host'] %>
# Server username (string value)
#vmware_server_username = <None>
vmware_server_username = <%= node['openstack']['image']['api']['vmware']['vmware_server_username'] %>
# Server password (string value)
#vmware_server_password = <None>
vmware_server_password = <%= @vmware_server_password %>
# Inventory path to a datacenter (string value)
# Value optional when vmware_server_ip is an ESX/ESXi host: if specified
# should be `ha-datacenter`.
#vmware_datacenter_path = <None>
vmware_datacenter_path = <%= node['openstack']['image']['api']['vmware']['vmware_datacenter_path'] %>
# Datastore associated with the datacenter (string value)
#vmware_datastore_name = <None>
vmware_datastore_name = <%= node['openstack']['image']['api']['vmware']['vmware_datastore_name'] %>
# The number of times we retry on failures
# e.g., socket error, etc (integer value)
#vmware_api_retry_count = 10
vmware_api_retry_count = <%= node['openstack']['image']['api']['vmware']['vmware_api_retry_count'] %>
# The interval used for polling remote tasks
# invoked on VMware ESX/VC server in seconds (integer value)
#vmware_task_poll_interval = 5
vmware_task_poll_interval = <%= node['openstack']['image']['api']['vmware']['vmware_task_poll_interval'] %>
# Absolute path of the folder containing the images in the datastore
# (string value)
#vmware_store_image_dir = /openstack_glance
vmware_store_image_dir = <%= node['openstack']['image']['api']['vmware']['vmware_store_image_dir'] %>
# Allow to perform insecure SSL requests to the target system (boolean value)
#vmware_api_insecure = False
vmware_api_insecure = <%= node['openstack']['image']['api']['vmware']['vmware_api_insecure'] %>
# ============ Delayed Delete Options =============================
# Turn on/off delayed delete
delayed_delete = False
# Delayed delete time in seconds
scrub_time = 43200
# Directory that the scrubber will use to remind itself of what to delete
# Make sure this is also set in glance-scrubber.conf
scrubber_datadir = /var/lib/glance/scrubber
# =============== Quota Options ==================================
# The maximum number of image members allowed per image
#image_member_quota = 128
# The maximum number of image properties allowed per image
#image_property_quota = 128
# The maximum number of tags allowed per image
#image_tag_quota = 128
# The maximum number of locations allowed per image
#image_location_quota = 10
# Set a system wide quota for every user. This value is the total number
# of bytes that a user can use across all storage systems. A value of
# 0 means unlimited.
#user_storage_quota = 0
# =============== Image Cache Options =============================
# Base directory that the Image Cache uses
image_cache_dir = /var/lib/glance/image-cache/
# =============== Database Options =================================
[database]
# The file name to use with SQLite (string value)
#sqlite_db = glance.sqlite
# If True, SQLite uses synchronous mode (boolean value)
#sqlite_synchronous = True
# The backend to use for db (string value)
# Deprecated group/name - [DEFAULT]/db_backend
#backend = sqlalchemy
# The SQLAlchemy connection string used to connect to the
# database (string value)
# Deprecated group/name - [DEFAULT]/sql_connection
# Deprecated group/name - [DATABASE]/sql_connection
# Deprecated group/name - [sql]/connection
#connection = <None>
connection = <%= @sql_connection %>
# The SQL mode to be used for MySQL sessions. This option,
# including the default, overrides any server-set SQL mode. To
# use whatever SQL mode is set by the server configuration,
# set this to no value. Example: mysql_sql_mode= (string
# value)
#mysql_sql_mode = TRADITIONAL
# Timeout before idle sql connections are reaped (integer
# value)
# Deprecated group/name - [DEFAULT]/sql_idle_timeout
# Deprecated group/name - [DATABASE]/sql_idle_timeout
# Deprecated group/name - [sql]/idle_timeout
#idle_timeout = 3600
# Minimum number of SQL connections to keep open in a pool
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_min_pool_size
# Deprecated group/name - [DATABASE]/sql_min_pool_size
#min_pool_size = 1
# Maximum number of SQL connections to keep open in a pool
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_pool_size
# Deprecated group/name - [DATABASE]/sql_max_pool_size
#max_pool_size = <None>
# Maximum db connection retries during startup. (setting -1
# implies an infinite retry count) (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_retries
# Deprecated group/name - [DATABASE]/sql_max_retries
#max_retries = 10
# Interval between retries of opening a sql connection
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_retry_interval
# Deprecated group/name - [DATABASE]/reconnect_interval
#retry_interval = 10
# If set, use this value for max_overflow with sqlalchemy
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_overflow
# Deprecated group/name - [DATABASE]/sqlalchemy_max_overflow
#max_overflow = <None>
# Verbosity of SQL debugging information. 0=None,
# 100=Everything (integer value)
# Deprecated group/name - [DEFAULT]/sql_connection_debug
#connection_debug = 0
# Add python stack traces to SQL as comment strings (boolean
# value)
# Deprecated group/name - [DEFAULT]/sql_connection_trace
#connection_trace = False
# If set, use this value for pool_timeout with sqlalchemy
# (integer value)
# Deprecated group/name - [DATABASE]/sqlalchemy_pool_timeout
#pool_timeout = <None>
# Enable the experimental use of database reconnect on
# connection lost (boolean value)
#use_db_reconnect = False
# seconds between db connection retries (integer value)
#db_retry_interval = 1
# Whether to increase interval between db connection retries,
# up to db_max_retry_interval (boolean value)
#db_inc_retry_interval = True
# max seconds between db connection retries, if
# db_inc_retry_interval is enabled (integer value)
#db_max_retry_interval = 10
# maximum db connection retries before error is raised.
# (setting -1 implies an infinite retry count) (integer value)
#db_max_retries = 20
[image_format]
# Supported values for the 'container_format' image attribute
container_formats = <%= node["openstack"]["image"]["api"]["container_formats"].join(",") %>
# Supported values for the 'disk_format' image attribute
disk_formats = <%= node["openstack"]["image"]["api"]["disk_formats"].join(",") %>
[keystone_authtoken]
auth_uri = <%= @auth_uri %>
identity_uri = <%= @identity_uri %>
auth_version = <%= node["openstack"]["image"]["api"]["auth"]["version"] %>
admin_tenant_name = <%= node["openstack"]["image"]["service_tenant_name"] %>
admin_user = <%= node["openstack"]["image"]["service_user"] %>
admin_password = <%= @service_pass %>
signing_dir = <%= node["openstack"]["image"]["api"]["auth"]["cache_dir"] %>
# A list of memcached server(s) to use for caching.
<% if node['openstack']['image']['api']['auth']['memcached_servers'] %>
memcached_servers = <%= node['openstack']['image']['api']['auth']['memcached_servers'] %>
<% end %>
# Whether token data should be authenticated or authenticated and encrypted. Acceptable values are MAC or ENCRYPT.
<% if node['openstack']['image']['api']['auth']['memcache_security_strategy'] %>
memcache_security_strategy = <%= node['openstack']['image']['api']['auth']['memcache_security_strategy'] %>
<% end %>
# This string is used for key derivation.
<% if node['openstack']['image']['api']['auth']['memcache_secret_key'] %>
memcache_secret_key = <%= node['openstack']['image']['api']['auth']['memcache_secret_key'] %>
<% end %>
# Hash algorithms to use for hashing PKI tokens.
hash_algorithms = <%= node['openstack']['image']['api']['auth']['hash_algorithms'] %>
# A PEM encoded Certificate Authority to use when verifying HTTPs connections.
<% if node['openstack']['image']['api']['auth']['cafile'] %>
cafile = <%= node['openstack']['image']['api']['auth']['cafile'] %>
<% end %>
# Verify HTTPS connections. (boolean value)
insecure = <%= node['openstack']['image']['api']['auth']['insecure'] %>
[oslo_messaging_qpid]
#
# From oslo.messaging
#
<% if @notification_driver == "messaging" && @mq_service_type == "qpid" %>
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
amqp_durable_queues=<%= node["openstack"]["mq"]["image"]["durable_queues"] %>
# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
amqp_auto_delete=<%= node["openstack"]["mq"]["image"]["auto_delete"] %>
# Size of RPC connection pool. (integer value)
#rpc_conn_pool_size=30
rpc_conn_pool_size=<%= node["openstack"]["image"]["rpc_conn_pool_size"] %>
# Configuration options if sending notifications via Qpid (these are
# the defaults)
transport_url = qpid://
notification_topics=<%= node["openstack"]["mq"]["image"]["qpid"]["notification_topic"] %>
qpid_hostname=<%= node["openstack"]["mq"]["image"]["qpid"]["host"] %>
qpid_port=<%= node["openstack"]["mq"]["image"]["qpid"]["port"] %>
qpid_username=<%= node["openstack"]["mq"]["image"]["qpid"]["username"] %>
qpid_password=<%= @mq_password %>
qpid_sasl_mechanisms=<%= node["openstack"]["mq"]["image"]["qpid"]["sasl_mechanisms"] %>
qpid_reconnect=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect"] %>
qpid_reconnect_timeout=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_timeout"] %>
qpid_reconnect_limit=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_limit"] %>
qpid_reconnect_interval_min=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_interval_min"] %>
qpid_reconnect_interval_max=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_interval_max"] %>
qpid_reconnect_interval=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_interval"] %>
qpid_heartbeat=<%= node["openstack"]["mq"]["image"]["qpid"]["heartbeat"] %>
# Set to 'ssl' to enable SSL
qpid_protocol=<%= node["openstack"]["mq"]["image"]["qpid"]["protocol"] %>
qpid_tcp_nodelay=<%= node["openstack"]["mq"]["image"]["qpid"]["tcp_nodelay"] %>
qpid_topology_version=<%= node["openstack"]["mq"]["image"]["qpid"]["topology_version"] %>
<% end %>
[oslo_messaging_rabbit]
#
# From oslo.messaging
#
<% if @notification_driver == "messaging" && @mq_service_type == "rabbitmq" %>
# Number of seconds after which the Rabbit broker is considered down if heartbeat's keep-alive fails (0 disable the heartbeat)
heartbeat_timeout_threshold=<%= node['openstack']['mq']['image']['rabbit']['heartbeat_timeout_threshold'] %>
# How often times during the heartbeat_timeout_threshold we check the heartbeat
heartbeat_rate=<%= node['openstack']['mq']['image']['rabbit']['heartbeat_rate'] %>
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
amqp_durable_queues=<%= node["openstack"]["mq"]["image"]["durable_queues"] %>
# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
amqp_auto_delete=<%= node["openstack"]["mq"]["image"]["auto_delete"] %>
# Size of RPC connection pool. (integer value)
#rpc_conn_pool_size=30
rpc_conn_pool_size=<%= node["openstack"]["image"]["rpc_conn_pool_size"] %>
<% if node['openstack']['mq']['image']['rabbit']['use_ssl'] -%>
# Connect over SSL for RabbitMQ. (boolean value)
rabbit_use_ssl=true
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_version'] -%>
# SSL version to use (valid only if SSL enabled). valid values
# are TLSv1 and SSLv23. SSLv2 and SSLv3 may be available on
# some distributions. (string value)
kombu_ssl_version=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_version'] %>
<% end -%>
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_keyfile'] -%>
# SSL key file (valid only if SSL enabled)
kombu_ssl_keyfile=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_keyfile'] %>
<% end -%>
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_certfile'] -%>
# SSL cert file (valid only if SSL enabled)
kombu_ssl_certfile=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_certfile'] %>
<% end -%>
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_ca_certs'] -%>
# SSL certification authority file (valid only if SSL enabled)
kombu_ssl_ca_certs=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_ca_certs'] %>
<% end -%>
# How long to wait before reconnecting in response to an AMQP consumer cancel notification
kombu_reconnect_delay=<%= node['openstack']['mq']['image']['rabbit']['kombu_reconnect_delay'] %>
# How long to wait before considering a reconnect attempt to have failed.
# This value should not be longer than rpc_response_timeout
kombu_reconnect_timeout=<%= node['openstack']['mq']['image']['rabbit']['kombu_reconnect_timeout'] %>
<% end -%>
# Configuration options if sending notifications via rabbitmq (these are
# the defaults)
transport_url = rabbit://
<% if node["openstack"]["mq"]["image"]["rabbit"]["ha"] -%>
rabbit_hosts=<%= @rabbit_hosts %>
rabbit_ha_queues=True
<% else -%>
rabbit_host = <%= node["openstack"]["mq"]["image"]["rabbit"]["host"] %>
rabbit_port = <%= node["openstack"]["mq"]["image"]["rabbit"]["port"] %>
<% end -%>
rabbit_userid = <%= node["openstack"]["mq"]["image"]["rabbit"]["userid"] %>
rabbit_password = <%= @mq_password %>
rabbit_virtual_host = <%= node["openstack"]["mq"]["image"]["rabbit"]["vhost"] %>
notification_topics = <%= node["openstack"]["mq"]["image"]["rabbit"]["notification_topic"] %>
# Maximum retries with trying to connect to RabbitMQ
# (the default of 0 implies an infinite retry count)
rabbit_max_retries = <%= node["openstack"]["mq"]["image"]["rabbit"]["rabbit_max_retries"] %>
# RabbitMQ connection retry interval
rabbit_retry_interval = <%= node["openstack"]["mq"]["image"]["rabbit"]["rabbit_retry_interval"] %>
<% end -%>
[paste_deploy]
# Name of the paste configuration file that defines the available pipelines
#config_file = glance-api-paste.ini
# Partial name of a pipeline in your paste configuration file with the
# service name removed. For example, if your paste section name is
# [pipeline:glance-api-keystone], you would configure the flavor below
# as 'keystone'.
flavor = <%= @glance_flavor %>
[store_type_location_strategy]
# The scheme list to use to get store preference order. The scheme must be
# registered by one of the stores defined by the 'known_stores' config option.
# This option will be applied when you using 'store_type' option as image
# location strategy defined by the 'location_strategy' config option.
#store_type_preference =

View File

@ -1,239 +0,0 @@
<%= node["openstack"]["image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
#verbose = False
verbose = <%= node["openstack"]["image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
#debug = False
debug = <%= node["openstack"]["image"]["debug"] %>
# ================= Syslog Options ============================
# Log to this file. Make sure you do not set the same log file for both the API
# and registry servers!
#
# If `log_file` is omitted and `use_syslog` is false, then log messages are
# sent to stdout as a fallback.
# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
#use_syslog = False
<% if node["openstack"]["image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
log_file = /var/log/glance/image-cache.log
<% end %>
# =============== Image Cache Options =============================
# Directory that the Image Cache writes data to
#image_cache_dir = /var/lib/glance/image-cache/
image_cache_dir = <%= node["openstack"]["image"]["cache"]["dir"] %>
# Number of seconds after which we should consider an incomplete image to be
# stalled and eligible for reaping
#image_cache_stall_time = 86400
image_cache_stall_time = <%= node["openstack"]["image"]["cache"]["stall_time"] %>
# image_cache_invalid_entry_grace_period - seconds
#
# If an exception is raised as we're writing to the cache, the cache-entry is
# deemed invalid and moved to <image_cache_datadir>/invalid so that it can be
# inspected for debugging purposes.
#
# This is number of seconds to leave these invalid images around before they
# are elibible to be reaped.
image_cache_invalid_entry_grace_period = <%= node["openstack"]["image"]["cache"]["grace_period"] %>
# Max cache size in bytes
#image_cache_max_size = 10737418240
image_cache_max_size = <%= node["openstack"]["image"]["api"]["cache"]["image_cache_max_size"] %>
# ============ Registry Options ===============================
# Address to find the registry server
#registry_host = 0.0.0.0
registry_host = <%= @registry_ip_address %>
# Port the registry server is listening on
#registry_port = 9191
registry_port = <%= @registry_port %>
# Auth settings if using Keystone
# auth_url = http://127.0.0.1:5000/v2.0/
# admin_tenant_name = %SERVICE_TENANT_NAME%
# admin_user = %SERVICE_USER%
# admin_password = %SERVICE_PASSWORD%
# List of which store classes and store class locations are
# currently known to glance at startup.
# known_stores = glance.store.filesystem.Store,
# glance.store.http.Store,
# glance.store.rbd.Store,
# glance.store.s3.Store,
# glance.store.swift.Store,
# glance.store.sheepdog.Store,
# glance.store.cinder.Store,
# glance.store.vmware_datastore.Store,
# ============ Filesystem Store Options ========================
# Directory that the Filesystem backend store
# writes image data to
filesystem_store_datadir = /var/lib/glance/images/
# ============ Swift Store Options =============================
# Version of the authentication service to use
# Valid versions are '2' for keystone and '1' for swauth and rackspace
swift_store_auth_version = 2
# Address where the Swift authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'https://'
# For swauth, use something like '127.0.0.1:8080/v1.0/'
swift_store_auth_address = 127.0.0.1:5000/v2.0/
# User to authenticate against the Swift authentication service
# If you use Swift authentication service, set it to 'account':'user'
# where 'account' is a Swift storage account and 'user'
# is a user in that account
swift_store_user = jdoe:jdoe
# Auth key for the user authenticating against the
# Swift authentication service
swift_store_key = a86850deb2742ec3cb41518e26aa2d89
# Container within the account that the account should use
# for storing images in Swift
swift_store_container = glance
# Do we create the container if it does not exist?
swift_store_create_container_on_put = False
# What size, in MB, should Glance start chunking image files
# and do a large object manifest in Swift? By default, this is
# the maximum object size in Swift, which is 5GB
swift_store_large_object_size = 5120
# When doing a large object manifest, what size, in MB, should
# Glance write chunks to Swift? This amount of data is written
# to a temporary disk buffer during the process of chunking
# the image file, and the default is 200MB
swift_store_large_object_chunk_size = 200
# Whether to use ServiceNET to communicate with the Swift storage servers.
# (If you aren't RACKSPACE, leave this False!)
#
# To use ServiceNET for authentication, prefix hostname of
# `swift_store_auth_address` with 'snet-'.
# Ex. https://example.com/v1.0/ -> https://snet-example.com/v1.0/
swift_enable_snet = False
# ============ S3 Store Options =============================
# Address where the S3 authentication service lives
# Valid schemes are 'http://' and 'https://'
# If no scheme specified, default to 'http://'
s3_store_host = 127.0.0.1:8080/v1.0/
# User to authenticate against the S3 authentication service
s3_store_access_key = <20-char AWS access key>
# Auth key for the user authenticating against the
# S3 authentication service
s3_store_secret_key = <40-char AWS secret key>
# Container within the account that the account should use
# for storing images in S3. Note that S3 has a flat namespace,
# so you need a unique bucket name for your glance images. An
# easy way to do this is append your AWS access key to "glance".
# S3 buckets in AWS *must* be lowercased, so remember to lowercase
# your AWS access key if you use it in your bucket name below!
s3_store_bucket = <lowercased 20-char aws access key>glance
# Do we create the bucket if it does not exist?
s3_store_create_bucket_on_put = False
# When sending images to S3, the data will first be written to a
# temporary buffer on disk. By default the platform's temporary directory
# will be used. If required, an alternative directory can be specified here.
# s3_store_object_buffer_dir = /path/to/dir
# ============ Cinder Store Options ===========================
# Info to match when looking for cinder in the service catalog
# Format is : separated values of the form:
# <service_type>:<service_name>:<endpoint_type> (string value)
#cinder_catalog_info = volume:cinder:publicURL
# Override service catalog lookup with template for cinder endpoint
# e.g. http://localhost:8776/v1/%(project_id)s (string value)
#cinder_endpoint_template = <None>
# Region name of this node (string value)
#os_region_name = <None>
# Location of ca certicates file to use for cinder client requests
# (string value)
#cinder_ca_certificates_file = <None>
# Number of cinderclient retries on failed http calls (integer value)
#cinder_http_retries = 3
# Allow to perform insecure SSL requests to cinder (boolean value)
#cinder_api_insecure = False
# ============ VMware Datastore Store Options =====================
# ESX/ESXi or vCenter Server target system.
# The server value can be an IP address or a DNS name
# e.g. 127.0.0.1, 127.0.0.1:443, www.vmware-infra.com
#vmware_server_host = <None>
vmware_server_host = <%= node['openstack']['image']['api']['vmware']['vmware_server_host'] %>
# Server username (string value)
#vmware_server_username = <None>
vmware_server_username = <%= node['openstack']['image']['api']['vmware']['vmware_server_username'] %>
# Server password (string value)
#vmware_server_password = <None>
vmware_server_password = <%= @vmware_server_password %>
# Inventory path to a datacenter (string value)
# Value optional when vmware_server_ip is an ESX/ESXi host: if specified
# should be `ha-datacenter`.
#vmware_datacenter_path = <None>
vmware_datacenter_path = <%= node['openstack']['image']['api']['vmware']['vmware_datacenter_path'] %>
# Datastore associated with the datacenter (string value)
#vmware_datastore_name = <None>
vmware_datastore_name = <%= node['openstack']['image']['api']['vmware']['vmware_datastore_name'] %>
# The number of times we retry on failures
# e.g., socket error, etc (integer value)
#vmware_api_retry_count = 10
vmware_api_retry_count = <%= node['openstack']['image']['api']['vmware']['vmware_api_retry_count'] %>
# The interval used for polling remote tasks
# invoked on VMware ESX/VC server in seconds (integer value)
#vmware_task_poll_interval = 5
vmware_task_poll_interval = <%= node['openstack']['image']['api']['vmware']['vmware_task_poll_interval'] %>
# Absolute path of the folder containing the images in the datastore
# (string value)
#vmware_store_image_dir = /openstack_glance
vmware_store_image_dir = <%= node['openstack']['image']['api']['vmware']['vmware_store_image_dir'] %>
# Allow to perform insecure SSL requests to the target system (boolean value)
#vmware_api_insecure = False
vmware_api_insecure = <%= node['openstack']['image']['api']['vmware']['vmware_api_insecure'] %>
# ================= Security Options ==========================
# AES key for encrypting store 'location' metadata, including
# -- if used -- Swift or S3 credentials
# Should be set to a random string of length 16, 24 or 32 bytes
# metadata_encryption_key = <16, 24 or 32 char registry metadata key>

View File

@ -1,4 +0,0 @@
{
"id": "<%= node['openstack']['image']['filesystem_store_metadata_id'] %>",
"mountpoint": "<%= node['openstack']['image']['filesystem_store_metadata_mountpoint'] %>"
}

View File

@ -1,402 +0,0 @@
<%= node["openstack"]["image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
#verbose = False
verbose = <%= node["openstack"]["image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
#debug = False
debug = <%= node["openstack"]["image"]["debug"] %>
# Address to bind the registry server
#bind_host = 0.0.0.0
bind_host = <%= @registry_bind_address %>
# Port the bind the registry server to
#bind_port = 9191
bind_port = <%= @registry_bind_port %>
# Log to this file. Make sure you do not set the same log file for both the API
# and registry servers!
#
# If `log_file` is omitted and `use_syslog` is false, then log messages are
# sent to stdout as a fallback.
log_file = /var/log/glance/registry.log
# Backlog requests when creating socket
backlog = 4096
# TCP_KEEPIDLE value in seconds when creating socket.
# Not supported on OS X.
#tcp_keepidle = 600
# API to use for accessing data. Default value points to sqlalchemy
# package.
#data_api = glance.db.sqlalchemy.api
data_api = <%= node["openstack"]["image"]["data_api"] %>
# The number of child process workers that will be
# created to service Registry requests. The default will be
# equal to the number of CPUs available. (integer value)
#workers = None
workers = <%= node["openstack"]["image"]["registry"]["workers"] %>
# Enable Registry API versions individually or simultaneously
#enable_v1_registry = True
#enable_v2_registry = True
# Limit the api to return `param_limit_max` items in a call to a container. If
# a larger `limit` query param is provided, it will be reduced to this value.
api_limit_max = 1000
# If a `limit` query param is not provided in an api request, it will
# default to `limit_param_default`
limit_param_default = 25
# Role used to identify an authenticated user as administrator
#admin_role = admin
# Whether to automatically create the database tables.
# Default: False
#db_auto_create = False
# Enable DEBUG log messages from sqlalchemy which prints every database
# query and response.
# Default: False
#sqlalchemy_debug = True
# ================= Syslog Options ============================
# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
#use_syslog = False
# Facility to use. If unset defaults to LOG_USER.
#syslog_log_facility = LOG_LOCAL1
<% if node["openstack"]["image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
# Log to this file. Make sure you do not set the same log
# file for both the API and registry servers!
log_file = /var/log/glance/registry.log
<% end %>
# ================= SSL Options ===============================
<% if node['openstack']['image']['ssl']['registry']['enabled'] -%>
# Certificate file to use when starting registry server securely
cert_file = <%= node['openstack']['image']['ssl']['cert_file'] %>
# Private key file to use when starting registry server securely
key_file = <%= node['openstack']['image']['ssl']['key_file'] %>
<% if node['openstack']['image']['ssl']['cert_required'] -%>
# CA certificate file to use to verify connecting clients
ca_file = <%= node['openstack']['image']['ssl']['ca_file'] %>
<% end -%>
<% end -%>
# ============ Notification System Options =====================
# Driver or drivers to handle sending notifications. Set to
# 'messaging' to send notifications to a message queue.
# notification_driver = noop
notifier_strategy=<%= node["openstack"]["mq"]["image"]["notifier_strategy"] %>
notification_driver=<%= @notification_driver %>
<% if @notification_driver == "messaging" %>
# Default publisher_id for outgoing notifications.
# default_publisher_id = image.localhost
# Messaging driver used for 'messaging' notifications driver
#rpc_backend=rabbit
rpc_backend=<%= node["openstack"]["image"]["rpc_backend"] %>
# Size of RPC greenthread pool. (integer value)
#rpc_thread_pool_size=64
rpc_thread_pool_size=<%= node["openstack"]["image"]["rpc_thread_pool_size"] %>
# Seconds to wait for a response from a call. (integer value)
#rpc_response_timeout=60
rpc_response_timeout=<%= node["openstack"]["image"]["rpc_response_timeout"] %>
# The default exchange under which topics are scoped. May be
# overridden by an exchange name specified in the
# transport_url option. (string value)
#control_exchange=openstack
control_exchange=<%= node["openstack"]["image"]["control_exchange"] %>
<% end %>
# ================= Database Options ==========================
[database]
# The file name to use with SQLite (string value)
#sqlite_db = glance.sqlite
# If True, SQLite uses synchronous mode (boolean value)
#sqlite_synchronous = True
# The backend to use for db (string value)
# Deprecated group/name - [DEFAULT]/db_backend
#backend = sqlalchemy
# The SQLAlchemy connection string used to connect to the
# database (string value)
# Deprecated group/name - [DEFAULT]/sql_connection
# Deprecated group/name - [DATABASE]/sql_connection
# Deprecated group/name - [sql]/connection
#connection = <None>
connection = <%= @sql_connection %>
# The SQL mode to be used for MySQL sessions. This option,
# including the default, overrides any server-set SQL mode. To
# use whatever SQL mode is set by the server configuration,
# set this to no value. Example: mysql_sql_mode= (string
# value)
#mysql_sql_mode = TRADITIONAL
# Timeout before idle sql connections are reaped (integer
# value)
# Deprecated group/name - [DEFAULT]/sql_idle_timeout
# Deprecated group/name - [DATABASE]/sql_idle_timeout
# Deprecated group/name - [sql]/idle_timeout
#idle_timeout = 3600
# Minimum number of SQL connections to keep open in a pool
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_min_pool_size
# Deprecated group/name - [DATABASE]/sql_min_pool_size
#min_pool_size = 1
# Maximum number of SQL connections to keep open in a pool
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_pool_size
# Deprecated group/name - [DATABASE]/sql_max_pool_size
#max_pool_size = <None>
# Maximum db connection retries during startup. (setting -1
# implies an infinite retry count) (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_retries
# Deprecated group/name - [DATABASE]/sql_max_retries
#max_retries = 10
# Interval between retries of opening a sql connection
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_retry_interval
# Deprecated group/name - [DATABASE]/reconnect_interval
#retry_interval = 10
# If set, use this value for max_overflow with sqlalchemy
# (integer value)
# Deprecated group/name - [DEFAULT]/sql_max_overflow
# Deprecated group/name - [DATABASE]/sqlalchemy_max_overflow
#max_overflow = <None>
# Verbosity of SQL debugging information. 0=None,
# 100=Everything (integer value)
# Deprecated group/name - [DEFAULT]/sql_connection_debug
#connection_debug = 0
# Add python stack traces to SQL as comment strings (boolean
# value)
# Deprecated group/name - [DEFAULT]/sql_connection_trace
#connection_trace = False
# If set, use this value for pool_timeout with sqlalchemy
# (integer value)
# Deprecated group/name - [DATABASE]/sqlalchemy_pool_timeout
#pool_timeout = <None>
# Enable the experimental use of database reconnect on
# connection lost (boolean value)
#use_db_reconnect = False
# seconds between db connection retries (integer value)
#db_retry_interval = 1
# Whether to increase interval between db connection retries,
# up to db_max_retry_interval (boolean value)
#db_inc_retry_interval = True
# max seconds between db connection retries, if
# db_inc_retry_interval is enabled (integer value)
#db_max_retry_interval = 10
# maximum db connection retries before error is raised.
# (setting -1 implies an infinite retry count) (integer value)
#db_max_retries = 20
# ================= Keystone authtoken ===============================
[keystone_authtoken]
auth_uri = <%= @auth_uri %>
identity_uri = <%= @identity_uri %>
auth_version = <%= node['openstack']['image']['registry']['auth']['version'] %>
admin_tenant_name = <%= node["openstack"]["image"]["service_tenant_name"] %>
admin_user = <%= node["openstack"]["image"]["service_user"] %>
admin_password = <%= @service_pass %>
signing_dir = <%= node["openstack"]["image"]["registry"]["auth"]["cache_dir"] %>
insecure = <%= node['openstack']['image']['registry']['auth']['insecure'] %>
# A list of memcached server(s) to use for caching.
<% if node['openstack']['image']['registry']['auth']['memcached_servers'] %>
memcached_servers = <%= node['openstack']['image']['registry']['auth']['memcached_servers'] %>
<% end %>
# Whether token data should be authenticated or authenticated and encrypted. Acceptable values are MAC or ENCRYPT.
<% if node['openstack']['image']['registry']['auth']['memcache_security_strategy'] %>
memcache_security_strategy = <%= node['openstack']['image']['registry']['auth']['memcache_security_strategy'] %>
<% end %>
# This string is used for key derivation.
<% if node['openstack']['image']['registry']['auth']['memcache_secret_key'] %>
memcache_secret_key = <%= node['openstack']['image']['registry']['auth']['memcache_secret_key'] %>
<% end %>
# Hash algorithms to use for hashing PKI tokens.
hash_algorithms = <%= node['openstack']['image']['registry']['auth']['hash_algorithms'] %>
# A PEM encoded Certificate Authority to use when verifying HTTPs connections.
<% if node['openstack']['image']['registry']['auth']['cafile'] %>
cafile = <%= node['openstack']['image']['registry']['auth']['cafile'] %>
<% end %>
# Verify HTTPS connections. (boolean value)
insecure = <%= node['openstack']['image']['registry']['auth']['insecure'] %>
[oslo_messaging_qpid]
#
# From oslo.messaging
#
<% if @notification_driver == "messaging" && @mq_service_type == "qpid" %>
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
amqp_durable_queues=<%= node["openstack"]["mq"]["image"]["durable_queues"] %>
# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
amqp_auto_delete=<%= node["openstack"]["mq"]["image"]["auto_delete"] %>
# Size of RPC connection pool. (integer value)
#rpc_conn_pool_size=30
rpc_conn_pool_size=<%= node["openstack"]["image"]["rpc_conn_pool_size"] %>
# Configuration options if sending notifications via Qpid (these are
# the defaults)
transport_url = qpid://
notification_topics=<%= node["openstack"]["mq"]["image"]["qpid"]["notification_topic"] %>
qpid_hostname=<%= node["openstack"]["mq"]["image"]["qpid"]["host"] %>
qpid_port=<%= node["openstack"]["mq"]["image"]["qpid"]["port"] %>
qpid_username=<%= node["openstack"]["mq"]["image"]["qpid"]["username"] %>
qpid_password=<%= @mq_password %>
qpid_sasl_mechanisms=<%= node["openstack"]["mq"]["image"]["qpid"]["sasl_mechanisms"] %>
qpid_reconnect=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect"] %>
qpid_reconnect_timeout=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_timeout"] %>
qpid_reconnect_limit=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_limit"] %>
qpid_reconnect_interval_min=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_interval_min"] %>
qpid_reconnect_interval_max=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_interval_max"] %>
qpid_reconnect_interval=<%= node["openstack"]["mq"]["image"]["qpid"]["reconnect_interval"] %>
qpid_heartbeat=<%= node["openstack"]["mq"]["image"]["qpid"]["heartbeat"] %>
# Set to 'ssl' to enable SSL
qpid_protocol=<%= node["openstack"]["mq"]["image"]["qpid"]["protocol"] %>
qpid_tcp_nodelay=<%= node["openstack"]["mq"]["image"]["qpid"]["tcp_nodelay"] %>
qpid_topology_version=<%= node["openstack"]["mq"]["image"]["qpid"]["topology_version"] %>
<% end %>
[oslo_messaging_rabbit]
#
# From oslo.messaging
#
<% if @notification_driver == "messaging" && @mq_service_type == "rabbitmq" %>
# Number of seconds after which the Rabbit broker is considered down if heartbeat's keep-alive fails (0 disable the heartbeat)
heartbeat_timeout_threshold=<%= node['openstack']['mq']['image']['rabbit']['heartbeat_timeout_threshold'] %>
# How often times during the heartbeat_timeout_threshold we check the heartbeat
heartbeat_rate=<%= node['openstack']['mq']['image']['rabbit']['heartbeat_rate'] %>
# Use durable queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/rabbit_durable_queues
amqp_durable_queues=<%= node["openstack"]["mq"]["image"]["durable_queues"] %>
# Auto-delete queues in AMQP. (boolean value)
# Deprecated group/name - [DEFAULT]/amqp_auto_delete
amqp_auto_delete=<%= node["openstack"]["mq"]["image"]["auto_delete"] %>
# Size of RPC connection pool. (integer value)
#rpc_conn_pool_size=30
rpc_conn_pool_size=<%= node["openstack"]["image"]["rpc_conn_pool_size"] %>
<% if node['openstack']['mq']['image']['rabbit']['use_ssl'] -%>
# Connect over SSL for RabbitMQ. (boolean value)
rabbit_use_ssl=true
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_version'] -%>
# SSL version to use (valid only if SSL enabled). valid values
# are TLSv1 and SSLv23. SSLv2 and SSLv3 may be available on
# some distributions. (string value)
kombu_ssl_version=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_version'] %>
<% end -%>
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_keyfile'] -%>
# SSL key file (valid only if SSL enabled)
kombu_ssl_keyfile=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_keyfile'] %>
<% end -%>
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_certfile'] -%>
# SSL cert file (valid only if SSL enabled)
kombu_ssl_certfile=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_certfile'] %>
<% end -%>
<% if node['openstack']['mq']['image']['rabbit']['kombu_ssl_ca_certs'] -%>
# SSL certification authority file (valid only if SSL enabled)
kombu_ssl_ca_certs=<%= node['openstack']['mq']['image']['rabbit']['kombu_ssl_ca_certs'] %>
<% end -%>
# How long to wait before reconnecting in response to an AMQP consumer cancel notification
kombu_reconnect_delay=<%= node['openstack']['mq']['image']['rabbit']['kombu_reconnect_delay'] %>
# How long to wait before considering a reconnect attempt to have failed.
# This value should not be longer than rpc_response_timeout
kombu_reconnect_timeout=<%= node['openstack']['mq']['image']['rabbit']['kombu_reconnect_timeout'] %>
<% end -%>
# Configuration options if sending notifications via rabbitmq (these are
# the defaults)
transport_url = rabbit://
<% if node["openstack"]["mq"]["image"]["rabbit"]["ha"] -%>
rabbit_hosts=<%= @rabbit_hosts %>
rabbit_ha_queues=True
<% else -%>
rabbit_host = <%= node["openstack"]["mq"]["image"]["rabbit"]["host"] %>
rabbit_port = <%= node["openstack"]["mq"]["image"]["rabbit"]["port"] %>
<% end -%>
rabbit_userid = <%= node["openstack"]["mq"]["image"]["rabbit"]["userid"] %>
rabbit_password = <%= @mq_password %>
rabbit_virtual_host = <%= node["openstack"]["mq"]["image"]["rabbit"]["vhost"] %>
notification_topics = <%= node["openstack"]["mq"]["image"]["rabbit"]["notification_topic"] %>
# Maximum retries with trying to connect to RabbitMQ
# (the default of 0 implies an infinite retry count)
rabbit_max_retries = <%= node["openstack"]["mq"]["image"]["rabbit"]["rabbit_max_retries"] %>
# RabbitMQ connection retry interval
rabbit_retry_interval = <%= node["openstack"]["mq"]["image"]["rabbit"]["rabbit_retry_interval"] %>
<% end -%>
[paste_deploy]
# Name of the paste configuration file that defines the available pipelines
#config_file = glance-registry-paste.ini
# Partial name of a pipeline in your paste configuration file with the
# service name removed. For example, if your paste section name is
# [pipeline:glance-registry-keystone], you would configure the flavor below
# as 'keystone'.
#flavor=
flavor = keystone

View File

@ -1,66 +0,0 @@
<%= node["openstack"]["image"]["custom_template_banner"] %>
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
#verbose = False
verbose = <%= node["openstack"]["image"]["verbose"] %>
# Show debugging output in logs (sets DEBUG log level output)
#debug = False
debug = <%= node["openstack"]["image"]["debug"] %>
# Log to this file. Make sure you do not set the same log file for both the API
# and registry servers!
#
# If `log_file` is omitted and `use_syslog` is false, then log messages are
# sent to stdout as a fallback.
<% if node["openstack"]["image"]["syslog"]["use"] %>
log_config = /etc/openstack/logging.conf
<% else %>
log_file = /var/log/glance/scrubber.log
<% end %>
# Send logs to syslog (/dev/log) instead of to file specified by `log_file`
#use_syslog = False
# Should we run our own loop or rely on cron/scheduler to run us
daemon = False
# Loop time between checking for new items to schedule for delete
wakeup_time = 300
# Directory that the scrubber will use to remind itself of what to delete
# Make sure this is also set in glance-api.conf
scrubber_datadir = /var/lib/glance/scrubber
# Only one server in your deployment should be designated the cleanup host
cleanup_scrubber = False
# pending_delete items older than this time are candidates for cleanup
cleanup_scrubber_time = 86400
# Address to find the registry server for cleanups
#registry_host = 0.0.0.0
registry_host = <%= @registry_ip_address %>
# Port the registry server is listening on
#registry_port = 9191
registry_port = <%= @registry_port %>
# Auth settings if using Keystone
# auth_url = http://127.0.0.1:5000/v2.0/
# admin_tenant_name = %SERVICE_TENANT_NAME%
# admin_user = %SERVICE_USER%
# admin_password = %SERVICE_PASSWORD%
# Directory to use for lock files. Default to a temp directory
# (string value). This setting needs to be the same for both
# glance-scrubber and glance-api.
#lock_path=<None>
# ================= Security Options ==========================
# AES key for encrypting store 'location' metadata, including
# -- if used -- Swift or S3 credentials
# Should be set to a random string of length 16, 24 or 32 bytes
#metadata_encryption_key = <16, 24 or 32 char registry metadata key>