diff --git a/.fixtures.yml b/.fixtures.yml index 90e6cd1f..fa234d37 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -2,7 +2,7 @@ fixtures: repositories: 'cinder': repo: 'git://github.com/enovance/puppet-cinder' - ref: '164163a7a267ae4139e2d97bab1a385a6da2ac5f' + ref: '3a0f09995625b1c2f6ec446cc2a2571348a7af0b' 'keystone': repo: 'git://github.com/enovance/puppet-keystone.git' ref: '9802add6566646dc1e4a2812d19c2ab4724ff594' diff --git a/Puppetfile b/Puppetfile index 01519a9b..1c82bde4 100644 --- a/Puppetfile +++ b/Puppetfile @@ -22,7 +22,7 @@ mod 'ceilometer', :ref => 'f71f935a3e41dcd11f8f5986a1fe0708b124e589' mod 'cinder', :git => 'git://github.com/enovance/puppet-cinder.git', - :ref => '164163a7a267ae4139e2d97bab1a385a6da2ac5f' + :ref => '3a0f09995625b1c2f6ec446cc2a2571348a7af0b' mod 'glance', :git => 'git://github.com/enovance/puppet-glance.git', :ref => '001f1b6a8ef6bd0fde8fbe0a4b3362f31e6bbcda' diff --git a/README.md b/README.md index 6edf837b..04d4c034 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ Cinder, Glance and Nova can use Ceph as backend storage, using [puppet-ceph](htt Only KVM and QEMU are supported as hypervisors, for now. Neutron use ML2 plugin with GRE and Open-vSwitch drivers. +Cinder has multi-backend support with Ceph used by default and NetApp as an option. [Puppet Modules](http://docs.puppetlabs.com/learning/modules1.html#modules) are a collection of related contents that can be used to model the configuration of a discrete service. diff --git a/manifests/volume/backend/netapp.pp b/manifests/volume/backend/netapp.pp new file mode 100644 index 00000000..3f6870f1 --- /dev/null +++ b/manifests/volume/backend/netapp.pp @@ -0,0 +1,157 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# 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. +# +# Configure NetApp backend for Cinder +# +# +# === Parameters +# +# [*netapp_login*] +# (required) Administrative user account name used to access the storage +# system or proxy server. +# +# [*netapp_password*] +# (required) Password for the administrative user account specified in the +# netapp_login parameter. +# +# [*netapp_server_hostname*] +# (required) The hostname (or IP address) for the storage system or proxy +# server. +# +# [*netapp_server_port*] +# (optional) The TCP port to use for communication with ONTAPI on the +# storage system. Traditionally, port 80 is used for HTTP and port 443 is +# used for HTTPS; however, this value should be changed if an alternate +# port has been configured on the storage system or proxy server. +# Defaults to 80 +# +# [*netapp_size_multiplier*] +# (optional) The quantity to be multiplied by the requested volume size to +# ensure enough space is available on the virtual storage server (Vserver) to +# fulfill the volume creation request. +# Defaults to 1.2 +# +# [*netapp_storage_family*] +# (optional) The storage family type used on the storage system; valid values +# are ontap_7mode for using Data ONTAP operating in 7-Mode or ontap_cluster +# for using clustered Data ONTAP, or eseries for NetApp E-Series. +# Defaults to ontap_cluster +# +# [*netapp_storage_protocol*] +# (optional) The storage protocol to be used on the data path with the storage +# system; valid values are iscsi or nfs. +# Defaults to nfs +# +# [*netapp_transport_type*] +# (optional) The transport protocol used when communicating with ONTAPI on the +# storage system or proxy server. Valid values are http or https. +# Defaults to http +# +# [*netapp_vfiler*] +# (optional) The vFiler unit on which provisioning of block storage volumes +# will be done. This parameter is only used by the driver when connecting to +# an instance with a storage family of Data ONTAP operating in 7-Mode and the +# storage protocol selected is iSCSI. Only use this parameter when utilizing +# the MultiStore feature on the NetApp storage system. +# Defaults to '' +# +# [*netapp_volume_list*] +# (optional) This parameter is only utilized when the storage protocol is +# configured to use iSCSI. This parameter is used to restrict provisioning to +# the specified controller volumes. Specify the value of this parameter to be +# a comma separated list of NetApp controller volume names to be used for +# provisioning. +# Defaults to '' +# +# [*netapp_vserver*] +# (optional) This parameter specifies the virtual storage server (Vserver) +# name on the storage cluster on which provisioning of block storage volumes +# should occur. If using the NFS storage protocol, this parameter is mandatory +# for storage service catalog support (utilized by Cinder volume type +# extra_specs support). If this parameter is specified, the exports belonging +# to the Vserver will only be used for provisioning in the future. Block +# storage volumes on exports not belonging to the Vserver specified by +# this parameter will continue to function normally. +# Defaults to '' +# +# [*expiry_thres_minutes*] +# (optional) This parameter specifies the threshold for last access time for +# images in the NFS image cache. When a cache cleaning cycle begins, images +# in the cache that have not been accessed in the last M minutes, where M is +# the value of this parameter, will be deleted from the cache to create free +# space on the NFS share. +# Defaults to 720 +# +# [*thres_avl_size_perc_start*] +# (optional) If the percentage of available space for an NFS share has +# dropped below the value specified by this parameter, the NFS image cache +# will be cleaned. +# Defaults to 20 +# +# [*thres_avl_size_perc_stop*] +# (optional) When the percentage of available space on an NFS share has +# reached the percentage specified by this parameter, the driver will stop +# clearing files from the NFS image cache that have not been accessed in the +# last M minutes, where M is the value of the expiry_thres_minutes parameter. +# Defaults to 60 +# +# [*nfs_shares_config*] +# (optional) File with the list of available NFS shares +# Defaults to '' +# + +define cloud::volume::backend::netapp ( + $netapp_login, + $netapp_password, + $netapp_server_hostname, + $volume_backend_name = $name, + $netapp_server_port = '80', + $netapp_size_multiplier = '1.2', + $netapp_storage_family = 'ontap_cluster', + $netapp_storage_protocol = 'nfs', + $netapp_transport_type = 'http', + $netapp_vfiler = '', + $netapp_volume_list = '', + $netapp_vserver = '', + $expiry_thres_minutes = '720', + $thres_avl_size_perc_start = '20', + $thres_avl_size_perc_stop = '60', + $nfs_shares_config = '', +) { + + + cinder::backend::netapp { $name: + netapp_server_hostname => $netapp_server_hostname, + netapp_login => $netapp_login, + netapp_password => $netapp_password, + netapp_server_port => $netapp_server_port, + netapp_size_multiplier => $netapp_size_multiplier, + netapp_storage_family => $netapp_storage_family, + netapp_storage_protocol => $netapp_storage_protocol, + netapp_transport_type => $netapp_transport_type, + netapp_vfiler => $netapp_vfiler, + netapp_volume_list => $netapp_volume_list, + netapp_vserver => $netapp_vserver, + expiry_thres_minutes => $expiry_thres_minutes, + thres_avl_size_perc_start => $thres_avl_size_perc_start, + thres_avl_size_perc_stop => $thres_avl_size_perc_stop, + nfs_shares_config => $nfs_shares_config, + } + + @cinder::type { $volume_backend_name: + set_key => 'volume_backend_name', + set_value => $volume_backend_name + } +} diff --git a/manifests/volume/backend/rbd.pp b/manifests/volume/backend/rbd.pp new file mode 100644 index 00000000..369c2571 --- /dev/null +++ b/manifests/volume/backend/rbd.pp @@ -0,0 +1,88 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# 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. +# +# Configure RBD backend for Cinder +# +# +# === Parameters +# +# [*rbd_pool*] +# (required) Specifies the pool name for the block device driver. +# +# [*rbd_user*] +# (required) A required parameter to configure OS init scripts and cephx. +# +# [*volume_backend_name*] +# Allows for the volume_backend_name to be separate of $name. +# +# [*rbd_ceph_conf*] +# (optional) Path to the ceph configuration file to use +# Defaults to '/etc/ceph/ceph.conf' +# +# [*rbd_flatten_volume_from_snapshot*] +# (optional) Enable flatten volumes created from snapshots. +# Defaults to false +# +# [*rbd_secret_uuid*] +# (optional) A required parameter to use cephx. +# Defaults to false +# +# [*volume_tmp_dir*] +# (optional) Location to store temporary image files if the volume +# driver does not write them directly to the volume +# Defaults to false +# +# [*rbd_max_clone_depth*] +# (optional) Maximum number of nested clones that can be taken of a +# volume before enforcing a flatten prior to next clone. +# A value of zero disables cloning +# Defaults to '5' +# + +define cloud::volume::backend::rbd ( + $rbd_pool, + $rbd_user, + $volume_backend_name = $name, + $rbd_ceph_conf = '/etc/ceph/ceph.conf', + $rbd_flatten_volume_from_snapshot = false, + $rbd_secret_uuid = false, + $volume_tmp_dir = false, + $rbd_max_clone_depth = '5', +) { + + cinder::backend::rbd { $volume_backend_name: + rbd_pool => $rbd_pool, + rbd_user => $rbd_user, + rbd_secret_uuid => $rbd_secret_uuid, + rbd_ceph_conf => $rbd_ceph_conf, + rbd_flatten_volume_from_snapshot => $rbd_flatten_volume_from_snapshot, + rbd_max_clone_depth => $rbd_max_clone_depth, + } + + # Configure Ceph keyring + Ceph::Key <<| title == $rbd_user |>> + ensure_resource('file', "/etc/ceph/ceph.client.${rbd_user}.keyring", { + owner => 'cinder', + group => 'cinder', + mode => '0400', + require => "Ceph::Key[${rbd_user}]", + }) + Concat::Fragment <<| title == 'ceph-client-os' |>> + + @cinder::type { $volume_backend_name: + set_key => 'volume_backend_name', + set_value => $volume_backend_name + } +} diff --git a/manifests/volume/controller.pp b/manifests/volume/controller.pp index 5c2a0941..85e7e120 100644 --- a/manifests/volume/controller.pp +++ b/manifests/volume/controller.pp @@ -23,6 +23,8 @@ class cloud::volume::controller( $ks_glance_internal_host = $os_params::ks_glance_internal_host, $ks_glance_api_internal_port = $os_params::ks_glance_api_internal_port, $api_eth = $os_params::api_eth, + # Maintain backward compatibility for multi-backend + $volume_multi_backend = false, # TODO(EmilienM) Disabled for now: http://git.io/kfTmcA # $backup_ceph_pool = $os_params::cinder_rbd_backup_pool, # $backup_ceph_user = $os_params::cinder_rbd_backup_user @@ -30,7 +32,15 @@ class cloud::volume::controller( include 'cloud::volume' - class { 'cinder::scheduler': } + if ! $volume_multi_backend { + $scheduler_driver_real = false + } else { + $scheduler_driver_real = 'cinder.scheduler.filter_scheduler.FilterScheduler' + } + + class { 'cinder::scheduler': + scheduler_driver => $scheduler_driver_real + } class { 'cinder::api': keystone_password => $ks_cinder_password, diff --git a/manifests/volume/storage.pp b/manifests/volume/storage.pp index 24759759..fd2431a7 100644 --- a/manifests/volume/storage.pp +++ b/manifests/volume/storage.pp @@ -17,69 +17,98 @@ # # === Parameters # -# [*cinder_rbd_pool*] -# (optional) Specifies the pool name for the block device driver. +# [*ks_keystone_internal_proto*] +# (optional) Protocol used to connect to API. Could be 'http' or 'https'. +# Defaults to 'http' # -# [*glance_api_version*] -# (optional) Required for Ceph functionality. +# [*ks_keystone_internal_host*] +# (optional) Internal Hostname or IP to connect to Keystone API +# Defaults to '127.0.0.1' # -# [*cinder_rbd_user*] -# (optional) A required parameter to configure OS init scripts and cephx. +# [*ks_keystone_internal_port*] +# (optional) TCP port to connect to Keystone API from admin network +# Default to '5000' # -# [*cinder_rbd_secret_uuid*] -# (optional) A required parameter to use cephx. -# -# [*cinder_rbd_conf*] -# (optional) Path to the ceph configuration file to use -# Defaults to '/etc/ceph/ceph.conf' -# -# [*cinder_rbd_flatten_volume_from_snapshot*] -# (optional) Enalbe flatten volumes created from snapshots. -# Defaults to false -# -# [*cinder_volume_tmp_dir*] -# (optional) Location to store temporary image files if the volume -# driver does not write them directly to the volume -# Defaults to false -# -# [*cinder_rbd_max_clone_depth*] -# (optional) Maximum number of nested clones that can be taken of a -# volume before enforcing a flatten prior to next clone. -# A value of zero disables cloning -# Defaults to '5' +# [*ks_cinder_password*] +# (optional) Password used by Cinder to connect to Keystone API +# Defaults to 'secrete' # +# [*cinder_backends*] +# (optionnal) Hash of the Cinder backends to enable +# Example: +# cinder_backends = { +# 'rbd' => { +# 'lowcost' => { 'rbd_pool' => 'slow', 'rbd_user' => 'cinder', 'rbd_secret_uuid' => '123' }, +# 'standard' => { 'rbd_pool' => 'normal', 'rbd_user' => 'cinder', 'rbd_secret_uuid' => '123' } +# }, +# 'netapp' => { +# 'premium' => { 'netapp_server_hostname' => 'netapp.host', 'netapp_login' => 'joe', 'netapp_password' => 'secret' } +# } +# } +# Defaults to undef to maintain backward compatibility. # + + class cloud::volume::storage( - $glance_api_version = $os_params::glance_api_version, + $cinder_backends = undef, + $ks_keystone_internal_proto = 'http', + $ks_keystone_internal_port = '5000', + $ks_keystone_internal_host = '127.0.0.1', + $ks_cinder_password = 'secrete', + # Deprecated parameters + $glance_api_version = '2', $cinder_rbd_pool = $os_params::cinder_rbd_pool, $cinder_rbd_user = $os_params::cinder_rbd_user, $cinder_rbd_secret_uuid = $os_params::ceph_fsid, $cinder_rbd_conf = '/etc/ceph/ceph.conf', $cinder_rbd_flatten_volume_from_snapshot = false, - $cinder_rbd_max_clone_depth = '5', + $cinder_rbd_max_clone_depth = '5' ) { include 'cloud::volume' include 'cinder::volume' - class { 'cinder::volume::rbd': - rbd_pool => $cinder_rbd_pool, - glance_api_version => $glance_api_version, - rbd_user => $cinder_rbd_user, - rbd_secret_uuid => $cinder_rbd_secret_uuid, - rbd_ceph_conf => $cinder_rbd_conf, - rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot, - rbd_max_clone_depth => $cinder_rbd_max_clone_depth, + if $cinder_backends { + $rbd_backends = has_key($cinder_backends, 'rbd') ? { + false => merge({}, {}), + default => $cinder_backends['rbd'] + } + + if has_key($cinder_backends, 'netapp') { + $netapp_backends = $cinder_backends['netapp'] + create_resources('cloud::volume::backend::netapp', $netapp_backends) + } + else { + $netapp_backends = { } + } + + class { 'cinder::backends': + enabled_backends => keys(merge($rbd_backends, $netapp_backends)) + } + + # Manage Volume types. + # It allows to the end-user to choose from which backend he would like to provision a volume. + # Cinder::Type requires keystone credentials + Cinder::Type <| |> { + os_tenant_name => 'services', + os_username => 'cinder', + os_password => $ks_cinder_password, + os_auth_url => "${ks_keystone_internal_proto}://${ks_keystone_internal_host}:${ks_keystone_internal_port}/v2.0" + } + } + # For backward compatibility when not using multi-backend + else { + $rbd_backends = { 'DEFAULT' => { } } } - Ceph::Key <<| title == $cinder_rbd_user |>> - file { "/etc/ceph/ceph.client.${cinder_rbd_user}.keyring": - owner => 'cinder', - group => 'cinder', - mode => '0400', - require => Ceph::Key[$cinder_rbd_user] + if ! empty($rbd_backends) { + create_resources('cloud::volume::backend::rbd', $rbd_backends, + { rbd_pool => $cinder_rbd_pool, + rbd_user => $cinder_rbd_user, + rbd_secret_uuid => $cinder_rbd_secret_uuid, + rbd_ceph_conf => $cinder_rbd_conf, + rbd_flatten_volume_from_snapshot => $cinder_rbd_flatten_volume_from_snapshot, + rbd_max_clone_depth => $cinder_rbd_max_clone_depth }) } - Concat::Fragment <<| title == 'ceph-client-os' |>> - } diff --git a/spec/classes/cloud_volume_controller_spec.rb b/spec/classes/cloud_volume_controller_spec.rb index bb68b427..475a1fd6 100644 --- a/spec/classes/cloud_volume_controller_spec.rb +++ b/spec/classes/cloud_volume_controller_spec.rb @@ -43,6 +43,7 @@ describe 'cloud::volume::controller' do :ks_keystone_internal_host => '10.0.0.1', :ks_glance_internal_host => '10.0.0.1', :ks_glance_api_internal_port => '9292', + :volume_multi_backend => false, # TODO(EmilienM) Disabled for now: http://git.io/kfTmcA #:backup_ceph_user => 'cinder', #:backup_ceph_pool => 'ceph_backup_cinder', @@ -71,8 +72,21 @@ describe 'cloud::volume::controller' do ) end - it 'configure cinder scheduler' do - should contain_class('cinder::scheduler') + it 'configure cinder scheduler without multi-backend' do + should contain_class('cinder::scheduler').with( + :scheduler_driver => false + ) + end + + context 'with multi-backend' do + before :each do + params.merge!( :volume_multi_backend => true ) + end + it 'configure cinder scheduler with multi-backend' do + should contain_class('cinder::scheduler').with( + :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler' + ) + end end # TODO(Emilien) Disabled for now: http://git.io/uM5sgg diff --git a/spec/classes/cloud_volume_storage_spec.rb b/spec/classes/cloud_volume_storage_spec.rb index f7f41e48..6e515893 100644 --- a/spec/classes/cloud_volume_storage_spec.rb +++ b/spec/classes/cloud_volume_storage_spec.rb @@ -26,11 +26,11 @@ describe 'cloud::volume::storage' do "class { 'cloud::volume': cinder_db_host => '10.0.0.1', cinder_db_user => 'cinder', - cinder_db_password => 'secrete', + cinder_db_password => 'secret', rabbit_hosts => ['10.0.0.1'], - rabbit_password => 'secrete', + rabbit_password => 'secret', ks_keystone_internal_host => '10.0.0.1', - ks_cinder_password => 'secrete', + ks_cinder_password => 'secret', verbose => true, debug => true, log_facility => 'LOG_LOCAL0', @@ -38,10 +38,30 @@ describe 'cloud::volume::storage' do end let :params do - { :cinder_rbd_pool => 'ceph_cinder', - :cinder_rbd_user => 'cinder', - :cinder_rbd_secret_uuid => 'secrete', - :glance_api_version => '2' } + { :cinder_rbd_pool => 'ceph_cinder', + :cinder_rbd_user => 'cinder', + :cinder_rbd_secret_uuid => 'secret', + :cinder_rbd_max_clone_depth => '10', + :cinder_backends => { + 'rbd' => { + 'lowcost' => { + 'rbd_pool' => 'ceph_cinder', + 'rbd_user' => 'cinder', + 'rbd_secret_uuid' => 'secret', + } + }, + 'netapp' => { + 'premium' => { + 'netapp_server_hostname' => 'netapp-server.host', + 'netapp_login' => 'joe', + 'netapp_password' => 'secret' + } + } + }, + :ks_keystone_internal_proto => 'http', + :ks_keystone_internal_port => '5000', + :ks_keystone_internal_host => 'keystone.host', + :ks_cinder_password => 'secret' } end it 'configure cinder common' do @@ -50,7 +70,7 @@ describe 'cloud::volume::storage' do :debug => true, :rabbit_userid => 'cinder', :rabbit_hosts => ['10.0.0.1'], - :rabbit_password => 'secrete', + :rabbit_password => 'secret', :rabbit_virtual_host => '/', :log_facility => 'LOG_LOCAL0', :use_syslog => true, @@ -64,25 +84,119 @@ describe 'cloud::volume::storage' do it 'checks if Cinder DB is populated' do should contain_exec('cinder_db_sync').with( :command => '/usr/bin/cinder-manage db sync', - :unless => '/usr/bin/mysql cinder -h 10.0.0.1 -u cinder -psecrete -e "show tables" | /bin/grep Tables' + :unless => '/usr/bin/mysql cinder -h 10.0.0.1 -u cinder -psecret -e "show tables" | /bin/grep Tables' ) end - it 'configure cinder volume with rbd backend' do - + it 'configure cinder volume service' do should contain_class('cinder::volume') - - should contain_class('cinder::volume::rbd').with( - :rbd_pool => 'ceph_cinder', - :glance_api_version => '2', - :rbd_user => 'cinder', - :rbd_secret_uuid => 'secrete', - :rbd_ceph_conf => '/etc/ceph/ceph.conf', - :rbd_flatten_volume_from_snapshot => false, - :rbd_max_clone_depth => '5' - ) end + context 'with RBD backend' do + it 'configures rbd volume driver' do + should contain_cinder_config('lowcost/volume_backend_name').with_value('lowcost') + should contain_cinder_config('lowcost/rbd_pool').with_value('ceph_cinder') + should contain_cinder_config('lowcost/rbd_user').with_value('cinder') + should contain_cinder_config('lowcost/rbd_secret_uuid').with_value('secret') + should contain_cinder__type('lowcost').with( + :set_key => 'volume_backend_name', + :set_value => 'lowcost', + :os_tenant_name => 'services', + :os_username => 'cinder', + :os_password => 'secret', + :os_auth_url => 'http://keystone.host:5000/v2.0' + ) + end + end + + context 'with NetApp backend' do + it 'configures netapp volume driver' do + should contain_cinder_config('premium/volume_backend_name').with_value('premium') + should contain_cinder_config('premium/netapp_login').with_value('joe') + should contain_cinder_config('premium/netapp_password').with_value('secret') + should contain_cinder_config('premium/netapp_server_hostname').with_value('netapp-server.host') + should contain_cinder__type('premium').with( + :set_key => 'volume_backend_name', + :set_value => 'premium' + ) + end + end + +# This context can't work now, because of https://bugs.launchpad.net/puppet-cinder/+bug/1294138 +# context 'with two RBD backends' do +# before :each do +# params.merge!( +# :cinder_backends => { +# 'rbd' => { +# 'lowcost' => { +# 'rbd_pool' => 'low', +# 'rbd_user' => 'cinder', +# 'rbd_secret_uuid' => 'secret', +# }, +# 'normal' => { +# 'rbd_pool' => 'normal', +# 'rbd_user' => 'cinder', +# 'rbd_secret_uuid' => 'secret', +# } +# } +# } +# ) +# end +# +# +# it 'configures two rbd volume backends' do +# should contain_cinder_config('lowcost/volume_backend_name').with_value('lowcost') +# should contain_cinder_config('lowcost/rbd_pool').with_value('low') +# should contain_cinder_config('lowcost/rbd_user').with_value('cinder') +# should contain_cinder_config('lowcost/rbd_secret_uuid').with_value('secret') +# should contain_cinder__type('lowcost').with( +# :set_key => 'volume_backend_name', +# :set_value => 'lowcost', +# :os_tenant_name => 'services', +# :os_username => 'cinder', +# :os_password => 'secret', +# :os_auth_url => 'http://keystone.host:5000/v2.0' +# ) +# should contain_cinder_config('normal/volume_backend_name').with_value('normal') +# should contain_cinder_config('normal/rbd_pool').with_value('normal') +# should contain_cinder_config('normal/rbd_user').with_value('cinder') +# should contain_cinder_config('normal/rbd_secret_uuid').with_value('secret') +# should contain_cinder__type('normal').with( +# :set_key => 'volume_backend_name', +# :set_value => 'normal', +# :os_tenant_name => 'services', +# :os_username => 'cinder', +# :os_password => 'secret', +# :os_auth_url => 'http://keystone.host:5000/v2.0' +# ) +# end +# end + + context 'with all backends enabled' do + it 'configure all cinder backends' do + should contain_class('cinder::backends').with( + :enabled_backends => ['lowcost', 'premium'] + ) + end + end + + context 'with backward compatiblity (without multi-backend)' do + before :each do + params.merge!( + :cinder_backends => false, + ) + end + it 'configure rbd volume driver without multi-backend' do + should contain_cinder__backend__rbd('DEFAULT').with( + :rbd_pool => 'ceph_cinder', + :rbd_user => 'cinder', + :rbd_secret_uuid => 'secret', + :rbd_ceph_conf => '/etc/ceph/ceph.conf', + :rbd_flatten_volume_from_snapshot => false, + :rbd_max_clone_depth => '10' + ) + end + end end context 'on Debian platforms' do