Remove support for legacy store setup

This change removes the legacy store support which was deprecated in
favor of support for the multi-store setup[1].

[1] fd02761c6e

Also, the deprecated filesystem_store_* parameters are removed because
these are used only when the legacy store is used and were deprecated
formally during the previous cycle[2].

[2] 0e6fd040e5

Change-Id: Ia2100578725fcb7c2e35d09bd37f27e555b36879
This commit is contained in:
Takashi Kajinami 2022-04-18 21:51:57 +09:00 committed by Takashi Kajinami
parent 0dcda53bb3
commit c251a6ab4e
16 changed files with 41 additions and 1215 deletions

View File

@ -227,36 +227,11 @@
#
# DEPRECATED PARAMETERS
#
# [*stores*]
# (optional) List of which store classes and store class locations are
# currently known to glance at startup.
# Defaults to undef
# Example: ['file','http']
#
# [*default_store*]
# (optional) The default backend store, should be given as a string. Value
# must be provided if more than one store is listed in 'stores'.
# Defaults to undef
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
#
# [*show_multiple_locations*]
# (optional) Whether to include the backend image locations in image
# properties.
# Defaults to undef
#
# [*filesystem_store_metadata_file*]
# (optional) The path to a file which contains the metadata to be returned
# with any location associated with the filesystem store
# properties.
# Defaults to undef
#
# [*filesystem_store_file_perm*]
# (optional) File access permissions for the image files.
# Defaults to undef
#
# [*pipeline*]
# (optional) Partial name of a pipeline in your paste configuration file with the
# service name removed.
@ -317,12 +292,7 @@ class glance::api(
$lock_path = $::glance::params::lock_path,
$public_endpoint = $facts['os_service_default'],
# DEPRECATED PARAMETERS
$stores = undef,
$default_store = undef,
Boolean $multi_store = false,
$show_multiple_locations = undef,
$filesystem_store_metadata_file = undef,
$filesystem_store_file_perm = undef,
Optional[String] $pipeline = undef,
$location_strategy = undef,
) inherits glance {
@ -331,13 +301,6 @@ class glance::api(
include glance::policy
include glance::api::db
['filesystem_store_metadata_file', 'filesystem_store_file_perm'].each |String $fs_opt| {
if getvar($fs_opt) != undef {
warning("The ${fs_opt} parameter has been deprecated and will be removed.")
}
}
if $location_strategy != undef {
warning('The location_strategy parameter was deprecated and will be removed.')
}
@ -435,83 +398,21 @@ class glance::api(
glance_api_config {
'DEFAULT/enabled_backends': value => join($enabled_backends_array, ',');
'glance_store/default_backend': value => $default_backend;
'glance_store/stores': ensure => absent;
'glance_store/default_store': ensure => absent;
}
glance_cache_config {
'DEFAULT/enabled_backends': value => join($enabled_backends_array, ',');
'glance_store/default_backend': value => $default_backend;
'glance_store/stores': ensure => absent;
'glance_store/default_store': ensure => absent;
}
} elsif $stores or $default_store {
warning('The stores and default_store parameters are deprecated. Please use \
enabled_backends instead.')
if ($stores and !empty($stores)) {
# determine value for glance_store/stores
$stores_real = any2array($stores)
if !$default_store {
# set default store based on provided stores when it isn't explicitly set
warning("default_store not provided, it will be automatically set to ${stores[0]}")
$default_store_real = $stores[0]
} else {
$default_store_real = $default_store
}
} elsif $default_store {
# set stores based on default_store if only default_store is provided
$stores_real = [$default_store]
$default_store_real = $default_store
} else {
warning('Glance-api is being provisioned without any stores configured')
$stores_real = undef
$default_store_real = undef
}
if $multi_store {
if $default_store_real {
$default_store_opt = {
'glance_store/default_store' => {'value' => $default_store_real}
}
} else {
$default_store_opt = {
'glance_store/default_store' => {'ensure' => absent}
}
}
} else {
$default_store_opt = {}
}
if $stores_real {
$stores_opt = {
'glance_store/stores' => {'value' => join($stores_real, ',')}
}
} else {
$stores_opt = {
'glance_store/stores' => {'ensure' => absent}
}
}
create_resources('glance_api_config', merge($default_store_opt, $stores_opt))
create_resources('glance_cache_config', merge($default_store_opt, $stores_opt))
} else {
warning('Glance-api is being provisioned without any backends')
}
glance_api_config {
'glance_store/filesystem_store_metadata_file':
value => pick($filesystem_store_metadata_file, $facts['os_service_default']);
'glance_store/filesystem_store_file_perm':
value => pick($filesystem_store_file_perm, $facts['os_service_default']);
}
glance_cache_config {
'glance_store/filesystem_store_metadata_file':
value => pick($filesystem_store_metadata_file, $facts['os_service_default']);
'glance_store/filesystem_store_file_perm':
value => pick($filesystem_store_file_perm, $facts['os_service_default']);
glance_api_config {
'DEFAULT/enabled_backends': ensure => absent;
'glance_store/default_backend': ensure => absent;
}
glance_cache_config {
'DEFAULT/enabled_backends': ensure => absent;
'glance_store/default_backend': ensure => absent;
}
}
glance_api_config {
@ -529,7 +430,7 @@ enabled_backends instead.')
'DEFAULT/image_cache_max_size': value => $image_cache_max_size;
}
if $image_import_plugins != $facts['os_service_default'] {
if ! is_service_default($image_import_plugins) {
$image_import_plugins_real = sprintf('[%s]', join(any2array($image_import_plugins), ','))
} else {
$image_import_plugins_real = $image_import_plugins

View File

@ -1,110 +0,0 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# 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: glance::backend::cinder
#
# Setup Glance to backend images into Cinder
#
# === Parameters
#
# [*cinder_catalog_info*]
# (optional) 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)
# Defaults to $facts['os_service_default'].
#
# [*cinder_endpoint_template*]
# (optional) Override service catalog lookup with template for cinder endpoint.
# Should be a valid URL. Example: 'http://localhost:8776/v1/%(project_id)s'
# Defaults to $facts['os_service_default'].
#
# [*cinder_ca_certificates_file*]
# (optional) Location of ca certificate file to use for cinder client requests.
# Should be a valid ca certificate file
# Defaults to $facts['os_service_default'].
#
# [*cinder_http_retries*]
# (optional) Number of cinderclient retries on failed http calls.
# Should be a valid integer
# Defaults to $facts['os_service_default'].
#
# [*cinder_api_insecure*]
# (optional) Allow to perform insecure SSL requests to cinder.
# Should be a valid boolean value
# Defaults to $facts['os_service_default'].
#
# [*cinder_store_auth_address*]
# (optional) A valid authentication service address.
# Defaults to $facts['os_service_default'].
#
# [*cinder_store_project_name*]
# (optional) Project name where the image volume is stored in cinder.
# Defaults to $facts['os_service_default'].
#
# [*cinder_store_user_name*]
# (optional) User name to authenticate against cinder.
# Defaults to $facts['os_service_default'].
#
# [*cinder_store_password*]
# (optional) A valid password for the user specified by `cinder_store_user_name'
# Defaults to $facts['os_service_default'].
#
# [*cinder_os_region_name*]
# (optional) Sets the keystone region to use.
# Defaults to 'RegionOne'.
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
#
class glance::backend::cinder(
$cinder_ca_certificates_file = $facts['os_service_default'],
$cinder_api_insecure = $facts['os_service_default'],
$cinder_catalog_info = $facts['os_service_default'],
$cinder_endpoint_template = $facts['os_service_default'],
$cinder_http_retries = $facts['os_service_default'],
$cinder_store_auth_address = $facts['os_service_default'],
$cinder_store_project_name = $facts['os_service_default'],
$cinder_store_user_name = $facts['os_service_default'],
$cinder_store_password = $facts['os_service_default'],
$cinder_os_region_name = 'RegionOne',
Boolean $multi_store = false,
) {
include glance::deps
warning('glance::backend::cinder is deprecated. Use glance::backend::multistore::cinder instead.')
glance::backend::multistore::cinder { 'glance_store':
cinder_api_insecure => $cinder_api_insecure,
cinder_catalog_info => $cinder_catalog_info,
cinder_http_retries => $cinder_http_retries,
cinder_endpoint_template => $cinder_endpoint_template,
cinder_ca_certificates_file => $cinder_ca_certificates_file,
cinder_store_auth_address => $cinder_store_auth_address,
cinder_store_project_name => $cinder_store_project_name,
cinder_store_user_name => $cinder_store_user_name,
cinder_store_password => $cinder_store_password,
cinder_os_region_name => $cinder_os_region_name,
store_description => undef,
}
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'cinder'; }
glance_cache_config { 'glance_store/default_store': value => 'cinder'; }
}
}

View File

@ -1,40 +0,0 @@
# === class: glance::backend::file
#
# used to configure file backends for glance
#
# === parameters:
#
# [*filesystem_store_datadir*]
# Location where dist images are stored when
# default_store == file.
# Optional. Default: /var/lib/glance/images/
#
# [*filesystem_thin_provisioning*]
# (optional) Boolean describing if thin provisioning is enabled or not
# Defaults to $facts['os_service_default']
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
#
class glance::backend::file(
$filesystem_store_datadir = '/var/lib/glance/images/',
$filesystem_thin_provisioning = $facts['os_service_default'],
Boolean $multi_store = false,
) {
include glance::deps
warning('glance::backend::file is deprecated. Use glance::backend::multistore::file instead.')
glance::backend::multistore::file { 'glance_store':
filesystem_store_datadir => $filesystem_store_datadir,
filesystem_thin_provisioning => $filesystem_thin_provisioning,
store_description => undef,
}
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'file'; }
glance_cache_config { 'glance_store/default_store': value => 'file'; }
}
}

