Merge "Move default values to $::os_service_default"

This commit is contained in:
Jenkins 2015-11-03 16:53:14 +00:00 committed by Gerrit Code Review
commit 054569dd1c
15 changed files with 219 additions and 161 deletions

View File

@ -42,19 +42,19 @@
# (optional) OpenStack privileged account username. Used for requests to
# other services (such as Nova) that require an account with
# special rights.
# Defaults to undef.
# Defaults to $::os_service_default.
#
# [*os_privileged_user_password*]
# (optional) Password associated with the OpenStack privileged account.
# Defaults to undef.
# Defaults to $::os_service_default.
#
# [*os_privileged_user_tenant*]
# (optional) Tenant name associated with the OpenStack privileged account.
# Defaults to undef.
# Defaults to $::os_service_default.
#
# [*os_privileged_user_auth_url*]
# (optional) Auth URL associated with the OpenStack privileged account.
# Defaults to undef.
# Defaults to $::os_service_default.
#
# [*os_region_name*]
# (optional) Some operations require cinder to make API requests
@ -117,7 +117,7 @@
#
# [*ratelimits*]
# (optional) The state of the service
# Defaults to undef. If undefined the default ratelimiting values are used.
# Defaults to $::os_service_default. If undefined the default ratelimiting values are used.
#
# [*ratelimits_factory*]
# (optional) Factory to use for ratelimiting
@ -165,16 +165,16 @@ class cinder::api (
$nova_catalog_admin_info = 'compute:Compute Service:adminURL',
$os_region_name = $::os_service_default,
$privileged_user = false,
$os_privileged_user_name = undef,
$os_privileged_user_password = undef,
$os_privileged_user_tenant = undef,
$os_privileged_user_auth_url = undef,
$os_privileged_user_name = $::os_service_default,
$os_privileged_user_password = $::os_service_default,
$os_privileged_user_tenant = $::os_service_default,
$os_privileged_user_auth_url = $::os_service_default,
$service_workers = $::processorcount,
$package_ensure = 'present',
$bind_host = '0.0.0.0',
$enabled = true,
$manage_service = true,
$ratelimits = undef,
$ratelimits = $::os_service_default,
$default_volume_type = $::os_service_default,
$ratelimits_factory =
'cinder.api.v1.limits:RateLimitingMiddleware.factory',
@ -244,40 +244,25 @@ class cinder::api (
}
if $privileged_user {
if !$os_privileged_user_name {
if is_service_default($os_privileged_user_name) {
fail('The os_privileged_user_name parameter is required when privileged_user is set to true')
}
if !$os_privileged_user_password {
if is_service_default($os_privileged_user_password) {
fail('The os_privileged_user_password parameter is required when privileged_user is set to true')
}
if !$os_privileged_user_tenant {
if is_service_default($os_privileged_user_tenant) {
fail('The os_privileged_user_tenant parameter is required when privileged_user is set to true')
}
cinder_config {
'DEFAULT/os_privileged_user_password': value => $os_privileged_user_password;
'DEFAULT/os_privileged_user_tenant': value => $os_privileged_user_tenant;
'DEFAULT/os_privileged_user_name': value => $os_privileged_user_name;
}
if $os_privileged_user_auth_url {
cinder_config {
'DEFAULT/os_privileged_user_auth_url': value => $os_privileged_user_auth_url;
}
} else {
cinder_config {
'DEFAULT/os_privileged_user_auth_url': ensure => absent;
}
}
} else {
cinder_config {
'DEFAULT/os_privileged_user_password': ensure => absent;
'DEFAULT/os_privileged_user_tenant': ensure => absent;
'DEFAULT/os_privileged_user_name': ensure => absent;
'DEFAULT/os_privileged_user_auth_url': ensure => absent;
}
}
cinder_config {
'DEFAULT/os_privileged_user_password': value => $os_privileged_user_password;
'DEFAULT/os_privileged_user_tenant': value => $os_privileged_user_tenant;
'DEFAULT/os_privileged_user_name': value => $os_privileged_user_name;
'DEFAULT/os_privileged_user_auth_url': value => $os_privileged_user_auth_url;
}
if $keystone_auth_uri and $auth_uri {
fail('both keystone_auth_uri and auth_uri are set and they have the same meaning')
}
@ -393,7 +378,7 @@ class cinder::api (
}
}
if ($ratelimits != undef) {
if (!is_service_default($ratelimits)) {
cinder_api_paste_ini {
'filter:ratelimit/paste.filter_factory': value => $ratelimits_factory;
'filter:ratelimit/limits': value => $ratelimits;

View File

@ -14,19 +14,19 @@
#
# [*backup_topic*]
# (optional) The topic volume backup nodes listen on.
# Defaults to 'cinder-backup'
# Defaults to $::os_service_default
#
# [*backup_manager*]
# (optional) Full class name for the Manager for volume backup.
# Defaults to 'cinder.backup.manager.BackupManager'
# Defaults to $::os_service_default
#
# [*backup_api_class*]
# (optional) The full class name of the volume backup API class.
# Defaults to 'cinder.backup.api.API'
# Defaults to $::os_service_default
#
# [*backup_name_template*]
# (optional) Template string to be used to generate backup names.
# Defaults to 'backup-%s'
# Defaults to $::os_service_default
#
# === Author(s)
#
@ -52,10 +52,10 @@
class cinder::backup (
$enabled = true,
$package_ensure = 'present',
$backup_topic = 'cinder-backup',
$backup_manager = 'cinder.backup.manager.BackupManager',
$backup_api_class = 'cinder.backup.api.API',
$backup_name_template = 'backup-%s'
$backup_topic = $::os_service_default,
$backup_manager = $::os_service_default,
$backup_api_class = $::os_service_default,
$backup_name_template = $::os_service_default,
) {
include ::cinder::params

View File

@ -17,23 +17,23 @@
# backups. If the volume being backed up exceeds this size, then
# it will be backed up into multiple files. This must be a multiple
# of the backup_sha_block_size_bytes parameter.
# Defaults to 1999994880
# Defaults to $::os_service_default
#
# [*backup_sha_block_size_bytes*]
# (optional) The size in bytes that changes are tracked for
# incremental backups.
# Defaults to 32768
# Defaults to $::os_service_default
#
# [*backup_enable_progress_timer*]
# (optional) Enable or Disable the timer to send the periodic
# progress notifications to Ceilometer when backing up the volume
# to the backend storage.
# Defaults to true
# Defaults to $::os_service_default
#
# [*backup_mount_point_base*]
# (optional) The base directory containing the mount point for the
# NFS share.
# Defaults to '$state_path/backup_mount'
# Defaults to $::os_service_default
#
# [*backup_mount_options*]
# (optional) The mount options that are passed to the NFS client.
@ -45,7 +45,7 @@
#
# [*backup_compression_algorithm*]
# (optional) Compression algorithm to use when writing backup data.
# Defaults to 'zlib'
# Defaults to $::os_service_default
#
# === Author(s)
#
@ -71,13 +71,13 @@
class cinder::backup::nfs (
$backup_share,
$backup_driver = 'cinder.backup.drivers.nfs',
$backup_file_size = 1999994880,
$backup_sha_block_size_bytes = 32768,
$backup_enable_progress_timer = true,
$backup_mount_point_base = '$state_path/backup_mount',
$backup_file_size = $::os_service_default,
$backup_sha_block_size_bytes = $::os_service_default,
$backup_enable_progress_timer = $::os_service_default,
$backup_mount_point_base = $::os_service_default,
$backup_mount_options = $::os_service_default,
$backup_container = $::os_service_default,
$backup_compression_algorithm = 'zlib',
$backup_compression_algorithm = $::os_service_default,
) {
validate_string($backup_share)

View File

@ -19,19 +19,19 @@
#
# [*backup_swift_object_size*]
# (optional) The size in bytes of Swift backup objects.
# Defaults to '52428800'
# Defaults to $::os_service_default
#
# [*backup_swift_retry_attempts*]
# (optional) The number of retries to make for Swift operations.
# Defaults to '3'
# Defaults to $::os_service_default
#
# [*backup_swift_retry_backoff*]
# (optional) The backoff time in seconds between Swift retries.
# Defaults to '2'
# Defaults to $::os_service_default
#
# [*backup_compression_algorithm*]
# (optional) The compression algorithm for the chunks sent to swift
# Defaults to 'zlib'
# Defaults to $::os_service_default
# set to None to disable compression
#
# === Author(s)
@ -59,12 +59,16 @@ class cinder::backup::swift (
$backup_driver = 'cinder.backup.drivers.swift',
$backup_swift_url = 'http://localhost:8080/v1/AUTH_',
$backup_swift_container = 'volumes_backup',
$backup_swift_object_size = '52428800',
$backup_swift_retry_attempts = '3',
$backup_swift_retry_backoff = '2',
$backup_compression_algorithm = 'zlib',
$backup_swift_object_size = $::os_service_default,
$backup_swift_retry_attempts = $::os_service_default,
$backup_swift_retry_backoff = $::os_service_default,
$backup_compression_algorithm = $::os_service_default,
) {
if ($backup_swift_container == 'volumes_backup') {
warning('WARNING: The default backup_swift_container value in puppet differs from the OpenStack default and may change in future releases')
}
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_swift_url': value => $backup_swift_url;

View File

@ -16,11 +16,11 @@
#
# [*glance_num_retries*]
# (optional) Number retries when downloading an image from glance.
# Defaults to 0
# Defaults to $::os_service_default
#
# [*glance_api_insecure*]
# (optional) Allow to perform insecure SSL (https) requests to glance.
# Defaults to false
# Defaults to $::os_service_default
#
# [*glance_api_ssl_compression*]
# (optional) Whether to attempt to negotiate SSL layer compression when
@ -28,11 +28,11 @@
# layer compression. In some cases disabling this may improve
# data throughput, eg when high network bandwidth is available
# and you are using already compressed image formats such as qcow2.
# Defaults to false
# Defaults to $::os_service_default
#
# [*glance_request_timeout*]
# (optional) http/https timeout value for glance operations.
# Defaults to undef
# Defaults to $::os_service_default
#
# === Author(s)
#
@ -57,23 +57,14 @@
class cinder::glance (
$glance_api_servers = undef,
$glance_api_version = '2',
$glance_num_retries = '0',
$glance_api_insecure = false,
$glance_api_ssl_compression = false,
$glance_request_timeout = undef
$glance_num_retries = $::os_service_default,
$glance_api_insecure = $::os_service_default,
$glance_api_ssl_compression = $::os_service_default,
$glance_request_timeout = $::os_service_default,
) {
if is_array($glance_api_servers) {
cinder_config {
'DEFAULT/glance_api_servers': value => join($glance_api_servers, ',');
}
} elsif is_string($glance_api_servers) {
cinder_config {
'DEFAULT/glance_api_servers': value => $glance_api_servers;
}
}
cinder_config {
'DEFAULT/glance_api_servers': value => join(any2array($glance_api_servers), ',');
'DEFAULT/glance_api_version': value => $glance_api_version;
'DEFAULT/glance_num_retries': value => $glance_num_retries;
'DEFAULT/glance_api_insecure': value => $glance_api_insecure;

View File

@ -6,26 +6,26 @@
#
# [*quota_volumes*]
# (Optional) Number of volumes allowed per project.
# Defaults to '10'.
# Defaults to $::os_service_default
#
# [*quota_snapshots*]
# (Optional) Number of volume snapshots allowed per project.
# Defaults to '10'.
# Defaults to $::os_service_default
#
# [*quota_gigabytes*]
# (Optional) Number of volume gigabytes (snapshots are also included)
# allowed per project.
# Defaults to 1000.
# Defaults to $::os_service_default.
#
# [*quota_driver*]
# (Optional) Default driver to use for quota checks.
# Defaults to 'cinder.quota.DbQuotaDriver'.
# Defaults to $::os_service_default.
#
class cinder::quota (
$quota_volumes = 10,
$quota_snapshots = 10,
$quota_gigabytes = 1000,
$quota_driver = 'cinder.quota.DbQuotaDriver'
$quota_volumes = $::os_service_default,
$quota_snapshots = $::os_service_default,
$quota_gigabytes = $::os_service_default,
$quota_driver = $::os_service_default,
) {
cinder_config {

View File

@ -6,17 +6,19 @@
#
# [*scheduler_default_filters*]
# A comma separated list of filters to be used by default
# Defaults to false
# Defaults to $::os_service_default
class cinder::scheduler::filter (
$scheduler_default_filters = false,
$scheduler_default_filters = $::os_service_default,
) {
if ($scheduler_default_filters) {
cinder_config { 'DEFAULT/scheduler_default_filters': value => join($scheduler_default_filters,',')
if (!is_service_default($scheduler_default_filters)) {
cinder_config {
'DEFAULT/scheduler_default_filters': value => join(any2array($scheduler_default_filters),',')
}
} else {
cinder_config { 'DEFAULT/scheduler_default_filters': ensure => absent
cinder_config {
'DEFAULT/scheduler_default_filters': ensure => absent
}
}

View File

@ -12,7 +12,7 @@
# (optional) Specifies the path of the Image service repository in GPFS.
# Leave undefined if not storing images in GPFS. Defaults to "None" via
# driver.
# Defaults to <SERVICE DEFAULT>
# Defaults to $::os_service_default
#
# [*gpfs_images_share_mode*]
# (optional) Specifies the type of image copy to be used. Set this when the
@ -22,7 +22,7 @@
# the image is made; "copy_on_write" specifies that copy-on-write
# optimization strategy is used and unmodified blocks of the image file are
# shared efficiently. Defaults to "None" via driver.
# Defaults to <SERVICE DEFAULT>
# Defaults to $::os_service_default
#
# [*gpfs_max_clone_depth*]
# (optional) Specifies an upper limit on the number of indirections required
@ -30,19 +30,19 @@
# copy-on-write snapshots or clones can have a negative impact on
# performance, but improves space utilization. 0 indicates unlimited clone
# depth. Defaults to "0" via driver implementation
# Defaults to <SERVICE DEFAULT>
# Defaults to $::os_service_default
#
# [*gpfs_sparse_volumes*]
# (optional) Specifies that volumes are created as sparse files which
# initially consume no space. If set to False, the volume is created as a
# fully allocated file, in which case, creation may take a significantly
# longer time. Defaults to "True" via driver.
# Defaults to <SERVICE DEFAULT>
# Defaults to $::os_service_default
#
# [*gpfs_storage_pool*]
# (optional) Specifies the storage pool that volumes are assigned to. By
# default, the system storage pool is used. Defaults to "system" via driver.
# Defaults to <SERVICE DEFAULT>
# Defaults to $::os_service_default
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
@ -60,11 +60,11 @@
#
class cinder::volume::gpfs(
$gpfs_mount_point_base,
$gpfs_images_dir = '<SERVICE DEFAULT>',
$gpfs_images_share_mode = '<SERVICE DEFAULT>',
$gpfs_max_clone_depth = '<SERVICE DEFAULT>',
$gpfs_sparse_volumes = '<SERVICE DEFAULT>',
$gpfs_storage_pool = '<SERVICE DEFAULT>',
$gpfs_images_dir = $::os_service_default,
$gpfs_images_share_mode = $::os_service_default,
$gpfs_max_clone_depth = $::os_service_default,
$gpfs_sparse_volumes = $::os_service_default,
$gpfs_storage_pool = $::os_service_default,
$extra_options = {}
) {
cinder::backend::gpfs { 'DEFAULT':

View File

@ -80,10 +80,10 @@ describe 'cinder::api' do
:value => 'http://localhost:5000/'
)
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_name').with_ensure('absent')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_password').with_ensure('absent')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_tenant').with_ensure('absent')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_auth_url').with_ensure('absent')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_password').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_tenant').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_auth_url').with_value('<SERVICE DEFAULT>')
end
end
@ -141,7 +141,7 @@ describe 'cinder::api' do
it { is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_name').with_value('admin') }
it { is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_password').with_value('password') }
it { is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_tenant').with_value('admin') }
it { is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_auth_url').with_ensure('absent') }
it { is_expected.to contain_cinder_config('DEFAULT/os_privileged_user_auth_url').with_value('<SERVICE DEFAULT>') }
end
context 'without os_privileged_user' do

View File

@ -33,13 +33,13 @@ describe 'cinder::backup::nfs' do
let :default_params do
{
:backup_driver => 'cinder.backup.drivers.nfs',
:backup_file_size => 1999994880,
:backup_sha_block_size_bytes => 32768,
:backup_enable_progress_timer => true,
:backup_mount_point_base => '$state_path/backup_mount',
:backup_file_size => '<SERVICE DEFAULT>',
:backup_sha_block_size_bytes => '<SERVICE DEFAULT>',
:backup_enable_progress_timer => '<SERVICE DEFAULT>',
:backup_mount_point_base => '<SERVICE DEFAULT>',
:backup_mount_options => '<SERVICE DEFAULT>',
:backup_container => '<SERVICE DEFAULT>',
:backup_compression_algorithm => 'zlib',
:backup_compression_algorithm => '<SERVICE DEFAULT>',
}
end

View File

@ -24,10 +24,10 @@ describe 'cinder::backup' do
let :default_params do
{ :enable => true,
:backup_topic => 'cinder-backup',
:backup_manager => 'cinder.backup.manager.BackupManager',
:backup_api_class => 'cinder.backup.api.API',
:backup_name_template => 'backup-%s' }
:backup_topic => '<SERVICE DEFAULT>',
:backup_manager => '<SERVICE DEFAULT>',
:backup_api_class => '<SERVICE DEFAULT>',
:backup_name_template => '<SERVICE DEFAULT>' }
end
let :params do
@ -78,7 +78,7 @@ describe 'cinder::backup' do
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
@default_facts.merge!({ :osfamily => 'Debian' })
end
let :platform_params do
@ -91,7 +91,7 @@ describe 'cinder::backup' do
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
@default_facts.merge!({ :osfamily => 'RedHat' })
end
let :platform_params do

View File

@ -25,10 +25,10 @@ describe 'cinder::backup::swift' do
let :default_params do
{ :backup_swift_url => 'http://localhost:8080/v1/AUTH_',
:backup_swift_container => 'volumes_backup',
:backup_swift_object_size => '52428800',
:backup_swift_retry_attempts => '3',
:backup_swift_retry_backoff => '2',
:backup_compression_algorithm => 'zlib' }
:backup_swift_object_size => '<SERVICE DEFAULT>',
:backup_swift_retry_attempts => '<SERVICE DEFAULT>',
:backup_swift_retry_backoff => '<SERVICE DEFAULT>',
:backup_compression_algorithm => '<SERVICE DEFAULT>' }
end
let :params do
@ -72,7 +72,7 @@ describe 'cinder::backup::swift' do
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'cinder backup with swift'
@ -80,7 +80,7 @@ describe 'cinder::backup::swift' do
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'cinder backup with swift'

View File

@ -24,9 +24,10 @@ describe 'cinder::glance' do
let :default_params do
{ :glance_api_version => '2',
:glance_num_retries => '0',
:glance_api_insecure => false,
:glance_api_ssl_compression => false }
:glance_num_retries => '<SERVICE DEFAULT>',
:glance_api_insecure => '<SERVICE DEFAULT>',
:glance_api_ssl_compression => '<SERVICE DEFAULT>',
:glance_request_timeout => '<SERVICE DEFAULT>' }
end
let :params do
@ -42,6 +43,8 @@ describe 'cinder::glance' do
is_expected.to contain_cinder_config('DEFAULT/glance_api_version').with_value(p[:glance_api_version])
is_expected.to contain_cinder_config('DEFAULT/glance_num_retries').with_value(p[:glance_num_retries])
is_expected.to contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure])
is_expected.to contain_cinder_config('DEFAULT/glance_api_ssl_compression').with_value(p[:glance_api_ssl_compression])
is_expected.to contain_cinder_config('DEFAULT/glance_request_timeout').with_value(p[:glance_request_timeout])
end
context 'configure cinder with one glance server' do
@ -65,7 +68,7 @@ describe 'cinder::glance' do
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'cinder with glance'
@ -73,7 +76,7 @@ describe 'cinder::glance' do
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'cinder with glance'

View File

@ -1,35 +1,60 @@
require 'spec_helper'
describe 'cinder::quota' do
let :default_params do
{ :quota_volumes => '<SERVICE DEFAULT>',
:quota_snapshots => '<SERVICE DEFAULT>',
:quota_gigabytes => '<SERVICE DEFAULT>',
:quota_driver => '<SERVICE DEFAULT>' }
end
let :params do
{}
end
shared_examples_for 'cinder quota' do
let :p do
default_params.merge(params)
end
describe 'with default parameters' do
it 'contains default values' do
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with(
:value => 10)
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with(
:value => 10)
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with(
:value => 1000)
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with(
:value => 'cinder.quota.DbQuotaDriver')
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with_value(p[:quota_volumes])
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with_value(p[:quota_snapshots])
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with_value(p[:quota_gigabytes])
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with_value(p[:quota_driver])
end
context 'configure quota with parameters' do
before :each do
params.merge!({ :quota_volumes => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000 })
end
it 'contains overrided values' do
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with_value(p[:quota_volumes])
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with_value(p[:quota_snapshots])
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with_value(p[:quota_gigabytes])
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with_value(p[:quota_driver])
end
end
end
describe 'with overridden parameters' do
let :params do
{ :quota_volumes => 1000,
:quota_snapshots => 1000,
:quota_gigabytes => 100000 }
end
it 'contains overrided values' do
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with(
:value => 1000)
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with(
:value => 1000)
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with(
:value => 100000)
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with(
:value => 'cinder.quota.DbQuotaDriver')
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'cinder quota'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'cinder quota'
end
end

View File

@ -2,16 +2,64 @@ require 'spec_helper'
describe 'cinder::scheduler::filter' do
describe 'when overriding params' do
let :default_params do
{ :scheduler_default_filters => '<SERVICE DEFAULT>' }
end
let :params do
{
:scheduler_default_filters => ['AvailabilityZoneFilter', 'CapacityFilter', 'CapabilitiesFilter']
}
let :params do
{}
end
shared_examples_for 'cinder scheduler filter' do
let :p do
default_params.merge(params)
end
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value('AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter') }
it 'contains default values' do
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_ensure('absent')
end
context 'configure filters with array' do
before :each do
params.merge!({
:scheduler_default_filters => ['AvailabilityZoneFilter', 'CapacityFilter', 'CapabilitiesFilter']
})
end
it 'contains overrided values' do
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(p[:scheduler_default_filters].join(','))
end
end
context 'configure filters with string' do
before :each do
params.merge!({
:scheduler_default_filters => 'AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter'
})
end
it 'contains overrided values' do
is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value(p[:scheduler_default_filters])
end
end
end
context 'on Debian platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'Debian' })
end
it_configures 'cinder scheduler filter'
end
context 'on RedHat platforms' do
let :facts do
@default_facts.merge({ :osfamily => 'RedHat' })
end
it_configures 'cinder scheduler filter'
end
end