View File

@ -76,29 +76,21 @@ define glance::backend::multistore::file(
glance_api_config {
"${name}/filesystem_store_datadir": value => $filesystem_store_datadir;
"${name}/filesystem_store_datadirs": value => $filesystem_store_datadirs;
"${name}/filesystem_store_metadata_file": value => $filesystem_store_metadata_file;
"${name}/filesystem_store_file_perm": value => $filesystem_store_file_perm;
"${name}/filesystem_store_chunk_size": value => $filesystem_store_chunk_size;
"${name}/filesystem_thin_provisioning": value => $filesystem_thin_provisioning;
"${name}/store_description": value => $store_description;
"${name}/weight": value => $weight;
}
if $name != 'glance_store' {
# NOTE(tkajinam): This logic is required to avoid conflict with glance::api
glance_api_config {
"${name}/filesystem_store_metadata_file": value => $filesystem_store_metadata_file;
"${name}/filesystem_store_file_perm": value => $filesystem_store_file_perm;
}
glance_cache_config {
"${name}/filesystem_store_metadata_file": value => $filesystem_store_metadata_file;
"${name}/filesystem_store_file_perm": value => $filesystem_store_file_perm;
}
}
glance_cache_config {
"${name}/filesystem_store_datadir": value => $filesystem_store_datadir;
"${name}/filesystem_store_datadirs": value => $filesystem_store_datadirs;
"${name}/filesystem_store_chunk_size": value => $filesystem_store_chunk_size;
"${name}/filesystem_thin_provisioning": value => $filesystem_thin_provisioning;
"${name}/weight": value => $weight;
"${name}/filesystem_store_datadir": value => $filesystem_store_datadir;
"${name}/filesystem_store_datadirs": value => $filesystem_store_datadirs;
"${name}/filesystem_store_metadata_file": value => $filesystem_store_metadata_file;
"${name}/filesystem_store_file_perm": value => $filesystem_store_file_perm;
"${name}/filesystem_store_chunk_size": value => $filesystem_store_chunk_size;
"${name}/filesystem_thin_provisioning": value => $filesystem_thin_provisioning;
"${name}/weight": value => $weight;
}
}

View File

@ -1,74 +0,0 @@
# == class: glance::backend::rbd
#
# configures the storage backend for glance
# as a rbd instance
#
# === parameters:
#
# [*rbd_store_user*]
# Optional. Default: $facts['os_service_default'].
#
# [*rbd_store_pool*]
# Optional. Default: $facts['os_service_default'].
#
# [*rbd_store_ceph_conf*]
# Optional. Default: $facts['os_service_default'].
#
# [*rbd_store_chunk_size*]
# Optional. Default: $facts['os_service_default'].
#
# [*rbd_thin_provisioning*]
# Optional. Boolean describing if thin provisioning is enabled or not
# Defaults to $facts['os_service_default']
#
# [*manage_packages*]
# Optional. Whether we should manage the packages.
# Defaults to true,
#
# [*package_ensure*]
# Optional. Desired ensure state of packages.
# accepts latest or specific versions.
# Defaults to present.
#
# [*rados_connect_timeout*]
# Optional. Timeout value (in seconds) used when connecting to ceph cluster.
# Default: $facts['os_service_default'].
#
# [*multi_store*]
# Optional. Boolean describing if multiple backends will be configured
# Defaults to false
#
class glance::backend::rbd(
$rbd_store_user = $facts['os_service_default'],
$rbd_store_ceph_conf = $facts['os_service_default'],
$rbd_store_pool = $facts['os_service_default'],
$rbd_store_chunk_size = $facts['os_service_default'],
$rbd_thin_provisioning = $facts['os_service_default'],
Boolean $manage_packages = true,
$package_ensure = 'present',
$rados_connect_timeout = $facts['os_service_default'],
Boolean $multi_store = false,
) {
include glance::deps
include glance::params
warning('glance::backend::rbd is deprecated. Use glance::backend::multistore::rbd instead.')
glance::backend::multistore::rbd { 'glance_store':
rbd_store_ceph_conf => $rbd_store_ceph_conf,
rbd_store_user => $rbd_store_user,
rbd_store_pool => $rbd_store_pool,
rbd_store_chunk_size => $rbd_store_chunk_size,
rbd_thin_provisioning => $rbd_thin_provisioning,
rados_connect_timeout => $rados_connect_timeout,
manage_packages => $manage_packages,
package_ensure => $package_ensure,
store_description => undef,
}
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'rbd'; }
glance_cache_config { 'glance_store/default_store': value => 'rbd'; }
}
}

View File

@ -1,102 +0,0 @@
# == class: glance::backend::swift
#
# configures the storage backend for glance
# as a swift instance
#
# === parameters:
#
# [*swift_store_user*]
# Required. Swift store user.
#
# [*swift_store_key*]
# Required. Swift store key.
#
# [*swift_store_auth_address*]
# Optional. Default: 'http://127.0.0.1:5000/v3/'
#
# [*swift_store_auth_project_domain_id*]
# Optional. Useful when keystone auth is version 3. Default: default
#
# [*swift_store_auth_user_domain_id*]
# Optional. Useful when keystone auth is version 3. Default: default
#
# [*swift_store_container*]
# Optional. Default: $facts['os_service_default'].
#
# [*swift_store_auth_version*]
# Optional. Default: '3'
#
# [*swift_store_large_object_size*]
# Optional. What size, in MB, should Glance start chunking image files
# and do a large object manifest in Swift?
# Default: $facts['os_service_default'].
#
# [*swift_store_large_object_chunk_size*]
# Optional. 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.
# Default: $facts['os_service_default'].
#
# [*swift_store_create_container_on_put*]
# Optional. Default: $facts['os_service_default'].
#
# [*swift_store_endpoint_type*]
# Optional. Default: 'internalURL'
#
# [*swift_store_region*]
# Optional. Default: $facts['os_service_default'].
#
# [*default_swift_reference*]
# Optional. The reference to the default swift
# account/backing store parameters to use for adding
# new images. String value.
# Default to 'ref1'.
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false
#
class glance::backend::swift(
$swift_store_user,
$swift_store_key,
$swift_store_auth_address = 'http://127.0.0.1:5000/v3/',
$swift_store_container = $facts['os_service_default'],
$swift_store_auth_version = '3',
$swift_store_auth_project_domain_id = 'default',
$swift_store_auth_user_domain_id = 'default',
$swift_store_large_object_size = $facts['os_service_default'],
$swift_store_large_object_chunk_size = $facts['os_service_default'],
$swift_store_create_container_on_put = $facts['os_service_default'],
$swift_store_endpoint_type = 'internalURL',
$swift_store_region = $facts['os_service_default'],
$default_swift_reference = 'ref1',
Boolean $multi_store = false,
) {
include glance::deps
include swift::client
warning('glance::backend::swift is deprecated. Use glance::backend::multistore::swift instead.')
glance::backend::multistore::swift { 'glance_store':
swift_store_user => $swift_store_user,
swift_store_key => $swift_store_key,
swift_store_auth_address => $swift_store_auth_address,
swift_store_container => $swift_store_container,
swift_store_auth_version => $swift_store_auth_version,
swift_store_auth_project_domain_id => $swift_store_auth_project_domain_id,
swift_store_auth_user_domain_id => $swift_store_auth_user_domain_id,
swift_store_large_object_size => $swift_store_large_object_size,
swift_store_large_object_chunk_size => $swift_store_large_object_chunk_size,
swift_store_create_container_on_put => $swift_store_create_container_on_put,
swift_store_endpoint_type => $swift_store_endpoint_type,
swift_store_region => $swift_store_region,
default_swift_reference => $default_swift_reference,
store_description => undef,
}
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'swift'; }
glance_cache_config { 'glance_store/default_store': value => 'swift'; }
}
}

View File

@ -1,115 +0,0 @@
#
# Copyright (C) 2014 Mirantis
#
# Author: Stepan Rogov <srogov@mirantis.com>
#
# 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: glance::backend::vsphere
#
# Setup Glance to backend images into VMWare vCenter/ESXi
#
# === Parameters
#
# [*vcenter_insecure*]
# (optional) If true, the ESX/vCenter server certificate is not verified.
# If false, then the default CA truststore is used for verification.
# This option is ignored if "vcenter_ca_file" is set.
# Defaults to 'True'.
#
# [*vcenter_ca_file*]
# (optional) The name of the CA bundle file which will be used in
# verifying vCenter server certificate. If parameter is not set
# then system truststore is used. If parameter is set,
# vcenter_insecure value is ignored.
# Defaults to $facts['os_service_default'].
#
# [*vcenter_datastores*]
# (Multi-valued) A list of datastores where the image
# can be stored. This option may be specified multiple times
# for specifying multiple datastores. The datastore name should
# be specified after its datacenter path, separated by ":".
# An optional weight may be given after the datastore name,
# separated again by ":". Thus, the required format
# becomes <datacenter_path>:<datastore_name>:<optional_weight>.
# When adding an image, the datastore with highest weight will be selected,
# unless there is not enough free space available in cases where the image
# size is already known. If no weight is given, it is assumed to be
# zero and the directory will be considered for selection last.
# If multiple datastores have the same weight, then the one with the most
# free space available is selected.
# Defaults to $facts['os_service_default'].
#
# [*vcenter_host*]
# (required) vCenter/ESXi Server target system.
# Should be a valid an IP address or a DNS name.
#
# [*vcenter_user*]
# (required) Username for authenticating with vCenter/ESXi server.
#
# [*vcenter_password*]
# (required) Password for authenticating with vCenter/ESXi server.
#
# [*vcenter_image_dir*]
# (required) The name of the directory where the glance images will be stored
# in the VMware datastore.
#
# [*vcenter_task_poll_interval*]
# (optional) The interval used for polling remote tasks invoked on
# vCenter/ESXi server.
# Defaults to $facts['os_service_default'].
#
# [*vcenter_api_retry_count*]
# (optional) Number of times VMware ESX/VC server API must be retried upon
# connection related issues.
# Defaults to $facts['os_service_default'].
#
# [*multi_store*]
# (optional) Boolean describing if multiple backends will be configured
# Defaults to false.
#
class glance::backend::vsphere(
$vcenter_host,
$vcenter_user,
$vcenter_password,
$vcenter_image_dir,
$vcenter_ca_file = $facts['os_service_default'],
$vcenter_datastores = $facts['os_service_default'],
$vcenter_insecure = 'True',
$vcenter_task_poll_interval = $facts['os_service_default'],
$vcenter_api_retry_count = $facts['os_service_default'],
Boolean $multi_store = false,
) {
include glance::deps
warning('glance::backend::vsphere is deprecated. Use glance::backend::multistore::vsphere instead.')
glance::backend::multistore::vsphere { 'glance_store':
vmware_server_host => $vcenter_host,
vmware_server_username => $vcenter_user,
vmware_server_password => $vcenter_password,
vmware_store_image_dir => $vcenter_image_dir,
vmware_ca_file => $vcenter_ca_file,
vmware_datastores => $vcenter_datastores,
vmware_insecure => $vcenter_insecure,
vmware_task_poll_interval => $vcenter_task_poll_interval,
vmware_api_retry_count => $vcenter_api_retry_count,
store_description => undef,
}
if !$multi_store {
glance_api_config { 'glance_store/default_store': value => 'vsphere'; }
glance_cache_config { 'glance_store/default_store': value => 'vsphere'; }
}
}

View File

@ -0,0 +1,18 @@
---
upgrade:
- |
The following parameters of the ``glance::api`` class have been removed.
- ``stores``
- ``default_store``
- ``multi_store``
- ``filesystem_store_metadata_file``
- ``filesystem_store_file_perm``
- |
The following defined resource types have been removed.
- ``cinder::backend::cinder``
- ``cinder::backend::file``
- ``cinder::backend::rbd``
- ``cinder::backend::vsphere``

View File

@ -18,8 +18,6 @@ describe 'glance::api' do
:workers => '7',
:show_image_direct_url => '<SERVICE DEFAULT>',
:show_multiple_locations => '<SERVICE DEFAULT>',
:filesystem_store_metadata_file => '<SERVICE DEFAULT>',
:filesystem_store_file_perm => '<SERVICE DEFAULT>',
:location_strategy => '<SERVICE DEFAULT>',
:purge_config => false,
:delayed_delete => '<SERVICE DEFAULT>',
@ -68,8 +66,6 @@ describe 'glance::api' do
:workers => '5',
:show_image_direct_url => true,
:show_multiple_locations => true,
:filesystem_store_metadata_file => '/etc/glance/glance-metadata-file.conf',
:filesystem_store_file_perm => '0644',
:location_strategy => 'store_type',
:delayed_delete => 'true',
:enforce_secure_rbac => 'true',
@ -189,16 +185,6 @@ describe 'glance::api' do
end
end
it 'is_expected.to lay down default glance_store api config' do
[
'filesystem_store_metadata_file',
'filesystem_store_file_perm',
].each do |config|
is_expected.to contain_glance_api_config("glance_store/#{config}").with_value(param_hash[config.intern])
is_expected.to contain_glance_cache_config("glance_store/#{config}").with_value(param_hash[config.intern])
end
end
it 'is_expected.to lay down default task & taskflow_executor config' do
is_expected.to contain_glance_api_config('task/task_time_to_live').with_value(param_hash[:task_time_to_live])
is_expected.to contain_glance_api_config('task/task_executor').with_value(param_hash[:task_executor])
@ -366,12 +352,11 @@ describe 'glance::api' do
end
end
describe 'with enabled_backends and stores by default' do
it { is_expected.to_not contain_glance_api_config('DEFAULT/enabled_backends').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_api_config('glance_store/stores').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_cache_config('DEFAULT/enabled_backends').with_value('<SERVICE DEFAULT>') }
it { is_expected.to_not contain_glance_cache_config('glance_store/stores').with_value('<SERVICE DEFAULT>') }
describe 'with enabled_backends by default' do
it { is_expected.to contain_glance_api_config('DEFAULT/enabled_backends').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('glance_store/default_backend').with_ensure('absent') }
it { is_expected.to contain_glance_cache_config('DEFAULT/enabled_backends').with_ensure('absent') }
it { is_expected.to contain_glance_cache_config('glance_store/default_backend').with_ensure('absent') }
end
describe 'with enabled_backends' do
@ -379,20 +364,14 @@ describe 'glance::api' do
{
:enabled_backends => ['file1:file','http1:http'],
:default_backend => 'file1',
:stores => ['file','http'],
:default_store => 'file',
}
end
it { is_expected.to contain_glance_api_config('DEFAULT/enabled_backends').with_value('file1:file,http1:http') }
it { is_expected.to contain_glance_api_config('glance_store/default_backend').with_value('file1') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_ensure('absent') }
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_ensure('absent') }
it { is_expected.to contain_glance_cache_config('DEFAULT/enabled_backends').with_value('file1:file,http1:http') }
it { is_expected.to contain_glance_cache_config('glance_store/default_backend').with_value('file1') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_ensure('absent') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_ensure('absent') }
end
describe 'with invalid backend type' do
@ -438,67 +417,6 @@ describe 'glance::api' do
it_raises 'a Puppet::Error', / is not a valid backend identifier./
end
describe 'with stores override' do
let :params do
{
:default_store => 'file',
:stores => ['file','http'],
:multi_store => true,
}
end
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file,http') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file,http') }
end
describe 'with single store override and no default store' do
let :params do
{
:stores => ['file'],
:multi_store => true,
}
end
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file') }
end
describe 'with multiple stores override and no default store' do
let :params do
{
:stores => ['file', 'http'],
:multi_store => true,
}
end
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file,http') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file,http') }
end
describe 'with default_store' do
let :params do
{
:default_store => 'file',
:multi_store => true,
}
end
it { is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_api_config('glance_store/stores').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file') }
it { is_expected.to contain_glance_cache_config('glance_store/stores').with_value('file') }
end
describe 'with task & taskflow configuration' do
let :params do
{

View File

@ -1,115 +0,0 @@
#
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
#
# Author: Emilien Macchi <emilien.macchi@enovance.com>
#
# 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.
#
# Unit tests for glance::backend::cinder class
#
require 'spec_helper'
describe 'glance::backend::cinder' do
let :pre_condition do
'class { "glance::api::authtoken": password => "pass" }'
end
shared_examples_for 'glance with cinder backend' do
context 'when default parameters' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_api_config('glance_store/cinder_api_insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_catalog_info').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_http_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_ca_certificates_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_endpoint_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_store_auth_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_store_project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_store_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/cinder_os_region_name').with_value('RegionOne')
is_expected.to contain_glance_api_config('glance_store/cinder_store_password').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('cinder')
is_expected.to contain_glance_cache_config('glance_store/cinder_api_insecure').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_catalog_info').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_ca_certificates_file').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_auth_address').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/cinder_os_region_name').with_value('RegionOne')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_password').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding parameters' do
let :params do
{
:cinder_api_insecure => true,
:cinder_ca_certificates_file => '/etc/ssh/ca.crt',
:cinder_catalog_info => 'volume:cinder:internalURL',
:cinder_endpoint_template => 'http://srv-foo:8776/v1/%(project_id)s',
:cinder_http_retries => '10',
:cinder_store_auth_address => '127.0.0.2:8080/v3/',
:cinder_store_project_name => 'services',
:cinder_store_user_name => 'glance',
:cinder_store_password => 'glance',
:cinder_os_region_name => 'RegionTwo',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/cinder_api_insecure').with_value(true)
is_expected.to contain_glance_api_config('glance_store/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
is_expected.to contain_glance_api_config('glance_store/cinder_catalog_info').with_value('volume:cinder:internalURL')
is_expected.to contain_glance_api_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
is_expected.to contain_glance_api_config('glance_store/cinder_http_retries').with_value('10')
is_expected.to contain_glance_api_config('glance_store/cinder_store_auth_address').with_value('127.0.0.2:8080/v3/')
is_expected.to contain_glance_api_config('glance_store/cinder_store_project_name').with_value('services')
is_expected.to contain_glance_api_config('glance_store/cinder_store_user_name').with_value('glance')
is_expected.to contain_glance_api_config('glance_store/cinder_store_password').with_value('glance')
is_expected.to contain_glance_api_config('glance_store/cinder_os_region_name').with_value('RegionTwo')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/cinder_api_insecure').with_value(true)
is_expected.to contain_glance_cache_config('glance_store/cinder_ca_certificates_file').with_value('/etc/ssh/ca.crt')
is_expected.to contain_glance_cache_config('glance_store/cinder_catalog_info').with_value('volume:cinder:internalURL')
is_expected.to contain_glance_cache_config('glance_store/cinder_endpoint_template').with_value('http://srv-foo:8776/v1/%(project_id)s')
is_expected.to contain_glance_cache_config('glance_store/cinder_http_retries').with_value('10')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_auth_address').with_value('127.0.0.2:8080/v3/')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_project_name').with_value('services')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_user_name').with_value('glance')
is_expected.to contain_glance_cache_config('glance_store/cinder_store_password').with_value('glance')
is_expected.to contain_glance_cache_config('glance_store/cinder_os_region_name').with_value('RegionTwo')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'glance with cinder backend'
end
end
end

View File

@ -1,50 +0,0 @@
require 'spec_helper'
describe 'glance::backend::file' do
shared_examples_for 'glance::backend::file' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('file')
is_expected.to contain_glance_api_config('glance_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('file')
is_expected.to contain_glance_cache_config('glance_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/var/lib/glance/images/')
end
describe 'when overriding datadir' do
let :params do
{
:filesystem_store_datadir => '/tmp/',
:filesystem_thin_provisioning => 'true',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
is_expected.to contain_glance_api_config('glance_store/filesystem_thin_provisioning').with_value('true')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/filesystem_store_datadir').with_value('/tmp/')
is_expected.to contain_glance_cache_config('glance_store/filesystem_thin_provisioning').with_value('true')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'glance::backend::file'
end
end
end

View File

@ -1,92 +0,0 @@
require 'spec_helper'
describe 'glance::backend::rbd' do
shared_examples 'glance::backend::rbd' do
context 'with default params' do
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/default_store').with_value('rbd')
should contain_glance_api_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_glance_api_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('glance_store/default_store').with_value('rbd')
should contain_glance_cache_config('glance_store/rbd_store_pool').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_store_ceph_conf').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_store_chunk_size').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_thin_provisioning').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rados_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_glance_cache_config('glance_store/rbd_store_user').with_value('<SERVICE DEFAULT>')
end
it { should contain_package('python-ceph').with(
:name => platform_params[:pyceph_package_name],
:ensure => 'installed'
)}
end
context 'when passing params' do
let :params do
{
:rbd_store_user => 'user',
:rbd_store_chunk_size => '2',
:rbd_thin_provisioning => 'true',
:package_ensure => 'latest',
:rados_connect_timeout => '30',
}
end
it 'configures glance-api.conf' do
should contain_glance_api_config('glance_store/rbd_store_user').with_value('user')
should contain_glance_api_config('glance_store/rbd_store_chunk_size').with_value('2')
should contain_glance_api_config('glance_store/rbd_thin_provisioning').with_value('true')
should contain_glance_api_config('glance_store/rados_connect_timeout').with_value('30')
end
it 'configures glance-cache.conf' do
should contain_glance_cache_config('glance_store/rbd_store_user').with_value('user')
should contain_glance_cache_config('glance_store/rbd_store_chunk_size').with_value('2')
should contain_glance_cache_config('glance_store/rbd_thin_provisioning').with_value('true')
should contain_glance_cache_config('glance_store/rados_connect_timeout').with_value('30')
end
it { should contain_package('python-ceph').with(
:name => platform_params[:pyceph_package_name],
:ensure => 'latest'
)}
end
context 'when not managing packages' do
let :params do
{
:manage_packages => false,
}
end
it { should_not contain_package('python-ceph') }
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
let(:platform_params) do
case facts[:os]['family']
when 'Debian'
{ :pyceph_package_name => 'python3-ceph' }
when 'RedHat'
{ :pyceph_package_name => 'python3-rbd' }
end
end
it_behaves_like 'glance::backend::rbd'
end
end
end

View File

@ -1,47 +0,0 @@
require 'spec_helper'
describe 'glance::backend::reserved::staging' do
shared_examples_for 'glance::backend::reserved::staging' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_datadir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_file_perm').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
end
describe 'when overriding datadir' do
let :params do
{
:filesystem_store_datadir => '/var/lib/glance/staging',
:filesystem_store_file_perm => 0,
:filesystem_store_chunk_size => 65536,
:filesystem_thin_provisioning => true,
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_datadir')\
.with_value('/var/lib/glance/staging')
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_file_perm')\
.with_value(0)
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_store_chunk_size')\
.with_value(65536)
is_expected.to contain_glance_api_config('os_glance_staging_store/filesystem_thin_provisioning')\
.with_value(true)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'glance::backend::reserved::staging'
end
end
end

View File

@ -1,47 +0,0 @@
require 'spec_helper'
describe 'glance::backend::reserved::tasks' do
shared_examples_for 'glance::backend::reserved::tasks' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_datadir').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_file_perm').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_thin_provisioning').with_value('<SERVICE DEFAULT>')
end
describe 'when overriding datadir' do
let :params do
{
:filesystem_store_datadir => '/var/lib/glance/tasks',
:filesystem_store_file_perm => 0,
:filesystem_store_chunk_size => 65536,
:filesystem_thin_provisioning => true,
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_datadir')\
.with_value('/var/lib/glance/tasks')
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_file_perm')\
.with_value(0)
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_store_chunk_size')\
.with_value(65536)
is_expected.to contain_glance_api_config('os_glance_tasks_store/filesystem_thin_provisioning')\
.with_value(true)
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'glance::backend::reserved::tasks'
end
end
end

View File

@ -1,112 +0,0 @@
require 'spec_helper'
describe 'glance::backend::swift' do
shared_examples_for 'glance::backend::swift' do
let :params do
{
:swift_store_user => 'user',
:swift_store_key => 'key',
}
end
let :pre_condition do
'class { "glance::api::authtoken": password => "pass" }
include glance::api'
end
describe 'when default parameters' do
it { is_expected.to contain_class 'swift::client' }
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('swift')
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/swift_store_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/swift_store_create_container_on_put').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('internalURL')
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('ref1')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('swift')
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_chunk_size').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_container').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_create_container_on_put').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_endpoint_type').with_value('internalURL')
is_expected.to contain_glance_cache_config('glance_store/swift_store_region').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/swift_store_config_file').with_value('/etc/glance/glance-swift.conf')
is_expected.to contain_glance_cache_config('glance_store/default_swift_reference').with_value('ref1')
end
it 'configures glance-swift.conf' do
is_expected.to contain_glance_swift_config('ref1/key').with_value('key')
is_expected.to contain_glance_swift_config('ref1/user').with_value('user')
is_expected.to contain_glance_swift_config('ref1/auth_version').with_value('3')
is_expected.to contain_glance_swift_config('ref1/auth_address').with_value('http://127.0.0.1:5000/v3/')
is_expected.to contain_glance_swift_config('ref1/user_domain_id').with_value('default')
is_expected.to contain_glance_swift_config('ref1/project_domain_id').with_value('default')
end
end
describe 'when overriding parameters' do
let :params do
{
:swift_store_user => 'user2',
:swift_store_key => 'key2',
:swift_store_auth_version => '1',
:swift_store_auth_project_domain_id => 'proj_domain',
:swift_store_auth_user_domain_id => 'user_domain',
:swift_store_large_object_size => '100',
:swift_store_large_object_chunk_size => '50',
:swift_store_auth_address => '127.0.0.2:8080/v1.0/',
:swift_store_container => 'swift',
:swift_store_create_container_on_put => true,
:swift_store_endpoint_type => 'publicURL',
:swift_store_region => 'RegionTwo',
:default_swift_reference => 'swift_creds',
}
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/swift_store_container').with_value('swift')
is_expected.to contain_glance_api_config('glance_store/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_api_config('glance_store/swift_store_large_object_chunk_size').with_value('50')
is_expected.to contain_glance_api_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_api_config('glance_store/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_api_config('glance_store/default_swift_reference').with_value('swift_creds')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/swift_store_container').with_value('swift')
is_expected.to contain_glance_cache_config('glance_store/swift_store_create_container_on_put').with_value(true)
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_size').with_value('100')
is_expected.to contain_glance_cache_config('glance_store/swift_store_large_object_chunk_size').with_value('50')
is_expected.to contain_glance_cache_config('glance_store/swift_store_endpoint_type').with_value('publicURL')
is_expected.to contain_glance_cache_config('glance_store/swift_store_region').with_value('RegionTwo')
is_expected.to contain_glance_cache_config('glance_store/default_swift_reference').with_value('swift_creds')
end
it 'configures glance-swift.conf' do
is_expected.to contain_glance_swift_config('swift_creds/key').with_value('key2')
is_expected.to contain_glance_swift_config('swift_creds/user').with_value('user2')
is_expected.to contain_glance_swift_config('swift_creds/auth_version').with_value('1')
is_expected.to contain_glance_swift_config('swift_creds/auth_address').with_value('127.0.0.2:8080/v1.0/')
is_expected.to contain_glance_swift_config('swift_creds/user_domain_id').with_value('user_domain')
is_expected.to contain_glance_swift_config('swift_creds/project_domain_id').with_value('proj_domain')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'glance::backend::swift'
end
end
end

View File

@ -1,99 +0,0 @@
#
# Copyright (C) 2014 Mirantis
#
# Author: Steapn Rogov <srogov@mirantis.com>
#
# 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.
#
# Unit tests for glance::backend::vsphere class
#
require 'spec_helper'
describe 'glance::backend::vsphere' do
let :pre_condition do
'class { "glance::api::authtoken": password => "pass" }'
end
shared_examples_for 'glance with vsphere backend' do
let :params do
{
:vcenter_host => '10.0.0.1',
:vcenter_user => 'root',
:vcenter_password => '123456',
:vcenter_datastores => 'Datacenter:Datastore',
:vcenter_image_dir => '/openstack_glance',
}
end
context 'when default parameters' do
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/default_store').with_value('vsphere')
is_expected.to contain_glance_api_config('glance_store/vmware_insecure').with_value('True')
is_expected.to contain_glance_api_config('glance_store/vmware_server_host').with_value('10.0.0.1')
is_expected.to contain_glance_api_config('glance_store/vmware_server_username').with_value('root')
is_expected.to contain_glance_api_config('glance_store/vmware_server_password').with_value('123456').with_secret(true)
is_expected.to contain_glance_api_config('glance_store/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to contain_glance_api_config('glance_store/vmware_task_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_api_config('glance_store/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_api_config('glance_store/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/default_store').with_value('vsphere')
is_expected.to contain_glance_cache_config('glance_store/vmware_insecure').with_value('True')
is_expected.to contain_glance_cache_config('glance_store/vmware_server_host').with_value('10.0.0.1')
is_expected.to contain_glance_cache_config('glance_store/vmware_server_username').with_value('root')
is_expected.to contain_glance_cache_config('glance_store/vmware_server_password').with_value('123456').with_secret(true)
is_expected.to contain_glance_cache_config('glance_store/vmware_store_image_dir').with_value('/openstack_glance')
is_expected.to contain_glance_cache_config('glance_store/vmware_task_poll_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/vmware_api_retry_count').with_value('<SERVICE DEFAULT>')
is_expected.to contain_glance_cache_config('glance_store/vmware_datastores').with_value('Datacenter:Datastore')
is_expected.to contain_glance_cache_config('glance_store/vmware_ca_file').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding parameters' do
before do
params.merge!({
:vcenter_ca_file => '/etc/glance/vcenter-ca.pem',
:vcenter_task_poll_interval => '6',
:vcenter_api_retry_count => '11',
})
end
it 'configures glance-api.conf' do
is_expected.to contain_glance_api_config('glance_store/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem')
is_expected.to contain_glance_api_config('glance_store/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_api_config('glance_store/vmware_api_retry_count').with_value('11')
end
it 'configures glance-cache.conf' do
is_expected.to contain_glance_cache_config('glance_store/vmware_ca_file').with_value('/etc/glance/vcenter-ca.pem')
is_expected.to contain_glance_cache_config('glance_store/vmware_task_poll_interval').with_value('6')
is_expected.to contain_glance_cache_config('glance_store/vmware_api_retry_count').with_value('11')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
context "on #{os}" do
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
it_configures 'glance with vsphere backend'
end
end
end