Sync cinder with upstream

commit 3e80d4a9f9fbedb03ac21537ba85d66b09531c8b
source https://github.com/stackforge/puppet-cinder

Partially Implements: blueprint upgrade-openstack-puppet-modules
Fuel-CI: disable

Change-Id: I3f88d35f5cf775e330d52efca617d3302aa7d049
This commit is contained in:
Maksym Yatsenko 2015-06-23 11:17:43 +03:00
parent fa5366b7a1
commit d0f0bb496a
125 changed files with 4748 additions and 1315 deletions

View File

@ -1,14 +1,14 @@
fixtures:
repositories:
'apt': 'git://github.com/puppetlabs/puppetlabs-apt.git'
'concat':
'repo': 'git://github.com/puppetlabs/puppetlabs-concat.git'
'ref': '1.2.1'
'inifile': 'git://github.com/puppetlabs/puppetlabs-inifile'
'keystone': 'git://github.com/stackforge/puppet-keystone.git'
'mysql':
repo: 'git://github.com/puppetlabs/puppetlabs-mysql.git'
ref: 'origin/0.x'
'postgresql':
repo: 'git://github.com/puppetlabs/puppet-postgresql.git'
ref: '2.5.0'
'mysql': 'git://github.com/puppetlabs/puppetlabs-mysql.git'
'openstacklib': 'git://github.com/stackforge/puppet-openstacklib.git'
'postgresql': 'git://github.com/puppetlabs/puppet-postgresql.git'
'qpid': 'git://github.com/dprince/puppet-qpid.git'
'rabbitmq':
repo: 'git://github.com/puppetlabs/puppetlabs-rabbitmq'

View File

@ -3,3 +3,4 @@ spec/fixtures/modules/*
spec/fixtures/manifests/site.pp
*.swp
pkg
vendor/

View File

@ -1,4 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=stackforge/puppet-cinder.git
project=openstack/puppet-cinder.git

View File

@ -2,8 +2,22 @@ source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'puppet-lint', '~> 0.3.2'
gem 'rake', '10.1.1'
gem 'rspec-puppet', '~> 2.1.0', :require => false
gem 'puppet-lint', '~> 1.1'
gem 'puppet-lint-param-docs', '1.1.0'
gem 'puppet-lint-absolute_classname-check'
gem 'puppet-lint-absolute_template_path'
gem 'puppet-lint-trailing_newline-check'
# Puppet 4.x related lint checks
gem 'puppet-lint-unquoted_string-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable'
gem 'beaker-rspec', :require => false
gem 'json'
gem 'webmock'
end
if puppetversion = ENV['PUPPET_GEM_VERSION']

View File

@ -1,201 +1,13 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright 2012 OpenStack Foundation
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
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
1. Definitions.
http://www.apache.org/licenses/LICENSE-2.0
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
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.
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.

View File

@ -1,15 +0,0 @@
name 'puppetlabs-cinder'
version '4.0.0'
source 'https://github.com/stackforge/puppet-cinder'
author 'Puppet Labs'
license 'Apache License 2.0'
summary 'Puppet Labs Cinder Module'
description 'Puppet module to install and configure the Openstack Cinder block storage service'
project_page 'https://launchpad.net/puppet-cinder'
dependency 'dprince/qpid', '>=1.0.0 <2.0.0'
dependency 'puppetlabs/inifile', '>=1.0.0 <2.0.0'
dependency 'puppetlabs/keystone', '>=4.0.0 <5.0.0'
dependency 'puppetlabs/mysql', '>=0.9.0 <3.0.0'
dependency 'puppetlabs/rabbitmq', '>=2.0.2 <4.0.0'
dependency 'puppetlabs/stdlib', '>=3.2.0'

View File

@ -1,7 +1,7 @@
cinder
=======
4.0.0 - 2014.1.0 - Icehouse
5.1.0 - 2014.2 - Juno
#### Table of Contents
@ -163,7 +163,18 @@ Limitations
* Setup of storage nodes is limited to Linux and LVM, i.e. Puppet won't configure a Nexenta appliance but nova can be configured to use the Nexenta driver with Class['cinder::volume::nexenta'].
* The Cinder Openstack service depends on a sqlalchemy database. If you are using puppetlabs-mysql to achieve this, there is a parameter called mysql_module that can be used to swap between the two supported versions: 0.9 and 2.2. This is needed because the puppetlabs-mysql module was rewritten and the custom type names have changed between versions.
Beaker-Rspec
------------
This module has beaker-rspec tests
To run:
``shell
bundle install
bundle exec rspec spec/acceptance
``
Development
-----------
@ -179,6 +190,58 @@ Contributors
Release Notes
-------------
**5.1.0**
* Service Validation for Cinder-API
* Automates generation of NFS config file
* spec: pin rspec-puppet to 1.0.1
* Switch to using the new SolidFire driver name
* Makes kombu_ssl_* parameters optional when rabbit_use_ssl => true
* Switch to TLSv1
* Create type-key only if it doesn't exist
* use lioadm on Fedora
* Pin puppetlabs-concat to 1.2.1 in fixtures
* Add nfs_mount_options variable when backend is NetApp
* Change default MySQL collate to utf8_general_ci
* Add configuration helpers for Quobyte
* Implement HP 3par iscsi backend module
* Update .gitreview file for project rename
**5.0.0**
* Stable Juno release
* Added class to manage policy.json
* Changed the default value of the san_thin_provision parameter for eqlx
* Added database tuning parameters
* Made keystone user creation optional when creating a service
* Added ability to hide secrets from logs
* Added parameters for netapp and and cinder-api workers
* Corrected the package name for cinder backup
* Added support for the EMC VNX direct driver
* Migrated the mysql backend to use openstacklib::db::mysql
* Added support for availability zones
**4.2.0**
* Added parameters to set cinder volume driver
* Added class for extended logging options
* Added option to specify endpoint protocol
* Fixed cinder type path issues
* Added option to specify cinder volume path
* Fixed targetcli package dependency on target service
* Fixed os version fact comparison for RedHat-based operating systems
for specifying service provider
* Added option to configure os_region_name in the cinder config
**4.1.0**
* Added Cinder v2 endpoint support.
* Added SSL support for Cinder API.
* Added RabbitMQ SSL support.
* Moved default_volume_type to cinder::api
* Removed warnings for existing Cinder volumes.
* Pinned major gems.
**4.0.0**
* Stable Icehouse release.

View File

@ -21,18 +21,18 @@
#
# sudo pcs constraint colocation add cinder_api_service with cinder_vip
class { 'cinder':
class { '::cinder':
database_connection => 'mysql://cinder:secret_block_password@openstack-controller.example.com/cinder',
}
class { 'cinder::api':
class { '::cinder::api':
keystone_password => 'CINDER_PW',
keystone_user => 'cinder',
enabled => false,
manage_service => false,
}
class { 'cinder::scheduler':
class { '::cinder::scheduler':
scheduler_driver => 'cinder.scheduler.simple.SimpleScheduler',
enabled => false,
manage_service => false,

View File

@ -20,16 +20,19 @@
# Defaults to cinder
#
# [*keystone_auth_host*]
# (optional) The keystone host
# (optional) DEPRECATED The keystone host
# Defaults to localhost
# Use auth_uri instead.
#
# [*keystone_auth_port*]
# (optional) The keystone auth port
# (optional) DEPRECATED The keystone auth port
# Defaults to 35357
# Use auth_uri instead.
#
# [*keystone_auth_protocol*]
# (optional) The protocol used to access the auth host
# (optional) DEPRECATED The protocol used to access the auth host
# Defaults to http.
# Use auth_uri instead.
#
# [*os_region_name*]
# (optional) Some operations require cinder to make API requests
@ -38,16 +41,33 @@
# Defaults to undef.
#
# [*keystone_auth_admin_prefix*]
# (optional) The admin_prefix used to admin endpoint of the auth host
# This allow admin auth URIs like http://auth_host:35357/keystone.
# (optional) DEPRECATED The admin_prefix used to admin endpoint of the auth
# host. This allow admin auth URIs like http://auth_host:35357/keystone.
# (where '/keystone' is the admin prefix)
# Defaults to false for empty. If defined, should be a string with a
# leading '/' and no trailing '/'.
# Use auth_uri instead.
#
# [*keystone_auth_uri*]
# (optional) DEPRECATED Renamed to auth_uri
# Defaults to 'false'.
#
# [*auth_uri*]
# (optional) Public Identity API endpoint.
# Defaults to 'false'.
#
# [*identity_uri*]
# (optional) Complete admin Identity API endpoint.
# Defaults to: false
#
# [*service_port*]
# (optional) The cinder api port
# (optional) DEPRECATED The Keystone public api port
# Defaults to 5000
#
# [*service_workers*]
# (optional) Number of cinder-api workers
# Defaults to $::processorcount
#
# [*package_ensure*]
# (optional) The state of the package
# Defaults to present
@ -72,44 +92,87 @@
# (optional) Factory to use for ratelimiting
# Defaults to 'cinder.api.v1.limits:RateLimitingMiddleware.factory'
#
# [*default_volume_type*]
# (optional) default volume type to use.
# This should contain the name of the default volume type to use.
# If not configured, it produces an error when creating a volume
# without specifying a type.
# Defaults to 'false'.
#
# [*validate*]
# (optional) Whether to validate the service is working after any service refreshes
# Defaults to false
#
# [*validation_options*]
# (optional) Service validation options
# Should be a hash of options defined in openstacklib::service_validation
# If empty, defaults values are taken from openstacklib function.
# Default command list volumes.
# Require validate set at True.
# Example:
# glance::api::validation_options:
# glance-api:
# command: check_cinder-api.py
# path: /usr/bin:/bin:/usr/sbin:/sbin
# provider: shell
# tries: 5
# try_sleep: 10
# Defaults to {}
#
# [*sync_db*]
# (Optional) Run db sync on the node.
# Defaults to true
#
class cinder::api (
$keystone_password,
$keystone_enabled = true,
$keystone_tenant = 'services',
$keystone_user = 'cinder',
$keystone_auth_host = 'localhost',
$keystone_auth_port = '35357',
$keystone_auth_protocol = 'http',
$keystone_auth_admin_prefix = false,
$keystone_auth_uri = false,
$auth_uri = false,
$identity_uri = false,
$os_region_name = undef,
$service_port = '5000',
$service_workers = $::processorcount,
$package_ensure = 'present',
$bind_host = '0.0.0.0',
$enabled = true,
$manage_service = true,
$ratelimits = undef,
$default_volume_type = false,
$ratelimits_factory =
'cinder.api.v1.limits:RateLimitingMiddleware.factory'
'cinder.api.v1.limits:RateLimitingMiddleware.factory',
$validate = false,
$sync_db = true,
# DEPRECATED PARAMETERS
$validation_options = {},
$keystone_auth_uri = false,
$keystone_auth_host = 'localhost',
$keystone_auth_port = '35357',
$keystone_auth_protocol = 'http',
$keystone_auth_admin_prefix = false,
$service_port = '5000',
) {
include cinder::params
include ::cinder::params
include ::cinder::policy
Cinder_config<||> ~> Service['cinder-api']
Cinder_api_paste_ini<||> ~> Service['cinder-api']
Class['cinder::policy'] ~> Service['cinder-api']
if $::cinder::params::api_package {
Package['cinder-api'] -> Class['cinder::policy']
Package['cinder-api'] -> Cinder_config<||>
Package['cinder-api'] -> Cinder_api_paste_ini<||>
Package['cinder-api'] ~> Service['cinder-api']
Package['cinder'] ~> Service['cinder-api']
Package['cinder-api'] -> Service['cinder-api']
Package['cinder-api'] ~> Exec<| title == 'cinder-manage db_sync' |>
package { 'cinder-api':
ensure => $package_ensure,
name => $::cinder::params::api_package,
ensure => $package_ensure,
name => $::cinder::params::api_package,
tag => 'openstack',
}
}
if $enabled {
if $sync_db {
Cinder_config<||> ~> Exec['cinder-manage db_sync']
exec { 'cinder-manage db_sync':
@ -118,9 +181,12 @@ class cinder::api (
user => 'cinder',
refreshonly => true,
logoutput => 'on_failure',
require => Package['cinder'],
subscribe => Package['cinder'],
before => Service['cinder-api'],
}
}
if $enabled {
if $manage_service {
$ensure = 'running'
}
@ -131,15 +197,16 @@ class cinder::api (
}
service { 'cinder-api':
ensure => $ensure,
name => $::cinder::params::api_service,
enable => $enabled,
hasstatus => true,
hasrestart => true,
ensure => $ensure,
name => $::cinder::params::api_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
}
cinder_config {
'DEFAULT/osapi_volume_listen': value => $bind_host
'DEFAULT/osapi_volume_listen': value => $bind_host;
'DEFAULT/osapi_volume_workers': value => $service_workers;
}
if $os_region_name {
@ -148,28 +215,121 @@ class cinder::api (
}
}
if $keystone_auth_uri {
cinder_api_paste_ini { 'filter:authtoken/auth_uri': value => $keystone_auth_uri; }
} else {
cinder_api_paste_ini { 'filter:authtoken/auth_uri': value => "${keystone_auth_protocol}://${keystone_auth_host}:${service_port}/"; }
if $keystone_auth_uri and $auth_uri {
fail('both keystone_auth_uri and auth_uri are set and they have the same meaning')
}
elsif !$keystone_auth_uri and !$auth_uri {
warning('use of keystone_auth_protocol, keystone_auth_host, and service_port is deprecated, please set auth_uri directly')
$auth_uri_real = "${keystone_auth_protocol}://${keystone_auth_host}:${service_port}/"
}
elsif $keystone_auth_uri {
warning('keystone_auth_uri has been renamed to auth_uri')
$auth_uri_real = $keystone_auth_uri
}
else {
$auth_uri_real = $auth_uri
}
cinder_api_paste_ini { 'filter:authtoken/auth_uri': value => $auth_uri_real; }
if $keystone_enabled {
cinder_config {
'DEFAULT/auth_strategy': value => 'keystone' ;
}
cinder_api_paste_ini {
'filter:authtoken/service_protocol': value => $keystone_auth_protocol;
'filter:authtoken/service_host': value => $keystone_auth_host;
'filter:authtoken/service_port': value => $service_port;
'filter:authtoken/auth_protocol': value => $keystone_auth_protocol;
'filter:authtoken/auth_host': value => $keystone_auth_host;
'filter:authtoken/auth_port': value => $keystone_auth_port;
'filter:authtoken/admin_tenant_name': value => $keystone_tenant;
'filter:authtoken/admin_user': value => $keystone_user;
'filter:authtoken/admin_password': value => $keystone_password, secret => true;
}
# if both auth_uri and identity_uri are set we skip these deprecated settings entirely
if !$auth_uri or !$identity_uri {
if $keystone_auth_host {
warning('The keystone_auth_host parameter is deprecated. Please use auth_uri and identity_uri instead.')
cinder_api_paste_ini {
'filter:authtoken/service_host': value => $keystone_auth_host;
'filter:authtoken/auth_host': value => $keystone_auth_host;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/service_host': ensure => absent;
'filter:authtoken/auth_host': ensure => absent;
}
}
if $keystone_auth_protocol {
warning('The keystone_auth_protocol parameter is deprecated. Please use auth_uri and identity_uri instead.')
cinder_api_paste_ini {
'filter:authtoken/service_protocol': value => $keystone_auth_protocol;
'filter:authtoken/auth_protocol': value => $keystone_auth_protocol;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/service_protocol': ensure => absent;
'filter:authtoken/auth_protocol': ensure => absent;
}
}
if $keystone_auth_port {
warning('The keystone_auth_port parameter is deprecated. Please use auth_uri and identity_uri instead.')
cinder_api_paste_ini {
'filter:authtoken/auth_port': value => $keystone_auth_port;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/auth_port': ensure => absent;
}
}
if $service_port {
warning('The service_port parameter is deprecated. Please use auth_uri and identity_uri instead.')
cinder_api_paste_ini {
'filter:authtoken/service_port': value => $service_port;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/service_port': ensure => absent;
}
}
if $keystone_auth_admin_prefix {
warning('The keystone_auth_admin_prefix parameter is deprecated. Please use auth_uri and identity_uri instead.')
validate_re($keystone_auth_admin_prefix, '^(/.+[^/])?$')
cinder_api_paste_ini {
'filter:authtoken/auth_admin_prefix': value => $keystone_auth_admin_prefix;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/auth_admin_prefix': ensure => absent;
}
}
}
else {
cinder_api_paste_ini {
'filter:authtoken/auth_admin_prefix': ensure => absent;
}
cinder_api_paste_ini {
'filter:authtoken/service_port': ensure => absent;
'filter:authtoken/auth_port': ensure => absent;
'filter:authtoken/service_host': ensure => absent;
'filter:authtoken/auth_host': ensure => absent;
'filter:authtoken/service_protocol': ensure => absent;
'filter:authtoken/auth_protocol': ensure => absent;
}
}
if $identity_uri {
cinder_api_paste_ini {
'filter:authtoken/identity_uri': value => $identity_uri;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/identity_uri': ensure => absent;
}
}
}
if ($ratelimits != undef) {
cinder_api_paste_ini {
'filter:ratelimit/paste.filter_factory': value => $ratelimits_factory;
@ -177,15 +337,24 @@ class cinder::api (
}
}
if $keystone_auth_admin_prefix {
validate_re($keystone_auth_admin_prefix, '^(/.+[^/])?$')
cinder_api_paste_ini {
'filter:authtoken/auth_admin_prefix': value => $keystone_auth_admin_prefix;
}
} else {
cinder_api_paste_ini {
'filter:authtoken/auth_admin_prefix': ensure => absent;
}
if $default_volume_type {
cinder_config {
'DEFAULT/default_volume_type': value => $default_volume_type;
}
} else {
cinder_config {
'DEFAULT/default_volume_type': ensure => absent;
}
}
if $validate {
$defaults = {
'cinder-api' => {
'command' => "cinder --os-auth-url ${auth_uri_real} --os-tenant-name ${keystone_tenant} --os-username ${keystone_user} --os-password ${keystone_password} list",
}
}
$validation_options_hash = merge ($defaults, $validation_options)
create_resources('openstacklib::service_validation', $validation_options_hash, {'subscribe' => 'Service[cinder-api]'})
}
}

View File

@ -0,0 +1,78 @@
# == define: cinder::backend::dellsc_iscsi
#
# Configure the Dell Storage Center ISCSI Driver for cinder.
#
# === Parameters
#
# [*san_ip*]
# (required) IP address of Enterprise Manager.
#
# [*san_login*]
# (required) Enterprise Manager user name.
#
# [*san_password*]
# (required) Enterprise Manager user password.
#
# [*iscsi_ip_address*]
# (required) The Storage Center iSCSI IP address.
#
# [*dell_sc_ssn*]
# (required) The Storage Center serial number to use.
#
# [*volume_backend_name*]
# (optional) The storage backend name.
# Defaults to the name of the backend
#
# [*dell_sc_api_port*]
# (optional) The Enterprise Manager API port.
# Defaults to 3033
#
# [*dell_sc_server_folder*]
# (optional) Name of the server folder to use on the Storage Center.
# Defaults to 'srv'
#
# [*dell_sc_volume_folder*]
# (optional) Name of the volume folder to use on the Storage Center.
# Defaults to 'vol'
#
# [*iscsi_port*]
# (optional) The ISCSI IP Port of the Storage Center.
# Defaults to 3260
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza.
# Defaults to: {}
# Example:
# { 'dellsc_iscsi_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::dellsc_iscsi (
$san_ip,
$san_login,
$san_password,
$iscsi_ip_address,
$dell_sc_ssn,
$volume_backend_name = $name,
$dell_sc_api_port = 3033,
$dell_sc_server_folder = 'srv',
$dell_sc_volume_folder = 'vol',
$iscsi_port = 3260,
$extra_options = {},
) {
$driver = 'dell.dell_storagecenter_iscsi.DellStorageCenterISCSIDriver'
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => "cinder.volume.drivers.${driver}";
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password, secret => true;
"${name}/iscsi_ip_address": value => $iscsi_ip_address;
"${name}/dell_sc_ssn": value => $dell_sc_ssn;
"${name}/dell_sc_api_port": value => $dell_sc_api_port;
"${name}/dell_sc_server_folder": value => $dell_sc_server_folder;
"${name}/dell_sc_volume_folder": value => $dell_sc_volume_folder;
"${name}/iscsi_port": value => $iscsi_port;
}
create_resources('cinder_config', $extra_options)
}

View File

@ -0,0 +1,74 @@
#
# == Define: cinder::backend::emc_vnx
#
# Setup Cinder to use the EMC VNX driver.
# Compatible for multiple backends
#
# == Parameters
#
# [*volume_backend_name*]
# (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name
#
# [*san_ip*]
# (required) IP address of SAN controller.
#
# [*san_password*]
# (required) Password of SAN controller.
#
# [*san_login*]
# (optional) Login of SAN controller.
# Defaults to : 'admin'
#
# [*storage_vnx_pool_name*]
# (required) Storage pool name.
#
# [*default_timeout*]
# (optional) Default timeout for CLI operations in minutes.
# Defaults to: '10'
#
# [*max_luns_per_storage_group*]
# (optional) Default max number of LUNs in a storage group.
# Defaults to: '256'
#
# [*package_ensure*]
# (optional) The state of the package
# Defaults to: 'present'
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'emc_vnx_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::emc_vnx (
$iscsi_ip_address,
$san_ip,
$san_password,
$storage_vnx_pool_name,
$default_timeout = '10',
$max_luns_per_storage_group = '256',
$package_ensure = 'present',
$san_login = 'admin',
$volume_backend_name = $name,
$extra_options = {},
) {
include ::cinder::params
cinder_config {
"${name}/default_timeout": value => $default_timeout;
"${name}/iscsi_ip_address": value => $iscsi_ip_address;
"${name}/max_luns_per_storage_group": value => $max_luns_per_storage_group;
"${name}/naviseccli_path": value => '/opt/Navisphere/bin/naviseccli';
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password;
"${name}/storage_vnx_pool_name": value => $storage_vnx_pool_name;
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => 'cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver';
}
create_resources('cinder_config', $extra_options)
}

View File

@ -15,7 +15,7 @@
#
# [*san_thin_provision*]
# (optional) Whether or not to use thin provisioning for volumes.
# Defaults to false
# Defaults to true
#
# [*volume_backend_name*]
# (optional) The backend name.
@ -49,11 +49,17 @@
# (optional) The maximum retry count for reconnection.
# Defaults to 5
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'eqlx_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::eqlx (
$san_ip,
$san_login,
$san_password,
$san_thin_provision = false,
$san_thin_provision = true,
$volume_backend_name = $name,
$eqlx_group_name = 'group-0',
$eqlx_pool = 'default',
@ -62,13 +68,14 @@ define cinder::backend::eqlx (
$eqlx_chap_password = '12345',
$eqlx_cli_timeout = 30,
$eqlx_cli_max_retries = 5,
$extra_options = {},
) {
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => 'cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver';
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password;
"${name}/san_password": value => $san_password, secret => true;
"${name}/san_thin_provision": value => $san_thin_provision;
"${name}/eqlx_group_name": value => $eqlx_group_name;
"${name}/eqlx_use_chap": value => $eqlx_use_chap;
@ -80,7 +87,10 @@ define cinder::backend::eqlx (
if(str2bool($eqlx_use_chap)) {
cinder_config {
"${name}/eqlx_chap_login": value => $eqlx_chap_login;
"${name}/eqlx_chap_password": value => $eqlx_chap_password;
"${name}/eqlx_chap_password": value => $eqlx_chap_password, secret => true;
}
}
create_resources('cinder_config', $extra_options)
}

View File

@ -28,6 +28,12 @@
# (optional) The config file to store the given $glusterfs_shares.
# Defaults to '/etc/cinder/shares.conf'
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'glusterfs_backend/param1' => { 'value' => value1 } }
#
# === Examples
#
# cinder::backend::glusterfs { 'myGluster':
@ -40,7 +46,8 @@ define cinder::backend::glusterfs (
$glusterfs_disk_util = false,
$glusterfs_sparsed_volumes = undef,
$glusterfs_mount_point_base = undef,
$glusterfs_shares_config = '/etc/cinder/shares.conf'
$glusterfs_shares_config = '/etc/cinder/shares.conf',
$extra_options = {},
) {
if $glusterfs_disk_util {
@ -63,4 +70,7 @@ define cinder::backend::glusterfs (
"${name}/glusterfs_sparsed_volumes": value => $glusterfs_sparsed_volumes;
"${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base;
}
create_resources('cinder_config', $extra_options)
}

View File

@ -0,0 +1,100 @@
# == Define: cinder::backend::hp3par_iscsi
#
# Configures Cinder volume HP 3par ISCSI driver.
# Parameters are particular to each volume driver.
#
# === Parameters
#
# [*hp3par_api_url*]
# (required) url for api access to 3par - example https://10.x.x.x:8080/api/v1
#
# [*hp3par_username*]
# (required) Username for HP3par admin user
#
# [*hp3par_password*]
# (required) Password for hp3par_username
#
# [*san_ip*]
# (required) IP address of HP 3par service processor.
#
# [*san_login*]
# (required) Username for HP 3par account.
#
# [*san_password*]
# (required) Password for HP 3par account.
#
# [*hp3par_iscsi_ips*]
# (required) iscsi IP addresses for the HP 3par array
# This is a list of IPs with ports in a string, for example:
# '1.2.3.4:3261, 5.6.7.8:3261'
#
# [*volume_backend_name*]
# (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name
#
# [*volume_driver*]
# (optional) Setup cinder-volume to use HP 3par volume driver.
# Defaults to 'cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver'
#
# [*hp3par_iscsi_chap_enabled
# (required) setting to false by default
#
# [*hp3par_snap_cpg*]
# (optional) set to hp3par_cfg by default in the cinder driver
#
# [*hp3par_snapshot_retention*]
# (required) Time in hours for snapshot retention. Must be less
# than hp3par_snapshot_expiration.
# Defaults to 48.
#
# [*hp3par_snapshot_expiration*]
# (required) Time in hours until a snapshot expires. Must be more
# than hp3par_snapshot_retention.
# Defaults to 72.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'h3par_iscsi_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::hp3par_iscsi(
$hp3par_api_url,
$hp3par_username,
$hp3par_password,
$san_ip,
$san_login,
$san_password,
$hp3par_iscsi_ips,
$volume_backend_name = $name,
$volume_driver = 'cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver',
$hp3par_iscsi_chap_enabled = false,
$hp3par_snap_cpg = 'OpenstackCPG',
$hp3par_snapshot_retention = 48,
$hp3par_snapshot_expiration = 72,
$extra_options = {},
) {
if ($hp3par_snapshot_expiration <= $hp3par_snapshot_retention) {
fail ('hp3par_snapshot_expiration must be greater than hp3par_snapshot_retention')
}
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => $volume_driver;
"${name}/hp3par_username": value => $hp3par_username;
"${name}/hp3par_password": value => $hp3par_password, secret => true;
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password, secret => true;
"${name}/hp3par_iscsi_ips": value => $hp3par_iscsi_ips;
"${name}/hp3par_api_url": value => $hp3par_api_url;
"${name}/hp3par_iscsi_chap_enabled": value => $hp3par_iscsi_chap_enabled;
"${name}/hp3par_snap_cpg": value => $hp3par_snap_cpg;
"${name}/hp3par_snapshot_retention": value => $hp3par_snapshot_retention;
"${name}/hp3par_snapshot_expiration": value => $hp3par_snapshot_expiration;
}
create_resources('cinder_config', $extra_options)
}

View File

@ -6,23 +6,45 @@
# (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name
#
# [*volume_driver*]
# (Optional) Driver to use for volume creation
# Defaults to 'cinder.volume.drivers.lvm.LVMVolumeDriver'.
#
# [*volumes_dir*]
# (Optional) Volume configuration file storage directory
# Defaults to '/var/lib/cinder/volumes'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'iscsi_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::iscsi (
$iscsi_ip_address,
$volume_backend_name = $name,
$volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver',
$volume_group = 'cinder-volumes',
$volumes_dir = '/var/lib/cinder/volumes',
$iscsi_helper = $::cinder::params::iscsi_helper,
$iscsi_protocol = 'iscsi',
$extra_options = {},
) {
include cinder::params
include ::cinder::params
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => $volume_driver;
"${name}/iscsi_ip_address": value => $iscsi_ip_address;
"${name}/iscsi_helper": value => $iscsi_helper;
"${name}/volume_group": value => $volume_group;
"${name}/volumes_dir": value => $volumes_dir;
"${name}/iscsi_protocol": value => $iscsi_protocol;
}
create_resources('cinder_config', $extra_options)
case $iscsi_helper {
'tgtadm': {
package { 'tgt':
@ -33,7 +55,7 @@ define cinder::backend::iscsi (
if($::osfamily == 'RedHat') {
file_line { 'cinder include':
path => '/etc/tgt/targets.conf',
line => 'include /etc/cinder/volumes/*',
line => "include ${volumes_dir}/*",
match => '#?include /',
require => Package['tgt'],
notify => Service['tgtd'],
@ -49,6 +71,12 @@ define cinder::backend::iscsi (
}
'lioadm': {
service { 'target':
ensure => running,
enable => true,
require => Package['targetcli'],
}
package { 'targetcli':
ensure => present,
name => $::cinder::params::lio_package_name,

View File

@ -11,17 +11,17 @@
#
# [*netapp_password*]
# (required) Password for the administrative user account specified in the
# netapp_login parameter.
# netapp_login option.
#
# [*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.
# (optional) The TCP port to use for communication with the storage
# system or proxy. If not specified, Data ONTAP drivers will use 80
# for HTTP and 443 for HTTPS; E-Series will use 8080 for HTTP and
# 8443 for HTTPS.
# Defaults to 80
#
# [*netapp_size_multiplier*]
@ -32,46 +32,48 @@
#
# [*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
# are ontap_7mode for using Data ONTAP operating in 7-Mode, 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.
# system. Valid values are iscsi, fc, 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.
# (optional) The transport protocol used when communicating with 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 ''
# an instance with a storage family of Data ONTAP operating in 7-Mode. Only
# use this parameter when utilizing the MultiStore feature on the NetApp
# storage system.
# Defaults to undef
#
# [*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 ''
# configured to use iSCSI or FC. 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 undef
#
# [*netapp_vserver*]
# (optional) This parameter specifies the virtual storage server (Vserver)
# (optional) This option 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 ''
# should occur.
# Defaults to undef
#
# [*netapp_partner_backend_name*]
# (optional) The name of the config.conf stanza for a Data ONTAP (7-mode)
# HA partner. This option is only used by the driver when connecting to an
# instance with a storage family of Data ONTAP operating in 7-Mode, and it is
# required if the storage protocol selected is FC.
# Defaults to undef
#
# [*expiry_thres_minutes*]
# (optional) This parameter specifies the threshold for last access time for
@ -94,15 +96,25 @@
# last M minutes, where M is the value of the expiry_thres_minutes parameter.
# Defaults to 60
#
# [*nfs_shares*]
# (optional) Array of NFS exports in the form of host:/share; will be written into
# file specified in nfs_shares_config
# Defaults to undef
#
# [*nfs_shares_config*]
# (optional) File with the list of available NFS shares
# Defaults to ''
# Defaults to '/etc/cinder/shares.conf'
#
# [*nfs_mount_options*]
# (optional) Mount options passed to the nfs client. See section
# of the nfs man page for details.
# Defaults to undef
#
# [*netapp_copyoffload_tool_path*]
# (optional) This option specifies the path of the NetApp Copy Offload tool
# binary. Ensure that the binary has execute permissions set which allow the
# effective user of the cinder-volume process to execute the file.
# Defaults to ''
# Defaults to undef
#
# [*netapp_controller_ips*]
# (optional) This option is only utilized when the storage family is
@ -110,18 +122,24 @@
# specified controllers. Specify the value of this option to be a comma
# separated list of controller hostnames or IP addresses to be used for
# provisioning.
# Defaults to ''
# Defaults to undef
#
# [*netapp_sa_password*]
# (optional) Password for the NetApp E-Series storage array.
# Defaults to ''
# Defaults to undef
#
# [*netapp_storage_pools*]
# (optional) This option is used to restrict provisioning to the specified
# storage pools. Only dynamic disk pools are currently supported. Specify the
# value of this option to be a comma separated list of disk pool names to be
# used for provisioning.
# Defaults to ''
# Defaults to undef
#
# [*netapp_eseries_host_type*]
# (optional) This option is used to define how the controllers in the
# E-Series storage array will work with the particular operating system on
# the hosts that are connected to it.
# Defaults to 'linux_dm_mp'
#
# [*netapp_webservice_path*]
# (optional) This option is used to specify the path to the E-Series proxy
@ -131,6 +149,12 @@
# application.
# Defaults to '/devmgr/v2'
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'netapp_backend/param1' => { 'value' => value1 } }
#
# === Examples
#
# cinder::backend::netapp { 'myBackend':
@ -160,42 +184,77 @@ define cinder::backend::netapp (
$netapp_storage_family = 'ontap_cluster',
$netapp_storage_protocol = 'nfs',
$netapp_transport_type = 'http',
$netapp_vfiler = '',
$netapp_volume_list = '',
$netapp_vserver = '',
$netapp_vfiler = undef,
$netapp_volume_list = undef,
$netapp_vserver = undef,
$netapp_partner_backend_name = undef,
$expiry_thres_minutes = '720',
$thres_avl_size_perc_start = '20',
$thres_avl_size_perc_stop = '60',
$nfs_shares_config = '',
$netapp_copyoffload_tool_path = '',
$netapp_controller_ips = '',
$netapp_sa_password = '',
$netapp_storage_pools = '',
$nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_mount_options = undef,
$netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef,
$netapp_sa_password = undef,
$netapp_storage_pools = undef,
$netapp_eseries_host_type = 'linux_dm_mp',
$netapp_webservice_path = '/devmgr/v2',
$extra_options = {},
) {
cinder_config {
"${volume_backend_name}/volume_backend_name": value => $volume_backend_name;
"${volume_backend_name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';
"${volume_backend_name}/netapp_login": value => $netapp_login;
"${volume_backend_name}/netapp_password": value => $netapp_password, secret => true;
"${volume_backend_name}/netapp_server_hostname": value => $netapp_server_hostname;
"${volume_backend_name}/netapp_server_port": value => $netapp_server_port;
"${volume_backend_name}/netapp_size_multiplier": value => $netapp_size_multiplier;
"${volume_backend_name}/netapp_storage_family": value => $netapp_storage_family;
"${volume_backend_name}/netapp_storage_protocol": value => $netapp_storage_protocol;
"${volume_backend_name}/netapp_transport_type": value => $netapp_transport_type;
"${volume_backend_name}/netapp_vfiler": value => $netapp_vfiler;
"${volume_backend_name}/netapp_volume_list": value => $netapp_volume_list;
"${volume_backend_name}/netapp_vserver": value => $netapp_vserver;
"${volume_backend_name}/expiry_thres_minutes": value => $expiry_thres_minutes;
"${volume_backend_name}/thres_avl_size_perc_start": value => $thres_avl_size_perc_start;
"${volume_backend_name}/thres_avl_size_perc_stop": value => $thres_avl_size_perc_stop;
"${volume_backend_name}/nfs_shares_config": value => $nfs_shares_config;
"${volume_backend_name}/netapp_copyoffload_tool_path": value => $netapp_copyoffload_tool_path;
"${volume_backend_name}/netapp_controller_ips": value => $netapp_controller_ips;
"${volume_backend_name}/netapp_sa_password": value => $netapp_sa_password;
"${volume_backend_name}/netapp_storage_pools": value => $netapp_storage_pools;
"${volume_backend_name}/netapp_webservice_path": value => $netapp_webservice_path;
if $nfs_shares {
validate_array($nfs_shares)
file {$nfs_shares_config:
content => join($nfs_shares, "\n"),
require => Package['cinder'],
notify => Service['cinder-volume']
}
}
if $nfs_mount_options {
cinder_config {
"${name}/nfs_mount_options": value => $nfs_mount_options;
}
} else {
cinder_config {
"${name}/nfs_mount_options": ensure => absent;
}
}
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';
"${name}/netapp_login": value => $netapp_login;
"${name}/netapp_password": value => $netapp_password, secret => true;
"${name}/netapp_server_hostname": value => $netapp_server_hostname;
"${name}/netapp_server_port": value => $netapp_server_port;
"${name}/netapp_size_multiplier": value => $netapp_size_multiplier;
"${name}/netapp_storage_family": value => $netapp_storage_family;
"${name}/netapp_storage_protocol": value => $netapp_storage_protocol;
"${name}/netapp_transport_type": value => $netapp_transport_type;
"${name}/netapp_vfiler": value => $netapp_vfiler;
"${name}/netapp_volume_list": value => $netapp_volume_list;
"${name}/netapp_vserver": value => $netapp_vserver;
"${name}/netapp_partner_backend_name": value => $netapp_partner_backend_name;
"${name}/expiry_thres_minutes": value => $expiry_thres_minutes;
"${name}/thres_avl_size_perc_start": value => $thres_avl_size_perc_start;
"${name}/thres_avl_size_perc_stop": value => $thres_avl_size_perc_stop;
"${name}/nfs_shares_config": value => $nfs_shares_config;
"${name}/netapp_copyoffload_tool_path": value => $netapp_copyoffload_tool_path;
"${name}/netapp_controller_ips": value => $netapp_controller_ips;
"${name}/netapp_sa_password": value => $netapp_sa_password, secret => true;
"${name}/netapp_storage_pools": value => $netapp_storage_pools;
"${name}/netapp_eseries_host_type": value => $netapp_eseries_host_type;
"${name}/netapp_webservice_path": value => $netapp_webservice_path;
}
if $netapp_storage_family == 'eseries' {
cinder_config {
"${name}/use_multipath_for_image_xfer": value => true;
}
}
create_resources('cinder_config', $extra_options)
}

View File

@ -32,6 +32,12 @@
# [*nexenta_sparse*]
# (optional) Flag to create sparse volumes. Defaults to true.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'nexenta_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::nexenta (
$nexenta_user,
$nexenta_password,
@ -41,13 +47,14 @@ define cinder::backend::nexenta (
$nexenta_target_prefix = 'iqn:',
$nexenta_target_group_prefix = 'cinder/',
$nexenta_blocksize = '8k',
$nexenta_sparse = true
$nexenta_sparse = true,
$extra_options = {},
) {
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/nexenta_user": value => $nexenta_user;
"${name}/nexenta_password": value => $nexenta_password;
"${name}/nexenta_password": value => $nexenta_password, secret => true;
"${name}/nexenta_host": value => $nexenta_host;
"${name}/nexenta_volume": value => $nexenta_volume;
"${name}/nexenta_target_prefix": value => $nexenta_target_prefix;
@ -56,4 +63,7 @@ define cinder::backend::nexenta (
"${name}/nexenta_sparse": value => $nexenta_sparse;
"${name}/volume_driver": value => 'cinder.volume.drivers.nexenta.volume.NexentaDriver';
}
create_resources('cinder_config', $extra_options)
}

View File

@ -1,21 +1,65 @@
# ==define cinder::backend::nfs
# == Define: cinder::backend::nfs
#
# === Parameters
#
# ===Paramiters
# [*volume_backend_name*]
# (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name
#
# [*nfs_servers*]
# (Required) Description
# Defaults to '[]'
#
# [*nfs_mount_options*]
# (Optional) Mount options passed to the nfs client.
# Defaults to 'undef'.
#
# [*nfs_disk_util*]
# (Optional) TODO
# Defaults to 'undef'.
#
# [*nfs_sparsed_volumes*]
# (Optional) Create volumes as sparsed files which take no space.
# If set to False volume is created as regular file.
# In such case volume creation takes a lot of time.
# Defaults to 'undef'.
#
# [*nfs_mount_point_base*]
# (Optional) Base dir containing mount points for nfs shares.
# Defaults to 'undef'.
#
# [*nfs_shares_config*]
# (Optional) File with the list of available nfs shares.
# Defaults to '/etc/cinder/shares.conf'.
#
# [*nfs_used_ratio*]
# (Optional) Percent of ACTUAL usage of the underlying volume before no new
# volumes can be allocated to the volume destination.
# Defaults to '0.95'.
#
# [*nfs_oversub_ratio*]
# (Optional) This will compare the allocated to available space on the volume
# destination. If the ratio exceeds this number, the destination will no
# longer be valid.
# Defaults to '1.0'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'nfs_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::nfs (
$volume_backend_name = $name,
$nfs_servers = [],
$nfs_mount_options = undef,
$nfs_disk_util = undef,
$nfs_sparsed_volumes = undef,
$volume_backend_name = $name,
$nfs_servers = [],
$nfs_mount_options = undef,
$nfs_disk_util = undef,
$nfs_sparsed_volumes = undef,
$nfs_mount_point_base = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_used_ratio = '0.95',
$nfs_oversub_ratio = '1.0',
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_used_ratio = '0.95',
$nfs_oversub_ratio = '1.0',
$extra_options = {},
) {
file {$nfs_shares_config:
@ -36,4 +80,7 @@ define cinder::backend::nfs (
"${name}/nfs_used_ratio": value => $nfs_used_ratio;
"${name}/nfs_oversub_ratio": value => $nfs_oversub_ratio;
}
create_resources('cinder_config', $extra_options)
}

View File

@ -0,0 +1,63 @@
#
# == Class: cinder::backend::quobyte
#
# Configures Cinder to use Quobyte USP as a volume driver
#
# === Parameters
#
# [*quobyte_volume_url*]
# (required) The URL of the Quobyte volume to use.
# Not an array as a Quobyte driver instance supports exactly one volume
# at a time - but you can load the driver more than once.
# Example: quobyte://quobyte.cluster.example.com/volume-name
#
# [*quobyte_client_cfg*]
# (optional) Path to a Quobyte client configuration file.
# This is needed if client certificate authentication is enabled on the
# Quobyte cluster. The config file includes the certificate and key.
#
# [*quobyte_qcow2_volumes*]
# (optional) Boolean if volumes should be created as qcow2 volumes.
# Defaults to True. qcow2 volumes allow snapshots, at the cost of a small
# performance penalty. If False, raw volumes will be used.
#
# [*quobyte_sparsed_volumes*]
# (optional) Boolean if raw volumes should be created as sparse files.
# Defaults to True. Non-sparse volumes may have a very small performance
# benefit, but take a long time to create.
#
# [*quobyte_mount_point_base*]
# (optional) Path where the driver should create mountpoints.
# Defaults to a subdirectory "mnt" under the Cinder state directory.
#
# [*volume_backend_name*]
# (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name
#
# === Examples
#
# cinder::backend::quobyte { 'quobyte1':
# quobyte_volume_url => 'quobyte://quobyte.cluster.example.com/volume-name',
# }
#
define cinder::backend::quobyte (
$quobyte_volume_url,
$quobyte_client_cfg = undef,
$quobyte_qcow2_volumes = undef,
$quobyte_sparsed_volumes = undef,
$quobyte_mount_point_base = undef,
$volume_backend_name = $name,
) {
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value =>
'cinder.volume.drivers.quobyte.QuobyteDriver';
"${name}/quobyte_volume_url": value => $quobyte_volume_url;
"${name}/quobyte_client_cfg": value => $quobyte_client_cfg;
"${name}/quobyte_qcow2_volumes": value => $quobyte_qcow2_volumes;
"${name}/quobyte_sparsed_volumes": value => $quobyte_sparsed_volumes;
"${name}/quobyte_mount_point_base": value => $quobyte_mount_point_base;
}
}

View File

@ -38,11 +38,11 @@
# A value of zero disables cloning
# Defaults to '5'
#
# [*glance_api_version*]
# (optional) DEPRECATED: Use cinder::glance Class instead.
# Glance API version. (Defaults to '2')
# Setting this parameter cause a duplicate resource declaration
# with cinder::glance
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'rbd_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::rbd (
$rbd_pool,
@ -53,15 +53,10 @@ define cinder::backend::rbd (
$rbd_secret_uuid = false,
$volume_tmp_dir = false,
$rbd_max_clone_depth = '5',
# DEPRECATED PARAMETERS
$glance_api_version = undef,
$extra_options = {},
) {
include cinder::params
if $glance_api_version {
warning('The glance_api_version parameter is deprecated, use glance_api_version of cinder::glance class instead.')
}
include ::cinder::params
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
@ -71,7 +66,6 @@ define cinder::backend::rbd (
"${name}/rbd_pool": value => $rbd_pool;
"${name}/rbd_max_clone_depth": value => $rbd_max_clone_depth;
"${name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot;
"${name}/host": value => "rbd:${rbd_pool}";
}
if $rbd_secret_uuid {
@ -86,15 +80,19 @@ define cinder::backend::rbd (
cinder_config {"${name}/volume_tmp_dir": ensure => absent;}
}
create_resources('cinder_config', $extra_options)
case $::osfamily {
'Debian': {
$override_line = "env CEPH_ARGS=\"--id ${rbd_user}\""
$override_match = '^env CEPH_ARGS='
}
'RedHat': {
$override_line = "export CEPH_ARGS=\"--id ${rbd_user}\""
$override_match = '^export CEPH_ARGS='
}
default: {
fail("unsuported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms")
fail("unsupported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms")
}
}
@ -104,6 +102,7 @@ define cinder::backend::rbd (
ensure_resource('file_line', 'set initscript env', {
line => $override_line,
path => $::cinder::params::ceph_init_override,
match => $override_match,
notify => Service['cinder-volume']
})

View File

@ -46,6 +46,12 @@
# [*ssh_min_pool_conn*]
# (optional) Maximum ssh connections in the pool.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'san_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::san (
$volume_driver,
$volume_backend_name = $name,
@ -59,7 +65,8 @@ define cinder::backend::san (
$san_is_local = false,
$ssh_conn_timeout = 30,
$ssh_min_pool_conn = 1,
$ssh_max_pool_conn = 5
$ssh_max_pool_conn = 5,
$extra_options = {},
) {
cinder_config {
@ -68,7 +75,7 @@ define cinder::backend::san (
"${name}/san_thin_provision": value => $san_thin_provision;
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password;
"${name}/san_password": value => $san_password, secret => true;
"${name}/san_private_key": value => $san_private_key;
"${name}/san_clustername": value => $san_clustername;
"${name}/san_ssh_port": value => $san_ssh_port;
@ -77,4 +84,7 @@ define cinder::backend::san (
"${name}/ssh_min_pool_conn": value => $ssh_min_pool_conn;
"${name}/ssh_max_pool_conn": value => $ssh_max_pool_conn;
}
create_resources('cinder_config', $extra_options)
}

View File

@ -11,7 +11,7 @@
#
# [*volume_driver*]
# (optional) Setup cinder-volume to use SolidFire volume driver.
# Defaults to 'cinder.volume.drivers.solidfire.SolidFire'
# Defaults to 'cinder.volume.drivers.solidfire.SolidFireDriver'
#
# [*san_ip*]
# (required) IP address of SolidFire clusters MVIP.
@ -38,16 +38,23 @@
# (optional) Port ID to use to connect to SolidFire API.
# Defaults to 443
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'solidfire_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::solidfire(
$san_ip,
$san_login,
$san_password,
$volume_backend_name = $name,
$volume_driver = 'cinder.volume.drivers.solidfire.SolidFire',
$volume_driver = 'cinder.volume.drivers.solidfire.SolidFireDriver',
$sf_emulate_512 = true,
$sf_allow_tenant_qos = false,
$sf_account_prefix = '',
$sf_api_port = '443'
$sf_api_port = '443',
$extra_options = {},
) {
cinder_config {
@ -55,10 +62,13 @@ define cinder::backend::solidfire(
"${name}/volume_driver": value => $volume_driver;
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password;
"${name}/san_password": value => $san_password, secret => true;
"${name}/sf_emulate_512": value => $sf_emulate_512;
"${name}/sf_allow_tenant_qos": value => $sf_allow_tenant_qos;
"${name}/sf_account_prefix": value => $sf_account_prefix;
"${name}/sf_api_port": value => $sf_api_port;
}
create_resources('cinder_config', $extra_options)
}

View File

@ -49,6 +49,12 @@
# (optional) The name for the folder in the VC datacenter that will contain cinder volumes.
# Defaults to 'cinder-volumes'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'vmdk_backend/param1' => { 'value' => value1 } }
#
define cinder::backend::vmdk (
$host_ip,
$host_username,
@ -59,7 +65,8 @@ define cinder::backend::vmdk (
$max_object_retrieval = 100,
$task_poll_interval = 5,
$image_transfer_timeout_secs = 7200,
$wsdl_location = undef
$wsdl_location = undef,
$extra_options = {},
) {
cinder_config {
@ -67,7 +74,7 @@ define cinder::backend::vmdk (
"${name}/volume_driver": value => 'cinder.volume.drivers.vmware.vmdk.VMwareVcVmdkDriver';
"${name}/vmware_host_ip": value => $host_ip;
"${name}/vmware_host_username": value => $host_username;
"${name}/vmware_host_password": value => $host_password;
"${name}/vmware_host_password": value => $host_password, secret => true;
"${name}/vmware_volume_folder": value => $volume_folder;
"${name}/vmware_api_retry_count": value => $api_retry_count;
"${name}/vmware_max_object_retrieval": value => $max_object_retrieval;
@ -81,10 +88,10 @@ define cinder::backend::vmdk (
}
}
if ! defined(Package['python-suds']) {
package { 'python-suds':
ensure => present
}
package { 'python-suds':
ensure => present
}
create_resources('cinder_config', $extra_options)
}

View File

@ -5,20 +5,19 @@
# === Parameters
#
# [*enabled_backends*]
# (required) a list of ini sections to enable.
# This should contain names used in ceph::backend::* resources.
# Example: ['volume1', 'volume2', 'sata3']
# (Required) a list of ini sections to enable.
# This should contain names used in ceph::backend::* resources.
# Example: ['volume1', 'volume2', 'sata3']
#
# === Deprecated Parameters
#
# [*default_volume_type*]
# (optional) default volume type to use.
# This should contain the name of the default volume type to use.
# If not configured, it produces an error when creating a volume
# without specifying a type.
# Defaults to 'false'.
# (Deprecated) Does nothing.
#
# Author: Andrew Woodward <awoodward@mirantis.com>
class cinder::backends (
$enabled_backends = undef,
# DEPRECATED
$default_volume_type = false
){
@ -28,13 +27,7 @@ class cinder::backends (
}
if $default_volume_type {
cinder_config {
'DEFAULT/default_volume_type': value => $default_volume_type;
}
} else {
cinder_config {
'DEFAULT/default_volume_type': ensure => absent;
}
fail('The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api.')
}
}

View File

@ -1,26 +1,17 @@
#
# 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: cinder::backup
#
# Setup Cinder backup service
#
# === Parameters
#
# [*enabled*]
# (Optional) Should the service be enabled.
# Defaults to 'true'.
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'.
#
# [*backup_topic*]
# (optional) The topic volume backup nodes listen on.
# Defaults to 'cinder-backup'
@ -37,7 +28,27 @@
# (optional) Template string to be used to generate backup names.
# Defaults to 'backup-%s'
#
# === Author(s)
#
# Emilien Macchi <emilien.macchi@enovance.com>
#
# === Copyright
#
# Copyright (C) 2013 eNovance SAS <licensing@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 cinder::backup (
$enabled = true,
$package_ensure = 'present',
@ -47,18 +58,19 @@ class cinder::backup (
$backup_name_template = 'backup-%s'
) {
include cinder::params
include ::cinder::params
Cinder_config<||> ~> Service['cinder-backup']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-backup']
if $::cinder::params::backup_package {
Package['cinder-backup'] -> Cinder_config<||>
Package['cinder-backup'] ~> Service['cinder-backup']
Package['cinder'] ~> Service['cinder-backup']
Package['cinder-backup'] -> Service['cinder-backup']
Package['cinder-backup'] ~> Exec<| title == 'cinder-manage db_sync' |>
package { 'cinder-backup':
ensure => $package_ensure,
name => $::cinder::params::backup_package,
tag => 'openstack',
}
}
@ -69,11 +81,11 @@ class cinder::backup (
}
service { 'cinder-backup':
ensure => $ensure,
name => $::cinder::params::backup_service,
enable => $enabled,
hasstatus => true,
hasrestart => true,
ensure => $ensure,
name => $::cinder::params::backup_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
}
cinder_config {

View File

@ -0,0 +1,106 @@
# == Class: cinder::backup::nfs
#
# Setup Cinder to backup volumes into NFS
#
# === Parameters
#
# [*backup_share*]
# (required) The NFS share to attach to, to be specified in
# fqdn:path, ipv4addr:path, or "[ipv6addr]:path" format.
#
# [*backup_driver*]
# (optional) The backup driver for NFS back-end.
# Defaults to 'cinder.backup.drivers.nfs'.
#
# [*backup_file_size*]
# (optional) The maximum size in bytes of the files used to hold
# 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
#
# [*backup_sha_block_size_bytes*]
# (optional) The size in bytes that changes are tracked for
# incremental backups.
# Defaults to 32768
#
# [*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
#
# [*backup_mount_point_base*]
# (optional) The base directory containing the mount point for the
# NFS share.
# Defaults to '$state_path/backup_mount'
#
# [*backup_mount_options*]
# (optional) The mount options that are passed to the NFS client.
# Defaults to undef
#
# [*backup_container*]
# (optional) Custom container to use for backups.
# Defaults to undef
#
# [*backup_compression_algorithm*]
# (optional) Compression algorithm to use when writing backup data.
# Defaults to 'zlib'
#
# === Author(s)
#
# Ryan Hefner <ryan.hefner@netapp.com>
#
# === Copyright
#
# Copyright (C) 2015 Ryan Hefner <ryan.hefner@netapp.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 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_mount_options = undef,
$backup_container = undef,
$backup_compression_algorithm = 'zlib',
) {
validate_string($backup_share)
if $backup_mount_options {
cinder_config {
'DEFAULT/backup_mount_options': value => $backup_mount_options;
}
} else {
cinder_config {
'DEFAULT/backup_mount_options': ensure => absent;
}
}
cinder_config {
'DEFAULT/backup_share': value => $backup_share;
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_file_size': value => $backup_file_size;
'DEFAULT/backup_sha_block_size_bytes': value => $backup_sha_block_size_bytes;
'DEFAULT/backup_enable_progress_timer': value => $backup_enable_progress_timer;
'DEFAULT/backup_mount_point_base': value => $backup_mount_point_base;
'DEFAULT/backup_container': value => $backup_container;
'DEFAULT/backup_compression_algorithm': value => $backup_compression_algorithm;
}
}

View File

@ -1,26 +1,13 @@
#
# 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: cinder::backup::swift
#
# Setup Cinder to backup volumes into Swift
#
# === Parameters
#
# [*backup_driver*]
# (Optional) The backup driver for Swift back-end.
# Defaults to 'cinder.backup.drivers.swift'.
#
# [*backup_swift_url*]
# (optional) The URL of the Swift endpoint.
# Should be a valid Swift URL
@ -42,23 +29,50 @@
# (optional) The backoff time in seconds between Swift retries.
# Defaults to '2'
#
# [*backup_compression_algorithm*]
# (optional) The compression algorithm for the chunks sent to swift
# Defaults to 'zlib'
# set to None to disable compression
#
# === Author(s)
#
# Emilien Macchi <emilien.macchi@enovance.com>
#
# === Copyright
#
# Copyright (C) 2013 eNovance SAS <licensing@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 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_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',
) {
cinder_config {
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_swift_url': value => $backup_swift_url;
'DEFAULT/backup_swift_container': value => $backup_swift_container;
'DEFAULT/backup_swift_object_size': value => $backup_swift_object_size;
'DEFAULT/backup_swift_retry_attempts': value => $backup_swift_retry_attempts;
'DEFAULT/backup_swift_retry_backoff': value => $backup_swift_retry_backoff;
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_swift_url': value => $backup_swift_url;
'DEFAULT/backup_swift_container': value => $backup_swift_container;
'DEFAULT/backup_swift_object_size': value => $backup_swift_object_size;
'DEFAULT/backup_swift_retry_attempts': value => $backup_swift_retry_attempts;
'DEFAULT/backup_swift_retry_backoff': value => $backup_swift_retry_backoff;
'DEFAULT/backup_compression_algorithm': value => $backup_compression_algorithm;
}
}

View File

@ -4,17 +4,19 @@
#
# === Parameters
#
# [*ensure*]
# Ensure state for package. Defaults to 'present'.
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'.
#
class cinder::client(
$package_ensure = 'present'
) {
include cinder::params
include ::cinder::params
package { 'python-cinderclient':
ensure => $package_ensure,
name => $::cinder::params::client_package,
tag => 'openstack',
}
}

View File

@ -18,10 +18,11 @@
# DEFAULT/bar:
# value: barValue
#
# [**cinder_config**]
# [*cinder_config*]
# (optional) Allow configuration of cinder.conf configurations.
# Defaults to empty hash'{}'
#
# [**api_paste_ini_config**]
# [*api_paste_ini_config*]
# (optional) Allow configuration of /etc/cinder/api-paste.ini configurations.
#
# NOTE: The configuration MUST NOT be already handled by this module

View File

@ -1,7 +1,41 @@
# [*mysql_module*]
# (optional) The puppet-mysql module version to use.
# Tested versions include 0.9 and 2.2
# Defaults to '0.9'
# == Class: cinder::db::mysql
#
# The cinder::db::mysql class creates a MySQL database for cinder.
# It must be used on the MySQL server
#
# === Parameters
#
# [*password*]
# password to connect to the database. Mandatory.
#
# [*dbname*]
# name of the database. Optional. Defaults to cinder.
#
# [*user*]
# user to connect to the database. Optional. Defaults to cinder.
#
# [*host*]
# the default source host user is allowed to connect from.
# Optional. Defaults to 'localhost'
#
# [*allowed_hosts*]
# other hosts the user is allowd to connect from.
# Optional. Defaults to undef.
#
# [*charset*]
# the database charset. Optional. Defaults to 'utf8'
#
# [*collate*]
# the database collation. Optional. Defaults to 'utf8_general_ci'
#
# [*cluster_id*]
# (Optional) TODO
# Defaults to 'localzone'.
#
# === Deprecated Parameters
#
# [*mysql_module*]
# (Deprecated) Deprecated. Does nothing.
#
class cinder::db::mysql (
$password,
@ -10,53 +44,27 @@ class cinder::db::mysql (
$host = '127.0.0.1',
$allowed_hosts = undef,
$charset = 'utf8',
$collate = 'utf8_unicode_ci',
$collate = 'utf8_general_ci',
$cluster_id = 'localzone',
$mysql_module = '0.9'
# DEPRECATED
$mysql_module = undef,
) {
Class['cinder::db::mysql'] -> Exec<| title == 'cinder-manage db_sync' |>
if ($mysql_module >= 2.2) {
Mysql_database[$dbname] ~> Exec<| title == 'cinder-manage db_sync' |>
mysql::db { $dbname:
user => $user,
password => $password,
host => $host,
charset => $charset,
collate => $collate,
require => Class['mysql::server'],
}
} else {
Database[$dbname] ~> Exec<| title == 'cinder-manage db_sync' |>
mysql::db { $dbname:
user => $user,
password => $password,
host => $host,
charset => $charset,
require => Class['mysql::config'],
}
if $mysql_module {
warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
}
validate_string($password)
# Check allowed_hosts to avoid duplicate resource declarations
if is_array($allowed_hosts) and delete($allowed_hosts,$host) != [] {
$real_allowed_hosts = delete($allowed_hosts,$host)
} elsif is_string($allowed_hosts) and ($allowed_hosts != $host) {
$real_allowed_hosts = $allowed_hosts
}
if $real_allowed_hosts {
# TODO this class should be in the mysql namespace
cinder::db::mysql::host_access { $real_allowed_hosts:
user => $user,
password => $password,
database => $dbname,
mysql_module => $mysql_module,
}
::openstacklib::db::mysql { 'cinder':
user => $user,
password_hash => mysql_password($password),
dbname => $dbname,
host => $host,
charset => $charset,
collate => $collate,
allowed_hosts => $allowed_hosts,
}
::Openstacklib::Db::Mysql['cinder'] ~> Exec<| title == 'cinder-manage db_sync' |>
}

View File

@ -1,33 +0,0 @@
#
# Used to grant access to the cinder mysql DB
#
define cinder::db::mysql::host_access ($user, $password, $database, $mysql_module = '0.9') {
if ($mysql_module >= 2.2) {
mysql_user { "${user}@${name}":
password_hash => mysql_password($password),
provider => 'mysql',
require => Mysql_database[$database],
}
mysql_grant { "${user}@${name}/${database}.*":
privileges => ['ALL'],
options => ['GRANT'],
provider => 'mysql',
table => "${database}.*",
require => Mysql_user["${user}@${name}"],
user => "${user}@${name}"
}
} else {
database_user { "${user}@${name}":
password_hash => mysql_password($password),
provider => 'mysql',
require => Database[$database],
}
database_grant { "${user}@${name}/${database}":
# TODO figure out which privileges to grant.
privileges => 'all',
provider => 'mysql',
require => Database_user["${user}@${name}"]
}
}
}

View File

@ -1,21 +1,45 @@
# == Class: cinder::db::postgresql
#
# Class that configures postgresql for cinder
#
# Requires the Puppetlabs postgresql module.
#
# === Parameters
#
# [*password*]
# (Required) Password to connect to the database.
#
# [*dbname*]
# (Optional) Name of the database.
# Defaults to 'cinder'.
#
# [*user*]
# (Optional) User to connect to the database.
# Defaults to 'cinder'.
#
# [*encoding*]
# (Optional) The charset to use for the database.
# Default to undef.
#
# [*privileges*]
# (Optional) Privileges given to the database user.
# Default to 'ALL'
#
class cinder::db::postgresql(
$password,
$dbname = 'cinder',
$user = 'cinder'
$dbname = 'cinder',
$user = 'cinder',
$encoding = undef,
$privileges = 'ALL',
) {
require postgresql::python
Postgresql::Server::Db[$dbname] ~> Exec<| title == 'cinder-manage db_sync' |>
Package['python-psycopg2'] -> Exec<| title == 'cinder-manage db_sync' |>
postgresql::server::db { $dbname:
user => $user,
password => $password,
::openstacklib::db::postgresql { 'cinder':
password_hash => postgresql_password($user, $password),
dbname => $dbname,
user => $user,
encoding => $encoding,
privileges => $privileges,
}
::Openstacklib::Db::Postgresql['cinder'] ~> Exec<| title == 'cinder-manage db_sync' |>
}

View File

@ -1,7 +1,7 @@
#
class cinder::db::sync {
include cinder::params
include ::cinder::params
exec { 'cinder-manage db_sync':
command => $::cinder::params::db_sync_command,

View File

@ -1,20 +1,3 @@
#
# 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: cinder::glance
#
# Glance drive Cinder as a block storage backend to store image data.
@ -51,7 +34,26 @@
# (optional) http/https timeout value for glance operations.
# Defaults to undef
#
# === Author(s)
#
# Emilien Macchi <emilien.macchi@enovance.com>
#
# === Copyright
#
# Copyright (C) 2013 eNovance SAS <licensing@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 cinder::glance (
$glance_api_servers = undef,
$glance_api_version = '2',

View File

@ -1,23 +1,163 @@
# == Class: cinder
#
# == Parameters
# [database_connection]
# Cinder base package & configuration
#
# === Parameters
#
# [*package_ensure*]
# (Optional) Ensure state for package.
# Defaults to 'present'
#
# [*verbose*]
# (Optional) Should the daemons log verbose messages
# Defaults to 'false'
#
# [*debug*]
# (Optional) Should the daemons log debug messages
# Defaults to 'false'
#
# [*use_syslog*]
# (Optional) Use syslog for logging.
# Defaults to false.
#
# [*database_connection*]
# Url used to connect to database.
# (Optional) Defaults to
# 'sqlite:////var/lib/cinder/cinder.sqlite'
#
# [database_idle_timeout]
# [*database_idle_timeout*]
# Timeout when db connections should be reaped.
# (Optional) Defaults to 3600.
#
# [amqp_durable_queues]
# [*database_min_pool_size*]
# Minimum number of SQL connections to keep open in a pool.
# (Optional) Defaults to 1.
#
# [*database_max_pool_size*]
# Maximum number of SQL connections to keep open in a pool.
# (Optional) Defaults to undef.
#
# [*database_max_retries*]
# Maximum db connection retries during startup.
# Setting -1 implies an infinite retry count.
# (Optional) Defaults to 10.
#
# [*database_retry_interval*]
# Interval between retries of opening a sql connection.
# (Optional) Defaults to 10.
#
# [*database_max_overflow*]
# If set, use this value for max_overflow with sqlalchemy.
# (Optional) Defaults to undef.
#
# [*rpc_backend*]
# (Optional) Use these options to configure the RabbitMQ message system.
# Defaults to 'cinder.openstack.common.rpc.impl_kombu'
#
# [*control_exchange*]
# (Optional)
# Defaults to 'openstack'.
#
# [*rabbit_host*]
# (Optional) IP or hostname of the rabbit server.
# Defaults to '127.0.0.1'
#
# [*rabbit_port*]
# (Optional) Port of the rabbit server.
# Defaults to 5672.
#
# [*rabbit_hosts*]
# (Optional) Array of host:port (used with HA queues).
# If defined, will remove rabbit_host & rabbit_port parameters from config
# Defaults to undef.
#
# [*rabbit_userid*]
# (Optional) User to connect to the rabbit server.
# Defaults to 'guest'
#
# [*rabbit_password*]
# (Optional) Password to connect to the rabbit_server.
# Defaults to empty.
#
# [*rabbit_virtual_host*]
# (Optional) Virtual_host to use.
# Defaults to '/'
#
# [*rabbit_use_ssl*]
# (optional) Connect over SSL for RabbitMQ
# Defaults to false
#
# [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef
#
# [*kombu_ssl_certfile*]
# (optional) SSL cert file (valid only if SSL enabled).
# Defaults to undef
#
# [*kombu_ssl_keyfile*]
# (optional) SSL key file (valid only if SSL enabled).
# Defaults to undef
#
# [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions.
# Defaults to 'TLSv1'
#
# [*amqp_durable_queues*]
# Use durable queues in amqp.
# (Optional) Defaults to false.
#
# [use_syslog]
# [*qpid_hostname*]
# (Optional) Location of qpid server
# Defaults to 'localhost'.
#
# [*qpid_port*]
# (Optional) Port for qpid server.
# Defaults to '5672'.
#
# [*qpid_username*]
# (Optional) Username to use when connecting to qpid.
# Defaults to 'guest'.
#
# [*qpid_password*]
# (Optional) Password to use when connecting to qpid.
# Defaults to 'false'.
#
# [*qpid_sasl_mechanisms*]
# (Optional) ENable one or more SASL mechanisms.
# Defaults to 'false'.
#
# [*qpid_heartbeat*]
# (Optional) Seconds between connection keepalive heartbeats.
# Defaults to '60'.
#
# [*qpid_protocol*]
# (Optional) Transport to use, either 'tcp' or 'ssl'.
# Defaults to 'tcp'.
#
# [*qpid_tcp_nodelay*]
# (Optional) Disable Nagle Algorithm.
# Defaults to 'true'.
#
# [*qpid_reconnect*]
#
# [*qpid_reconnect_timeout*]
#
# [*qpid_reconnect_limit*]
#
# [*qpid_reconnect_interval*]
#
# [*qpid_reconnect_interval_min*]
#
# [*qpid_reconnect_interval_max*]
#
# [*use_syslog]
# Use syslog for logging.
# (Optional) Defaults to false.
#
# [log_facility]
# [*log_facility*]
# Syslog facility to receive log lines.
# (Optional) Defaults to LOG_USER.
#
@ -26,19 +166,58 @@
# If set to boolean false, it will not log to any directory.
# Defaults to '/var/log/cinder'
#
# [*mysql_module*]
# (optional) Puppetlabs-mysql module version to use
# Tested versions include 0.9 and 2.2
# Defaults to '0.9'
# [*use_ssl*]
# (optional) Enable SSL on the API server
# Defaults to false, not set
#
# [sql_connection]
# DEPRECATED
# [sql_idle_timeout]
# DEPRECATED
# [*cert_file*]
# (optinal) Certificate file to use when starting API server securely
# Defaults to false, not set
#
# [*key_file*]
# (optional) Private key file to use when starting API server securely
# Defaults to false, not set
#
# [*ca_file*]
# (optional) CA certificate file to use to verify connecting clients
# Defaults to false, not set_
#
# [*storage_availability_zone*]
# (optional) Availability zone of the node.
# Defaults to 'nova'
#
# [*default_availability_zone*]
# (optional) Default availability zone for new volumes.
# If not set, the storage_availability_zone option value is used as
# the default for new volumes.
# Defaults to false
#
# [*api_paste_config*]
# (Optional)
# Defaults to '/etc/cinder/api-paste.ini',
#
# [*enable_v1_api*]
# (Optional) Whether to enable the v1 API (true/false).
# This will be deprecated in Kilo.
# Defaults to 'true'.
#
# [*enable_v2_api*]
# (Optional) Whether to enable the v1 API (true/false).
# Defaults to 'true'.
#
# === Deprecated Parameters
#
# [*mysql_module*]
# DEPRECATED. Does nothing.
#
class cinder (
$database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite',
$database_idle_timeout = '3600',
$database_min_pool_size = '1',
$database_max_pool_size = undef,
$database_max_retries = '10',
$database_retry_interval = '10',
$database_max_overflow = undef,
$rpc_backend = 'cinder.openstack.common.rpc.impl_kombu',
$control_exchange = 'openstack',
$rabbit_host = '127.0.0.1',
@ -47,6 +226,11 @@ class cinder (
$rabbit_virtual_host = '/',
$rabbit_userid = 'guest',
$rabbit_password = false,
$rabbit_use_ssl = false,
$kombu_ssl_ca_certs = undef,
$kombu_ssl_certfile = undef,
$kombu_ssl_keyfile = undef,
$kombu_ssl_version = 'TLSv1',
$amqp_durable_queues = false,
$qpid_hostname = 'localhost',
$qpid_port = '5672',
@ -63,6 +247,10 @@ class cinder (
$qpid_protocol = 'tcp',
$qpid_tcp_nodelay = true,
$package_ensure = 'present',
$use_ssl = false,
$ca_file = false,
$cert_file = false,
$key_file = false,
$api_paste_config = '/etc/cinder/api-paste.ini',
$use_syslog = false,
$log_facility = 'LOG_USER',
@ -71,29 +259,28 @@ class cinder (
$debug = false,
$storage_availability_zone = 'nova',
$default_availability_zone = false,
$mysql_module = '0.9',
$enable_v1_api = true,
$enable_v2_api = true,
# DEPRECATED PARAMETERS
$sql_connection = undef,
$sql_idle_timeout = undef,
$mysql_module = undef,
) {
include cinder::params
include ::cinder::params
Package['cinder'] -> Cinder_config<||>
Package['cinder'] -> Cinder_api_paste_ini<||>
if $sql_connection {
warning('The sql_connection parameter is deprecated, use database_connection instead.')
$database_connection_real = $sql_connection
} else {
$database_connection_real = $database_connection
if $mysql_module {
warning('The mysql_module parameter is deprecated. The latest 2.x mysql module will be used.')
}
if $sql_idle_timeout {
warning('The sql_idle_timeout parameter is deprecated, use database_idle_timeout instead.')
$database_idle_timeout_real = $sql_idle_timeout
} else {
$database_idle_timeout_real = $database_idle_timeout
if $use_ssl {
if !$cert_file {
fail('The cert_file parameter is required when use_ssl is set to true')
}
if !$key_file {
fail('The key_file parameter is required when use_ssl is set to true')
}
}
# this anchor is used to simplify the graph between cinder components by
@ -103,6 +290,7 @@ class cinder (
package { 'cinder':
ensure => $package_ensure,
name => $::cinder::params::package_name,
tag => 'openstack',
require => Anchor['cinder-start'],
}
@ -129,22 +317,55 @@ class cinder (
}
cinder_config {
'DEFAULT/rabbit_password': value => $rabbit_password, secret => true;
'DEFAULT/rabbit_userid': value => $rabbit_userid;
'DEFAULT/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true;
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'DEFAULT/control_exchange': value => $control_exchange;
'DEFAULT/amqp_durable_queues': value => $amqp_durable_queues;
}
if $rabbit_hosts {
cinder_config { 'DEFAULT/rabbit_hosts': value => join($rabbit_hosts, ',') }
cinder_config { 'DEFAULT/rabbit_ha_queues': value => true }
cinder_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ',') }
cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => true }
cinder_config { 'oslo_messaging_rabbit/rabbit_host': ensure => absent }
cinder_config { 'oslo_messaging_rabbit/rabbit_port': ensure => absent }
} else {
cinder_config { 'DEFAULT/rabbit_host': value => $rabbit_host }
cinder_config { 'DEFAULT/rabbit_port': value => $rabbit_port }
cinder_config { 'DEFAULT/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
cinder_config { 'DEFAULT/rabbit_ha_queues': value => false }
cinder_config { 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host }
cinder_config { 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port }
cinder_config { 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}" }
cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
}
if $rabbit_use_ssl {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version }
if $kombu_ssl_ca_certs {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs }
} else {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent}
}
if $kombu_ssl_certfile {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile }
} else {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent}
}
if $kombu_ssl_keyfile {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile }
} else {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent}
}
} else {
cinder_config {
'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
}
}
}
if $rpc_backend == 'cinder.openstack.common.rpc.impl_qpid' {
@ -192,8 +413,11 @@ class cinder (
}
cinder_config {
'database/connection': value => $database_connection_real, secret => true;
'database/idle_timeout': value => $database_idle_timeout_real;
'database/connection': value => $database_connection, secret => true;
'database/idle_timeout': value => $database_idle_timeout;
'database/min_pool_size': value => $database_min_pool_size;
'database/max_retries': value => $database_max_retries;
'database/retry_interval': value => $database_retry_interval;
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'DEFAULT/api_paste_config': value => $api_paste_config;
@ -202,19 +426,35 @@ class cinder (
'DEFAULT/default_availability_zone': value => $default_availability_zone_real;
}
if($database_connection_real =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
if ($mysql_module >= 2.2) {
require 'mysql::bindings'
require 'mysql::bindings::python'
} else {
require 'mysql::python'
if $database_max_pool_size {
cinder_config {
'database/max_pool_size': value => $database_max_pool_size;
}
} elsif($database_connection_real =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
} else {
cinder_config {
'database/max_pool_size': ensure => absent;
}
}
} elsif($database_connection_real =~ /sqlite:\/\//) {
if $database_max_overflow {
cinder_config {
'database/max_overflow': value => $database_max_overflow;
}
} else {
cinder_config {
'database/max_overflow': ensure => absent;
}
}
if($database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
require 'mysql::bindings'
require 'mysql::bindings::python'
} elsif($database_connection =~ /postgresql:\/\/\S+:\S+@\S+\/\S+/) {
} elsif($database_connection =~ /sqlite:\/\//) {
} else {
fail("Invalid db connection ${database_connection_real}")
fail("Invalid db connection ${database_connection}")
}
if $log_dir {
@ -227,6 +467,29 @@ class cinder (
}
}
# SSL Options
if $use_ssl {
cinder_config {
'DEFAULT/ssl_cert_file' : value => $cert_file;
'DEFAULT/ssl_key_file' : value => $key_file;
}
if $ca_file {
cinder_config { 'DEFAULT/ssl_ca_file' :
value => $ca_file,
}
} else {
cinder_config { 'DEFAULT/ssl_ca_file' :
ensure => absent,
}
}
} else {
cinder_config {
'DEFAULT/ssl_cert_file' : ensure => absent;
'DEFAULT/ssl_key_file' : ensure => absent;
'DEFAULT/ssl_ca_file' : ensure => absent;
}
}
if $use_syslog {
cinder_config {
'DEFAULT/use_syslog': value => true;
@ -238,4 +501,10 @@ class cinder (
}
}
# V1/V2 APIs
cinder_config {
'DEFAULT/enable_v1_api': value => $enable_v1_api;
'DEFAULT/enable_v2_api': value => $enable_v2_api;
}
}

View File

@ -14,7 +14,7 @@
# Username for Cinder service. Optional. Defaults to 'cinder'.
#
# [*auth_name_v2*]
# Username for Cinder v2 service. Optional. Defaults to 'cinder2'.
# Username for Cinder v2 service. Optional. Defaults to 'cinderv2'.
#
# [*configure_endpoint*]
# Should Cinder endpoint be configured? Optional. Defaults to 'true'.
@ -23,6 +23,23 @@
# [*configure_endpoint_v2*]
# Should Cinder v2 endpoint be configured? Optional. Defaults to 'true'.
#
# [*configure_user*]
# Should the service user be configured? Optional. Defaults to 'true'.
#
# [*configure_user_role*]
# Should the admin role be configured for the service user?
# Optional. Defaults to 'true'.
#
# [*service_name*]
# (optional) Name of the service.
# Defaults to the value of auth_name, but must differ from the value
# of service_name_v2.
#
# [*service_name_v2*]
# (optional) Name of the v2 service.
# Defaults to the value of auth_name_v2, but must differ from the value
# of service_name.
#
# [*service_type*]
# Type of service. Optional. Defaults to 'volume'.
#
@ -67,6 +84,10 @@ class cinder::keystone::auth (
$tenant = 'services',
$configure_endpoint = true,
$configure_endpoint_v2 = true,
$configure_user = true,
$configure_user_role = true,
$service_name = undef,
$service_name_v2 = undef,
$service_type = 'volume',
$service_type_v2 = 'volumev2',
$public_address = '127.0.0.1',
@ -79,44 +100,52 @@ class cinder::keystone::auth (
$admin_protocol = 'http',
$internal_protocol = 'http'
) {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'cinder-api' |>
keystone_user { $auth_name:
ensure => present,
password => $password,
email => $email,
tenant => $tenant,
if $service_name {
$real_service_name = $service_name
} else {
$real_service_name = $auth_name
}
keystone_user_role { "${auth_name}@${tenant}":
ensure => present,
roles => 'admin',
}
keystone_service { $auth_name:
ensure => present,
type => $service_type,
description => 'Cinder Service',
}
keystone_service { $auth_name_v2:
ensure => present,
type => $service_type_v2,
description => 'Cinder Service v2',
if $service_name_v2 {
$real_service_name_v2 = $service_name_v2
} else {
$real_service_name_v2 = $auth_name_v2
}
if $configure_endpoint {
keystone_endpoint { "${region}/${auth_name}":
ensure => present,
public_url => "${public_protocol}://${public_address}:${port}/${volume_version}/%(tenant_id)s",
admin_url => "${admin_protocol}://${admin_address}:${port}/${volume_version}/%(tenant_id)s",
internal_url => "${internal_protocol}://${internal_address}:${port}/${volume_version}/%(tenant_id)s",
}
if $real_service_name == $real_service_name_v2 {
fail('cinder::keystone::auth parameters service_name and service_name_v2 must be different.')
}
if $configure_endpoint_v2 {
keystone_endpoint { "${region}/${auth_name_v2}":
ensure => present,
public_url => "${public_protocol}://${public_address}:${port}/v2/%(tenant_id)s",
admin_url => "http://${admin_address}:${port}/v2/%(tenant_id)s",
internal_url => "http://${internal_address}:${port}/v2/%(tenant_id)s",
}
keystone::resource::service_identity { 'cinder':
configure_user => $configure_user,
configure_user_role => $configure_user_role,
configure_endpoint => $configure_endpoint,
service_type => $service_type,
service_description => 'Cinder Service',
service_name => $real_service_name,
region => $region,
auth_name => $auth_name,
password => $password,
email => $email,
tenant => $tenant,
public_url => "${public_protocol}://${public_address}:${port}/${volume_version}/%(tenant_id)s",
admin_url => "${admin_protocol}://${admin_address}:${port}/${volume_version}/%(tenant_id)s",
internal_url => "${internal_protocol}://${internal_address}:${port}/${volume_version}/%(tenant_id)s",
}
keystone::resource::service_identity { 'cinderv2':
configure_user => false,
configure_user_role => false,
configure_endpoint => $configure_endpoint_v2,
service_type => $service_type_v2,
service_description => 'Cinder Service v2',
service_name => $real_service_name_v2,
region => $region,
public_url => "${public_protocol}://${public_address}:${port}/v2/%(tenant_id)s",
admin_url => "${admin_protocol}://${admin_address}:${port}/v2/%(tenant_id)s",
internal_url => "${internal_protocol}://${internal_address}:${port}/v2/%(tenant_id)s",
}
if $configure_user_role {
Keystone_user_role["${auth_name}@${tenant}"] ~> Service <| name == 'cinder-api' |>
}
}

View File

@ -0,0 +1,208 @@
# == Class: cinder::logging
#
# Cinder extended logging configuration
#
# === Parameters
#
# [*logging_context_format_string*]
# (Optional) Format string to use for log messages with context.
# Defaults to undef.
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
#
# [*logging_default_format_string*]
# (Optional) Format string to use for log messages without context.
# Defaults to undef.
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [-] %(instance)s%(message)s'
#
# [*logging_debug_format_suffix*]
# (Optional) Formatted data to append to log format when level is DEBUG.
# Defaults to undef.
# Example: '%(funcName)s %(pathname)s:%(lineno)d'
#
# [*logging_exception_prefix*]
# (Optional) Prefix each line of exception output with this format.
# Defaults to undef.
# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
#
# [*log_config_append*]
# The name of an additional logging configuration file.
# Defaults to undef.
# See https://docs.python.org/2/howto/logging.html
#
# [*default_log_levels*]
# (optional) Hash of logger (keys) and level (values) pairs.
# Defaults to undef.
# Example:
# { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
# 'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
# 'iso8601' => 'WARN',
# 'requests.packages.urllib3.connectionpool' => 'WARN' }
#
# [*publish_errors*]
# (optional) Publish error events (boolean value).
# Defaults to undef (false if unconfigured).
#
# [*fatal_deprecations*]
# (optional) Make deprecations fatal (boolean value)
# Defaults to undef (false if unconfigured).
#
# [*instance_format*]
# (optional) If an instance is passed with the log message, format it
# like this (string value).
# Defaults to undef.
# Example: '[instance: %(uuid)s] '
#
# [*instance_uuid_format*]
# (optional) If an instance UUID is passed with the log message, format
# it like this (string value).
# Defaults to undef.
# Example: instance_uuid_format='[instance: %(uuid)s] '
#
# [*log_date_format*]
# (optional) Format string for %%(asctime)s in log records.
# Defaults to undef.
# Example: 'Y-%m-%d %H:%M:%S'
#
class cinder::logging(
$logging_context_format_string = undef,
$logging_default_format_string = undef,
$logging_debug_format_suffix = undef,
$logging_exception_prefix = undef,
$log_config_append = undef,
$default_log_levels = undef,
$publish_errors = undef,
$fatal_deprecations = undef,
$instance_format = undef,
$instance_uuid_format = undef,
$log_date_format = undef,
) {
if $logging_context_format_string {
cinder_config {
'DEFAULT/logging_context_format_string' :
value => $logging_context_format_string;
}
}
else {
cinder_config {
'DEFAULT/logging_context_format_string' : ensure => absent;
}
}
if $logging_default_format_string {
cinder_config {
'DEFAULT/logging_default_format_string' :
value => $logging_default_format_string;
}
}
else {
cinder_config {
'DEFAULT/logging_default_format_string' : ensure => absent;
}
}
if $logging_debug_format_suffix {
cinder_config {
'DEFAULT/logging_debug_format_suffix' :
value => $logging_debug_format_suffix;
}
}
else {
cinder_config {
'DEFAULT/logging_debug_format_suffix' : ensure => absent;
}
}
if $logging_exception_prefix {
cinder_config {
'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix;
}
}
else {
cinder_config {
'DEFAULT/logging_exception_prefix' : ensure => absent;
}
}
if $log_config_append {
cinder_config {
'DEFAULT/log_config_append' : value => $log_config_append;
}
}
else {
cinder_config {
'DEFAULT/log_config_append' : ensure => absent;
}
}
if $default_log_levels {
cinder_config {
'DEFAULT/default_log_levels' :
value => join(sort(join_keys_to_values($default_log_levels, '=')), ',');
}
}
else {
cinder_config {
'DEFAULT/default_log_levels' : ensure => absent;
}
}
if $publish_errors {
cinder_config {
'DEFAULT/publish_errors' : value => $publish_errors;
}
}
else {
cinder_config {
'DEFAULT/publish_errors' : ensure => absent;
}
}
if $fatal_deprecations {
cinder_config {
'DEFAULT/fatal_deprecations' : value => $fatal_deprecations;
}
}
else {
cinder_config {
'DEFAULT/fatal_deprecations' : ensure => absent;
}
}
if $instance_format {
cinder_config {
'DEFAULT/instance_format' : value => $instance_format;
}
}
else {
cinder_config {
'DEFAULT/instance_format' : ensure => absent;
}
}
if $instance_uuid_format {
cinder_config {
'DEFAULT/instance_uuid_format' : value => $instance_uuid_format;
}
}
else {
cinder_config {
'DEFAULT/instance_uuid_format' : ensure => absent;
}
}
if $log_date_format {
cinder_config {
'DEFAULT/log_date_format' : value => $log_date_format;
}
}
else {
cinder_config {
'DEFAULT/log_date_format' : ensure => absent;
}
}
}

View File

@ -1,3 +1,4 @@
# == Class: cinder::params
#
class cinder::params {
@ -40,13 +41,20 @@ class cinder::params {
$ceph_init_override = '/etc/sysconfig/openstack-cinder-volume'
$lio_package_name = 'targetcli'
if $::operatingsystem == 'RedHat' and $::operatingsystemrelease >= 7 {
$iscsi_helper = 'lioadm'
} else {
$iscsi_helper = 'tgtadm'
case $::operatingsystem {
'RedHat', 'CentOS', 'Scientific', 'OracleLinux': {
if (versioncmp($::operatingsystemmajrelease, '7') >= 0) {
$iscsi_helper = 'lioadm'
} else {
$iscsi_helper = 'tgtadm'
}
}
default: {
$iscsi_helper = 'lioadm'
}
}
} else {
fail("unsuported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms")
fail("unsupported osfamily ${::osfamily}, currently Debian and Redhat are the only supported platforms")
}
}

View File

@ -0,0 +1,33 @@
# == Class: cinder::policy
#
# Configure the cinder policies
#
# === Parameters
#
# [*policies*]
# (optional) Set of policies to configure for cinder
# Example :
# {
# 'cinder-context_is_admin' => {'context_is_admin' => 'true'},
# 'cinder-default' => {'default' => 'rule:admin_or_owner'}
# }
# Defaults to empty hash.
#
# [*policy_path*]
# (optional) Path to the cinder policy.json file
# Defaults to /etc/cinder/policy.json
#
class cinder::policy (
$policies = {},
$policy_path = '/etc/cinder/policy.json',
) {
validate_hash($policies)
Openstacklib::Policy::Base {
file_path => $policy_path,
}
create_resources('openstacklib::policy::base', $policies)
}

View File

@ -1,13 +1,36 @@
# == Class: cinder::qpid
#
# class for installing qpid server for cinder
#
# === Parameters
#
class cinder::qpid(
$enabled = true,
$user='guest',
$password='guest',
$file='/var/lib/qpidd/qpidd.sasldb',
$realm='OPENSTACK'
# [*enabled*]
# (Optional) Whether to enable the qpid service.
# Defaults to 'true'.
#
# [*user*]
# (Optional) The username to use when connecting to qpid.
# Defaults to 'guest'.
#
# [*password*]
# (Optional) The password to use when connecting to qpid
# Defaults to 'guest'.
#
# [*file*]
# (Optional) The SASL database.
# Defaults to '/var/lib/qpidd/qpidd.sasldb'.
#
# [*realm*]
# (Optional) The Realm for qpid.
# Defaults to 'OPENSTACK'.
#
#
class cinder::qpid (
$enabled = true,
$user ='guest',
$password ='guest',
$file ='/var/lib/qpidd/qpidd.sasldb',
$realm ='OPENSTACK'
) {
# only configure cinder after the queue is up
@ -28,7 +51,7 @@ class cinder::qpid(
$service_ensure = 'stopped'
}
class { 'qpid::server':
class { '::qpid::server':
service_ensure => $service_ensure
}

View File

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

View File

@ -25,9 +25,11 @@
# Defaults to false
#
# [*rabbitmq_class*]
# (optional) The rabbitmq puppet class to depend on,
# (optional) Deprecated. The rabbitmq puppet class to depend on,
# which is dependent on the puppet-rabbitmq version.
# Use the default for 1.x, use 'rabbitmq' for 3.x
# Use the default for 1.x, use 'rabbitmq' for 3.x.
# Use false if rabbitmq class should not be configured
# here
# Defaults to 'rabbitmq::server'
#
class cinder::rabbitmq(
@ -36,12 +38,10 @@ class cinder::rabbitmq(
$port = '5672',
$virtual_host = '/',
$enabled = true,
# DEPRECATED PARAMETER
$rabbitmq_class = 'rabbitmq::server',
) {
# only configure cinder after the queue is up
Class[$rabbitmq_class] -> Anchor<| title == 'cinder-start' |>
if ($enabled) {
if $userid == 'guest' {
$delete_guest_user = false
@ -51,7 +51,6 @@ class cinder::rabbitmq(
admin => true,
password => $password,
provider => 'rabbitmqctl',
require => Class[$rabbitmq_class],
}
# I need to figure out the appropriate permissions
rabbitmq_user_permissions { "${userid}@${virtual_host}":
@ -66,16 +65,25 @@ class cinder::rabbitmq(
$service_ensure = 'stopped'
}
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
# NOTE(bogdando) do not cinder manage rabbitmq service
# if rabbitmq_class is set to False
if $rabbitmq_class {
warning('The rabbitmq_class parameter is deprecated.')
class { $rabbitmq_class:
service_ensure => $service_ensure,
port => $port,
delete_guest_user => $delete_guest_user,
}
Class[$rabbitmq_class] -> Rabbitmq_user<| title == $userid |>
Class[$rabbitmq_class] -> Rabbitmq_vhost<| title == $virtual_host |>
# only configure cinder after the queue is up
Class[$rabbitmq_class] -> Anchor<| title == 'cinder-start' |>
}
if ($enabled) {
rabbitmq_vhost { $virtual_host:
provider => 'rabbitmqctl',
require => Class[$rabbitmq_class],
}
}
}

View File

@ -1,3 +1,25 @@
# == Class: cinder::scheduler
#
# Scheduler class for cinder.
#
# === Parameters
#
# [*scheduler_driver*]
# (Optional) Default scheduler driver to use
# Defaults to 'false'.
#
# [*package_ensure*]
# (Optioanl) The state of the package.
# Defaults to 'present'.
#
# [*enabled*]
# (Optional) The state of the service
# Defaults to 'true'.
#
# [*manage_service*]
# (Optional) Whether to start/stop the service
# Defaults to 'true'.
#
#
class cinder::scheduler (
$scheduler_driver = false,
@ -6,7 +28,7 @@ class cinder::scheduler (
$manage_service = true
) {
include cinder::params
include ::cinder::params
Cinder_config<||> ~> Service['cinder-scheduler']
Cinder_api_paste_ini<||> ~> Service['cinder-scheduler']
@ -16,16 +38,20 @@ class cinder::scheduler (
cinder_config {
'DEFAULT/scheduler_driver': value => $scheduler_driver;
}
} else {
cinder_config {
'DEFAULT/scheduler_driver': ensure => absent;
}
}
if $::cinder::params::scheduler_package {
Package['cinder-scheduler'] -> Cinder_config<||>
Package['cinder-scheduler'] -> Cinder_api_paste_ini<||>
Package['cinder-scheduler'] ~> Service['cinder-scheduler']
Package['cinder'] ~> Service['cinder-scheduler']
Package['cinder-scheduler'] -> Service['cinder-scheduler']
package { 'cinder-scheduler':
ensure => $package_ensure,
name => $::cinder::params::scheduler_package,
tag => 'openstack',
}
}
@ -38,10 +64,10 @@ class cinder::scheduler (
}
service { 'cinder-scheduler':
ensure => $ensure,
name => $::cinder::params::scheduler_service,
enable => $enabled,
hasstatus => true,
hasrestart => true,
ensure => $ensure,
name => $::cinder::params::scheduler_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
}
}

View File

@ -0,0 +1,23 @@
# == Class: cinder:scheduler::filter
#
# This class is aim to configure cinder.scheduler filter
#
# === Parameters:
#
# [*scheduler_default_filters*]
# A comma separated list of filters to be used by default
# Defaults to false
class cinder::scheduler::filter (
$scheduler_default_filters = false,
) {
if ($scheduler_default_filters) {
cinder_config { 'DEFAULT/scheduler_default_filters': value => join($scheduler_default_filters,',')
}
} else {
cinder_config { 'DEFAULT/scheduler_default_filters': ensure => absent
}
}
}

View File

@ -13,33 +13,45 @@
# [*loopback_device*]
# Loop device name. Defaults to '/dev/loop2'.
#
# [*volume_path*]
# Volume image location. Defaults to '/var/lib/cinder'.
class cinder::setup_test_volume(
$volume_name = 'cinder-volumes',
$volume_path = '/var/lib/cinder',
$size = '4G',
$loopback_device = '/dev/loop2'
) {
Exec {
cwd => '/tmp/',
}
package { 'lvm2':
ensure => present,
} ~>
exec { "/bin/dd if=/dev/zero of=${volume_name} bs=1 count=0 seek=${size}":
unless => "/sbin/vgdisplay ${volume_name}"
file { $volume_path:
ensure => directory,
owner => 'cinder',
group => 'cinder',
require => Package['cinder'],
} ~>
exec { "/sbin/losetup ${loopback_device} ${volume_name}":
exec { "create_${volume_path}/${volume_name}":
command => "dd if=/dev/zero of=\"${volume_path}/${volume_name}\" bs=1 count=0 seek=${size}",
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
unless => "stat ${volume_path}/${volume_name}",
} ~>
exec { "losetup ${loopback_device} ${volume_path}/${volume_name}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
refreshonly => true,
} ~>
exec { "/sbin/pvcreate ${loopback_device}":
exec { "pvcreate ${loopback_device}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
unless => "pvdisplay | grep ${volume_name}",
refreshonly => true,
} ~>
exec { "/sbin/vgcreate ${volume_name} ${loopback_device}":
exec { "vgcreate ${volume_name} ${loopback_device}":
path => ['/bin','/usr/bin','/sbin','/usr/sbin'],
refreshonly => true,
}

View File

@ -1,31 +1,40 @@
# ==Define: cinder::type
# == Define: cinder::type
#
# Creates cinder type and assigns backends.
#
# === Parameters
#
# [*os_password*]
# (required) The keystone tenant:username password.
# (Required) The keystone tenant:username password.
#
# [*set_key*]
# (optional) Must be used with set_value. Accepts a single string be used
# as the key in type_set
# (Optional) Must be used with set_value. Accepts a single string be used
# as the key in type_set
# Defaults to 'undef'.
#
# [*set_value*]
# (optional) Accepts list of strings or singular string. A list of values
# passed to type_set
# passed to type_set
# Defaults to 'undef'.
#
# [*os_tenant_name*]
# (optional) The keystone tenant name. Defaults to 'admin'.
# (Optional) The keystone tenant name.
# Defaults to 'admin'.
#
# [*os_username*]
# (optional) The keystone user name. Defaults to 'admin.
# (Optional) The keystone user name.
# Defaults to 'admin.
#
# [*os_auth_url*]
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
# (Optional) The keystone auth url.
# Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*os_region_name*]
# (Optional) The keystone region name.
# Default is unset.
#
# Author: Andrew Woodward <awoodward@mirantis.com>
#
define cinder::type (
$os_password,
$set_key = undef,
@ -33,6 +42,7 @@ define cinder::type (
$os_tenant_name = 'admin',
$os_username = 'admin',
$os_auth_url = 'http://127.0.0.1:5000/v2.0/',
$os_region_name = undef,
) {
$volume_name = $name
@ -40,28 +50,38 @@ define cinder::type (
# TODO: (xarses) This should be moved to a ruby provider so that among other
# reasons, the credential discovery magic can occur like in neutron.
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
]
if $os_region_name {
$region_env = ["OS_REGION_NAME=${os_region_name}"]
}
else {
$region_env = []
}
exec {"cinder type-create ${volume_name}":
path => '/usr/bin',
command => "cinder type-create ${volume_name}",
environment => [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
],
require => Package['python-cinderclient']
unless => "cinder type-list | grep -qP '\\b${volume_name}\\b'",
environment => concat($cinder_env, $region_env),
require => Package['python-cinderclient'],
path => ['/usr/bin', '/bin'],
}
if ($set_value and $set_key) {
Exec["cinder type-create ${volume_name}"] ->
cinder::type_set { $set_value:
type => $volume_name,
key => $set_key,
os_password => $os_password,
os_tenant_name => $os_tenant_name,
os_username => $os_username,
os_auth_url => $os_auth_url,
type => $volume_name,
key => $set_key,
os_password => $os_password,
os_tenant_name => $os_tenant_name,
os_username => $os_username,
os_auth_url => $os_auth_url,
os_region_name => $os_region_name,
}
}
}
}

View File

@ -22,6 +22,9 @@
# [*os_auth_url*]
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*os_region_name*]
# (optional) The keystone region name. Default is unset.
#
# Author: Andrew Woodward <awoodward@mirantis.com>
@ -32,20 +35,31 @@ define cinder::type_set (
$os_tenant_name = 'admin',
$os_username = 'admin',
$os_auth_url = 'http://127.0.0.1:5000/v2.0/',
$os_region_name = undef,
) {
# TODO: (xarses) This should be moved to a ruby provider so that among other
# reasons, the credential discovery magic can occur like in neutron.
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
]
if $os_region_name {
$region_env = ["OS_REGION_NAME=${os_region_name}"]
}
else {
$region_env = []
}
exec {"cinder type-key ${type} set ${key}=${name}":
path => '/usr/bin',
path => ['/usr/bin', '/bin'],
command => "cinder type-key ${type} set ${key}=${name}",
environment => [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
],
unless => "cinder extra-specs-list | grep -Eq '\\b${type}\\b.*\\b${key}\\b.*\\b${name}\\b'",
environment => concat($cinder_env, $region_env),
require => Package['python-cinderclient']
}
}

View File

@ -1,20 +1,23 @@
# ==Define: cinder::vmware
# == Define: cinder::vmware
#
# Creates vmdk specific disk file type & clone type.
#
# === Parameters
#
# [*os_password*]
# (required) The keystone tenant:username password.
# (Required) The keystone tenant:username password.
#
# [*os_tenant_name*]
# (optional) The keystone tenant name. Defaults to 'admin'.
# (Optional) The keystone tenant name.
# Defaults to 'admin'.
#
# [*os_username*]
# (optional) The keystone user name. Defaults to 'admin.
# (Optional) The keystone user name.
# Defaults to 'admin.
#
# [*os_auth_url*]
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
# (Optional) The keystone auth url.
# Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
class cinder::vmware (
$os_password,
@ -50,4 +53,4 @@ class cinder::vmware (
set_value => 'linked',
set_key => 'vmware:clone_type'
}
}
}

View File

@ -1,11 +1,26 @@
# $volume_name_template = volume-%s
# == Class: cinder::volume
#
# === Parameters
#
# [*package_ensure*]
# (Optional) The state of the package.
# Defaults to 'present'.
#
# [*enabled*]
# (Optional) The state of the service
# Defaults to 'true'.
#
# [*manage_service*]
# (Optional) Whether to start/stop the service.
# Defaults to 'true'.
#
class cinder::volume (
$package_ensure = 'present',
$enabled = true,
$manage_service = true
) {
include cinder::params
include ::cinder::params
Cinder_config<||> ~> Service['cinder-volume']
Cinder_api_paste_ini<||> ~> Service['cinder-volume']
@ -15,11 +30,11 @@ class cinder::volume (
Package['cinder-volume'] -> Cinder_config<||>
Package['cinder-volume'] -> Cinder_api_paste_ini<||>
Package['cinder'] -> Package['cinder-volume']
Package['cinder-volume'] ~> Service['cinder-volume']
Package['cinder'] ~> Service['cinder-volume']
Package['cinder-volume'] -> Service['cinder-volume']
package { 'cinder-volume':
ensure => $package_ensure,
name => $::cinder::params::volume_package,
tag => 'openstack',
}
}
@ -32,10 +47,10 @@ class cinder::volume (
}
service { 'cinder-volume':
ensure => $ensure,
name => $::cinder::params::volume_service,
enable => $enabled,
hasstatus => true,
hasrestart => true,
ensure => $ensure,
name => $::cinder::params::volume_service,
enable => $enabled,
hasstatus => true,
require => Package['cinder'],
}
}

View File

@ -0,0 +1,68 @@
# == define: cinder::volume::dellsc_iscsi
#
# Configure the Dell Storage Center ISCSI driver for cinder.
#
# === Parameters
#
# [*san_ip*]
# (required) IP address of Enterprise Manager.
#
# [*san_login*]
# (required) Enterprise Manager user name.
#
# [*san_password*]
# (required) Enterprise Manager user password.
#
# [*iscsi_ip_address*]
# (required) The Storage Center iSCSI IP address.
#
# [*dell_sc_ssn*]
# (required) The Storage Center serial number to use.
#
# [*dell_sc_api_port*]
# (optional) The Enterprise Manager API port.
# Defaults to 3033
#
# [*dell_sc_server_folder*]
# (optional) Name of the server folder to use on the Storage Center.
# Defaults to 'srv'
#
# [*dell_sc_volume_folder*]
# (optional) Name of the volume folder to use on the Storage Center.
# Defaults to 'vol'
#
# [*iscsi_port*]
# (optional) The Storage Center iSCSI IP port.
# Defaults to 3260
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza.
# Defaults to: {}
# Example:
# { 'dellsc_iscsi_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::dellsc_iscsi (
$san_ip,
$san_login,
$san_password,
$iscsi_ip_address,
$dell_sc_ssn,
$dell_sc_api_port = 3033,
$dell_sc_server_folder = 'srv',
$dell_sc_volume_folder = 'vol',
$iscsi_port = 3260,
$extra_options = {},
) {
cinder::backend::dellsc_iscsi { 'DEFAULT':
san_ip => $san_ip,
san_login => $san_login,
san_password => $san_password,
iscsi_ip_address => $iscsi_ip_address,
dell_sc_ssn => $dell_sc_ssn,
dell_sc_api_port => $dell_sc_api_port,
dell_sc_server_folder => $dell_sc_server_folder,
dell_sc_volume_folder => $dell_sc_volume_folder,
iscsi_port => $iscsi_port,
extra_options => $extra_options,
}
}

View File

@ -0,0 +1,66 @@
# == Class: cinder::volume::emc_enx
#
# Configures Cinder volume EMC VNX driver.
# Parameters are particular to each volume driver.
#
# === Parameters
#
# [*package_ensure*]
# (Optional) State of the package
# Defaults to 'present'.
#
# [*iscsi_ip_address*]
# (Required) The IP address that the iSCSI daemon is listening on
#
# [*san_ip*]
# (Required) IP address of SAN controller.
#
# [*san_password*]
# (Required) Password of SAN controller.
#
# [*san_login*]
# (Optional) Login of SAN controller.
# Defaults to : 'admin'
#
# [*storage_vnx_pool_name*]
# (Required) Storage pool name.
#
# [*default_timeout*]
# (Optonal) Default timeout for CLI operations in minutes.
# Defaults to: '10'
#
# [*max_luns_per_storage_group*]
# (Optonal) Default max number of LUNs in a storage group.
# Defaults to: '256'
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'emc_vnx_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::emc_vnx(
$iscsi_ip_address,
$san_ip,
$san_password,
$storage_vnx_pool_name,
$default_timeout = '10',
$max_luns_per_storage_group = '256',
$package_ensure = 'present',
$san_login = 'admin',
$extra_options = {},
) {
cinder::backend::emc_vnx { 'DEFAULT':
default_timeout => $default_timeout,
iscsi_ip_address => $iscsi_ip_address,
max_luns_per_storage_group => $max_luns_per_storage_group,
package_ensure => $package_ensure,
san_ip => $san_ip,
san_login => $san_login,
san_password => $san_password,
storage_vnx_pool_name => $storage_vnx_pool_name,
extra_options => $extra_options,
}
}

View File

@ -15,7 +15,7 @@
#
# [*san_thin_provision*]
# (optional) Whether or not to use thin provisioning for volumes.
# Defaults to false
# Defaults to true
#
# [*eqlx_group_name*]
# (optional) The CLI prompt message without '>'.
@ -45,11 +45,17 @@
# (optional) The maximum retry count for reconnection.
# Defaults to 5
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'eqlx_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::eqlx (
$san_ip,
$san_login,
$san_password,
$san_thin_provision = false,
$san_thin_provision = true,
$eqlx_group_name = 'group-0',
$eqlx_pool = 'default',
$eqlx_use_chap = false,
@ -57,6 +63,7 @@ class cinder::volume::eqlx (
$eqlx_chap_password = '12345',
$eqlx_cli_timeout = 30,
$eqlx_cli_max_retries = 5,
$extra_options = {},
) {
cinder::backend::eqlx { 'DEFAULT':
san_ip => $san_ip,
@ -70,5 +77,6 @@ class cinder::volume::eqlx (
eqlx_chap_password => $eqlx_chap_password,
eqlx_cli_timeout => $eqlx_cli_timeout,
eqlx_cli_max_retries => $eqlx_cli_max_retries,
extra_options => $extra_options,
}
}

View File

@ -24,6 +24,12 @@
# (optional) The config file to store the given $glusterfs_shares.
# Defaults to '/etc/cinder/shares.conf'
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'glusterfs_backend/param1' => { 'value' => value1 } }
#
# === Examples
#
# class { 'cinder::volume::glusterfs':
@ -35,7 +41,8 @@ class cinder::volume::glusterfs (
$glusterfs_disk_util = false,
$glusterfs_sparsed_volumes = undef,
$glusterfs_mount_point_base = undef,
$glusterfs_shares_config = '/etc/cinder/shares.conf'
$glusterfs_shares_config = '/etc/cinder/shares.conf',
$extra_options = {},
) {
cinder::backend::glusterfs { 'DEFAULT':
@ -44,5 +51,6 @@ class cinder::volume::glusterfs (
glusterfs_sparsed_volumes => $glusterfs_sparsed_volumes,
glusterfs_mount_point_base => $glusterfs_mount_point_base,
glusterfs_shares_config => $glusterfs_shares_config,
extra_options => $extra_options,
}
}

View File

@ -0,0 +1,81 @@
# == Class: cinder::volume::hp3par
#
# Configures Cinder volume HP 3par driver.
# Parameters are particular to each volume driver.
#
# === Parameters
#
# [*volume_driver*]
# (optional) Setup cinder-volume to use HP 3par volume driver.
# Defaults to 'cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver'
#
# [*san_ip*]
# (required) IP address of HP 3par service processor.
#
# [*san_login*]
# (required) Username for HP 3par account.
#
# [*san_password*]
# (required) Password for HP 3par account.
#
# [*hp3par_api_url*]
# (required) url for api access to 3par - expample https://10.x.x.x:8080/api/v1
#
# [*hp3par_username*]
# (required) Username for HP3par admin user
#
# [*hp3par_password*]
# (required) Password for hp3par_username
#
# [*hp3par_iscsi_ips*]
# (required) iscsi ip addresses for the HP 3par array
#
# [*hp3par_iscsi_chap_enabled*]
# (required) setting to false by default
#
# [*hp3par_snap_cpg*]
# (optional) set to hp3par_cfg by default in the cinder driver
#
# [*hp3par_snapshot_retention*]
# (required) setting to 48 hours as default expiration - ensures snapshot cannot be deleted prior to expiration
#
# [*hp3par_snapshot_expiration*]
# (required) setting to 72 hours as default (must be larger than retention)
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'h3par_iscsi_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::hp3par_iscsi(
$hp3par_api_url,
$hp3par_username,
$hp3par_password,
$san_ip,
$san_login,
$san_password,
$volume_driver = 'cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver',
$hp3par_iscsi_ips,
$hp3par_iscsi_chap_enabled = false,
$hp3par_snap_cpg = OpenstackCPG,
$hp3par_snapshot_retention = 48,
$hp3par_snapshot_expiration = 72,
$extra_options = {},
) {
cinder::backend::hp3par_iscsi { 'DEFAULT':
volume_driver => $volume_driver,
hp3par_username => $hp3par_username,
hp3par_password => $hp3par_password,
san_ip => $san_ip,
san_login => $san_login,
san_password => $san_password,
hp3par_iscsi_ips => $hp3par_iscsi_ips,
hp3par_api_url => $hp3par_api_url,
hp3par_snap_cpg => $hp3par_snap_cpg,
hp3par_snapshot_retention => $hp3par_snapshot_retention,
hp3par_snapshot_expiration => $hp3par_snapshot_expiration,
extra_options => $extra_options,
}
}

View File

@ -1,13 +1,57 @@
# == Class: cinder::volume::iscsi
#
# Configures Cinder volume ISCSI driver.
#
# === Parameters
#
# [*iscsi_ip_address*]
# (Required) The IP address that the iSCSI daemon is listening on
#
# [*volume_driver*]
# (Optional) Driver to use for volume creation
# Defaults to 'cinder.volume.drivers.lvm.LVMVolumeDriver'.
#
# [*volume_group*]
# (Optional) Name for the VG that will contain exported volumes
# Defaults to 'cinder-volumes'.
#
# [*volumes_dir*]
# (Optional) Volume configuration file storage directory
# Defaults to '/var/lib/cinder/volumes'.
#
# [*iscsi_helper*]
# (Optional) iSCSI target user-land tool to use.
# Defaults to '$::cinder::params::iscsi_helper'.
#
# [*iscsi_protocol*]
# (Optional) Protocol to use as iSCSI driver
# Defaults to 'iscsi'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'iscsi_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::iscsi (
$iscsi_ip_address,
$volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver',
$volume_group = 'cinder-volumes',
$iscsi_helper = $cinder::params::iscsi_helper,
$volumes_dir = '/var/lib/cinder/volumes',
$iscsi_helper = $::cinder::params::iscsi_helper,
$iscsi_protocol = 'iscsi',
$extra_options = {},
) {
include ::cinder::params
cinder::backend::iscsi { 'DEFAULT':
iscsi_ip_address => $iscsi_ip_address,
volume_group => $volume_group,
iscsi_helper => $iscsi_helper
iscsi_ip_address => $iscsi_ip_address,
volume_driver => $volume_driver,
volume_group => $volume_group,
volumes_dir => $volumes_dir,
iscsi_helper => $iscsi_helper,
iscsi_protocol => $iscsi_protocol,
extra_options => $extra_options,
}
}

View File

@ -6,20 +6,21 @@
#
# [*netapp_login*]
# (required) Administrative user account name used to access the storage
# system.
# system or proxy server.
#
# [*netapp_password*]
# (required) Password for the administrative user account specified in the
# netapp_login parameter.
# netapp_login option.
#
# [*netapp_server_hostname*]
# (required) The hostname (or IP address) for the storage system.
# (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.
# (optional) The TCP port to use for communication with the storage
# system or proxy. If not specified, Data ONTAP drivers will use 80
# for HTTP and 443 for HTTPS; E-Series will use 8080 for HTTP and
# 8443 for HTTPS.
# Defaults to 80
#
# [*netapp_size_multiplier*]
@ -30,46 +31,48 @@
#
# [*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.
# are ontap_7mode for using Data ONTAP operating in 7-Mode, 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.
# system. Valid values are iscsi, fc, nfs.
# Defaults to nfs
#
# [*netapp_transport_type*]
# (optional) The transport protocol used when communicating with ONTAPI on the
# storage system. Valid values are http or https.
# (optional) The transport protocol used when communicating with 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 ''
# an instance with a storage family of Data ONTAP operating in 7-Mode. Only
# use this parameter when utilizing the MultiStore feature on the NetApp
# storage system.
# Defaults to undef
#
# [*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 ''
# configured to use iSCSI or FC. 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 undef
#
# [*netapp_vserver*]
# (optional) This parameter specifies the virtual storage server (Vserver)
# (optional) This option 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 ''
# should occur.
# Defaults to undef
#
# [*netapp_partner_backend_name*]
# (optional) The name of the config.conf stanza for a Data ONTAP (7-mode)
# HA partner. This option is only used by the driver when connecting to an
# instance with a storage family of Data ONTAP operating in 7-Mode, and it is
# required if the storage protocol selected is FC.
# Defaults to undef
#
# [*expiry_thres_minutes*]
# (optional) This parameter specifies the threshold for last access time for
@ -86,21 +89,31 @@
# 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.
# (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*]
# (optional) Array of NFS exports in the form of host:/share; will be written into
# file specified in nfs_shares_config
# Defaults to undef
#
# [*nfs_shares_config*]
# (optional) File with the list of available NFS shares
# Defaults to ''
# Defaults to '/etc/cinder/shares.conf'
#
# [*nfs_mount_options*]
# (optional) Mount options passed to the nfs client. See section
# of the nfs man page for details.
# Defaults to undef
#
# [*netapp_copyoffload_tool_path*]
# (optional) This option specifies the path of the NetApp Copy Offload tool
# binary. Ensure that the binary has execute permissions set which allow the
# effective user of the cinder-volume process to execute the file.
# Defaults to ''
# Defaults to undef
#
# [*netapp_controller_ips*]
# (optional) This option is only utilized when the storage family is
@ -108,18 +121,24 @@
# specified controllers. Specify the value of this option to be a comma
# separated list of controller hostnames or IP addresses to be used for
# provisioning.
# Defaults to ''
# Defaults to undef
#
# [*netapp_sa_password*]
# (optional) Password for the NetApp E-Series storage array.
# Defaults to ''
# Defaults to undef
#
# [*netapp_storage_pools*]
# (optional) This option is used to restrict provisioning to the specified
# storage pools. Only dynamic disk pools are currently supported. Specify the
# value of this option to be a comma separated list of disk pool names to be
# used for provisioning.
# Defaults to ''
# Defaults to undef
#
# [*netapp_eseries_host_type*]
# (optional) This option is used to define how the controllers in the
# E-Series storage array will work with the particular operating system on
# the hosts that are connected to it.
# Defaults to 'linux_dm_mp'
#
# [*netapp_webservice_path*]
# (optional) This option is used to specify the path to the E-Series proxy
@ -129,6 +148,12 @@
# application.
# Defaults to '/devmgr/v2'
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'netapp_backend/param1' => { 'value' => value1 } }
#
# === Examples
#
# class { 'cinder::volume::netapp':
@ -157,18 +182,23 @@ class cinder::volume::netapp (
$netapp_storage_family = 'ontap_cluster',
$netapp_storage_protocol = 'nfs',
$netapp_transport_type = 'http',
$netapp_vfiler = '',
$netapp_volume_list = '',
$netapp_vserver = '',
$netapp_vfiler = undef,
$netapp_volume_list = undef,
$netapp_vserver = undef,
$netapp_partner_backend_name = undef,
$expiry_thres_minutes = '720',
$thres_avl_size_perc_start = '20',
$thres_avl_size_perc_stop = '60',
$nfs_shares_config = '',
$netapp_copyoffload_tool_path = '',
$netapp_controller_ips = '',
$netapp_sa_password = '',
$netapp_storage_pools = '',
$nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef,
$netapp_sa_password = undef,
$netapp_storage_pools = undef,
$netapp_eseries_host_type = 'linux_dm_mp',
$netapp_webservice_path = '/devmgr/v2',
$nfs_mount_options = undef,
$extra_options = {},
) {
cinder::backend::netapp { 'DEFAULT':
@ -183,14 +213,19 @@ class cinder::volume::netapp (
netapp_vfiler => $netapp_vfiler,
netapp_volume_list => $netapp_volume_list,
netapp_vserver => $netapp_vserver,
netapp_partner_backend_name => $netapp_partner_backend_name,
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 => $nfs_shares,
nfs_shares_config => $nfs_shares_config,
netapp_copyoffload_tool_path => $netapp_copyoffload_tool_path,
netapp_controller_ips => $netapp_controller_ips,
netapp_sa_password => $netapp_sa_password,
netapp_storage_pools => $netapp_storage_pools,
netapp_eseries_host_type => $netapp_eseries_host_type,
netapp_webservice_path => $netapp_webservice_path,
nfs_mount_options => $nfs_mount_options,
extra_options => $extra_options,
}
}

View File

@ -28,6 +28,12 @@
# [*nexenta_sparse*]
# (optional) Flag to create sparse volumes. Defaults to true.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'nexenta_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::nexenta (
$nexenta_user,
$nexenta_password,
@ -36,7 +42,8 @@ class cinder::volume::nexenta (
$nexenta_target_prefix = 'iqn:',
$nexenta_target_group_prefix = 'cinder/',
$nexenta_blocksize = '8k',
$nexenta_sparse = true
$nexenta_sparse = true,
$extra_options = {},
) {
cinder::backend::nexenta { 'DEFAULT':
@ -48,5 +55,6 @@ class cinder::volume::nexenta (
nexenta_target_group_prefix => $nexenta_target_group_prefix,
nexenta_blocksize => $nexenta_blocksize,
nexenta_sparse => $nexenta_sparse,
extra_options => $extra_options,
}
}

View File

@ -1,13 +1,61 @@
# == Class: cinder::volume::nfs
#
#
# === Parameters
#
# [*nfs_servers*]
# (Required) Description
# Defaults to '[]'
#
# [*nfs_mount_options*]
# (Optional) Mount options passed to the nfs client.
# Defaults to 'undef'.
#
# [*nfs_disk_util*]
# (Optional) TODO
# Defaults to 'undef'.
#
# [*nfs_sparsed_volumes*]
# (Optional) Create volumes as sparsed files which take no space.
# If set to False volume is created as regular file.
# In such case volume creation takes a lot of time.
# Defaults to 'undef'.
#
# [*nfs_mount_point_base*]
# (Optional) Base dir containing mount points for nfs shares.
# Defaults to 'undef'.
#
# [*nfs_shares_config*]
# (Optional) File with the list of available nfs shares.
# Defaults to '/etc/cinder/shares.conf'.
#
# [*nfs_used_ratio*]
# (Optional) Percent of ACTUAL usage of the underlying volume before no new
# volumes can be allocated to the volume destination.
# Defaults to '0.95'.
#
# [*nfs_oversub_ratio*]
# (Optional) This will compare the allocated to available space on the volume
# destination. If the ratio exceeds this number, the destination will no
# longer be valid.
# Defaults to '1.0'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'nfs_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::nfs (
$nfs_servers = [],
$nfs_mount_options = undef,
$nfs_disk_util = undef,
$nfs_sparsed_volumes = undef,
$nfs_servers = [],
$nfs_mount_options = undef,
$nfs_disk_util = undef,
$nfs_sparsed_volumes = undef,
$nfs_mount_point_base = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_used_ratio = '0.95',
$nfs_oversub_ratio = '1.0',
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_used_ratio = '0.95',
$nfs_oversub_ratio = '1.0',
$extra_options = {},
) {
cinder::backend::nfs { 'DEFAULT':
@ -19,5 +67,6 @@ class cinder::volume::nfs (
nfs_shares_config => $nfs_shares_config,
nfs_used_ratio => $nfs_used_ratio,
nfs_oversub_ratio => $nfs_oversub_ratio,
extra_options => $extra_options,
}
}

View File

@ -0,0 +1,55 @@
#
# == Class: cinder::volume::quobyte
#
# Configures Cinder to use Quobyte USP as a volume driver
#
# === Parameters
#
# [*quobyte_volume_url*]
# (required) The URL of the Quobyte volume to use.
# Not an array as a Quobyte driver instance supports exactly one volume
# at a time - but you can load the driver more than once.
# Example: quobyte://quobyte.cluster.example.com/volume-name
#
# [*quobyte_client_cfg*]
# (optional) Path to a Quobyte client configuration file.
# This is needed if client certificate authentication is enabled on the
# Quobyte cluster. The config file includes the certificate and key.
#
# [*quobyte_qcow2_volumes*]
# (optional) Boolean if volumes should be created as qcow2 volumes.
# Defaults to True. qcow2 volumes allow snapshots, at the cost of a small
# performance penalty. If False, raw volumes will be used.
#
# [*quobyte_sparsed_volumes*]
# (optional) Boolean if raw volumes should be created as sparse files.
# Defaults to True. Non-sparse volumes may have a very small performance
# benefit, but take a long time to create.
#
# [*quobyte_mount_point_base*]
# (optional) Path where the driver should create mountpoints.
# Defaults to a subdirectory "mnt" under the Cinder state directory.
#
# === Examples
#
# class { 'cinder::volume::quobyte':
# quobyte_volume_url => 'quobyte://quobyte.cluster.example.com/volume-name',
# }
#
class cinder::volume::quobyte (
$quobyte_volume_url,
$quobyte_client_cfg = undef,
$quobyte_qcow2_volumes = undef,
$quobyte_sparsed_volumes = undef,
$quobyte_mount_point_base = undef,
) {
cinder::backend::quobyte { 'DEFAULT':
quobyte_volume_url => $quobyte_volume_url,
quobyte_client_cfg => $quobyte_client_cfg,
quobyte_qcow2_volumes => $quobyte_qcow2_volumes,
quobyte_sparsed_volumes => $quobyte_sparsed_volumes,
quobyte_mount_point_base => $quobyte_mount_point_base,
}
}

View File

@ -33,11 +33,11 @@
# A value of zero disables cloning
# Defaults to '5'
#
# [*glance_api_version*]
# (optional) DEPRECATED: Use cinder::glance Class instead.
# Glance API version. (Defaults to '2')
# Setting this parameter cause a duplicate resource declaration
# with cinder::glance
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'rbd_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::rbd (
$rbd_pool,
@ -47,8 +47,7 @@ class cinder::volume::rbd (
$rbd_secret_uuid = false,
$volume_tmp_dir = false,
$rbd_max_clone_depth = '5',
# DEPRECATED PARAMETERS
$glance_api_version = undef,
$extra_options = {},
) {
cinder::backend::rbd { 'DEFAULT':
@ -59,6 +58,6 @@ class cinder::volume::rbd (
rbd_secret_uuid => $rbd_secret_uuid,
volume_tmp_dir => $volume_tmp_dir,
rbd_max_clone_depth => $rbd_max_clone_depth,
glance_api_version => $glance_api_version,
extra_options => $extra_options,
}
}

View File

@ -9,38 +9,51 @@
# (required) Setup cinder-volume to use volume driver.
#
# [*san_thin_provision*]
# (optional) Use thin provisioning for SAN volumes? Defaults to true.
# (Optional) Use thin provisioning for SAN volumes?
# Defaults to true.
#
# [*san_ip*]
# (optional) IP address of SAN controller.
# (Optional) IP address of SAN controller.
#
# [*san_login*]
# (optional) Username for SAN controller. Defaults to 'admin'.
# (Optional) Username for SAN controller.
# Defaults to 'admin'.
#
# [*san_password*]
# (optional) Password for SAN controller.
# (Optional) Password for SAN controller.
#
# [*san_private_key*]
# (optional) Filename of private key to use for SSH authentication.
# (Optional) Filename of private key to use for SSH authentication.
#
# [*san_clustername*]
# (optional) Cluster name to use for creating volumes.
# (Optional) Cluster name to use for creating volumes.
#
# [*san_ssh_port*]
# (optional) SSH port to use with SAN. Defaults to 22.
# (Optional) SSH port to use with SAN.
# Defaults to 22.
#
# [*san_is_local*]
# (optional) Execute commands locally instead of over SSH
# (Optional) Execute commands locally instead of over SSH
# use if the volume service is running on the SAN device.
# Defaults to 'false'.
#
# [*ssh_conn_timeout*]
# (optional) SSH connection timeout in seconds. Defaults to 30.
# (Optional) SSH connection timeout in seconds.
# Defaults to '30'.
#
# [*ssh_min_pool_conn*]
# (optional) Minimum ssh connections in the pool.
# (Optional) Minimum ssh connections in the pool.
# Defaults to '1'.
#
# [*ssh_min_pool_conn*]
# (optional) Maximum ssh connections in the pool.
# [*ssh_max_pool_conn*]
# (Optional) Maximum ssh connections in the pool.
# Defaults to '5'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'san_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::san (
$volume_driver,
@ -54,7 +67,8 @@ class cinder::volume::san (
$san_is_local = false,
$ssh_conn_timeout = 30,
$ssh_min_pool_conn = 1,
$ssh_max_pool_conn = 5
$ssh_max_pool_conn = 5,
$extra_options = {},
) {
cinder::backend::san { 'DEFAULT':
@ -70,5 +84,6 @@ class cinder::volume::san (
ssh_conn_timeout => $ssh_conn_timeout,
ssh_min_pool_conn => $ssh_min_pool_conn,
ssh_max_pool_conn => $ssh_max_pool_conn,
extra_options => $extra_options,
}
}

View File

@ -7,7 +7,7 @@
#
# [*volume_driver*]
# (optional) Setup cinder-volume to use SolidFire volume driver.
# Defaults to 'cinder.volume.drivers.solidfire.SolidFire'
# Defaults to 'cinder.volume.drivers.solidfire.SolidFireDriver'
#
# [*san_ip*]
# (required) IP address of SolidFire clusters MVIP.
@ -34,15 +34,22 @@
# (optional) Port ID to use to connect to SolidFire API.
# Defaults to 443
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'solidfire_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::solidfire(
$san_ip,
$san_login,
$san_password,
$volume_driver = 'cinder.volume.drivers.solidfire.SolidFire',
$volume_driver = 'cinder.volume.drivers.solidfire.SolidFireDriver',
$sf_emulate_512 = true,
$sf_allow_tenant_qos = false,
$sf_account_prefix = '',
$sf_api_port = '443'
$sf_api_port = '443',
$extra_options = {},
) {
cinder::backend::solidfire { 'DEFAULT':
@ -54,5 +61,6 @@ class cinder::volume::solidfire(
sf_allow_tenant_qos => $sf_allow_tenant_qos,
sf_account_prefix => $sf_account_prefix,
sf_api_port => $sf_api_port,
extra_options => $extra_options,
}
}

View File

@ -45,7 +45,12 @@
# (optional) The name for the folder in the VC datacenter that will contain cinder volumes.
# Defaults to 'cinder-volumes'.
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
# Example :
# { 'vmdk_backend/param1' => { 'value' => value1 } }
#
class cinder::volume::vmdk(
$host_ip,
$host_username,
@ -55,7 +60,8 @@ class cinder::volume::vmdk(
$max_object_retrieval = 100,
$task_poll_interval = 5,
$image_transfer_timeout_secs = 7200,
$wsdl_location = undef
$wsdl_location = undef,
$extra_options = {},
) {
cinder::backend::vmdk { 'DEFAULT':
@ -68,5 +74,6 @@ class cinder::volume::vmdk(
task_poll_interval => $task_poll_interval,
image_transfer_timeout_secs => $image_transfer_timeout_secs,
wsdl_location => $wsdl_location,
extra_options => $extra_options,
}
}

View File

@ -0,0 +1,41 @@
{
"name": "stackforge-cinder",
"version": "5.1.0",
"author": "Puppet Labs and OpenStack Contributors",
"summary": "Puppet module for OpenStack Cinder",
"license": "Apache-2.0",
"source": "git://github.com/openstack/puppet-cinder.git",
"project_page": "https://launchpad.net/puppet-cinder",
"issues_url": "https://bugs.launchpad.net/puppet-cinder",
"requirements": [
{ "name": "pe","version_requirement": "3.x" },
{ "name": "puppet","version_requirement": "3.x" }
],
"operatingsystem_support": [
{
"operatingsystem": "Debian",
"operatingsystemrelease": ["7"]
},
{
"operatingsystem": "Fedora",
"operatingsystemrelease": ["20"]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": ["6.5","7"]
},
{
"operatingsystem": "Ubuntu",
"operatingsystemrelease": ["12.04","14.04"]
}
],
"description": "Installs and configures OpenStack Cinder (Block Storage).",
"dependencies": [
{ "name": "dprince/qpid", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
{ "name": "stackforge/keystone", "version_requirement": ">=5.0.0 <6.0.0" },
{ "name": "puppetlabs/rabbitmq", "version_requirement": ">=2.0.2 <4.0.0" },
{ "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" },
{ "name": "stackforge/openstacklib", "version_requirement": ">=5.0.0 <6.0.0" }
]
}

View File

@ -0,0 +1,128 @@
require 'spec_helper_acceptance'
describe 'basic cinder' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
Exec { logoutput => 'on_failure' }
# Common resources
case $::osfamily {
'Debian': {
include ::apt
class { '::openstack_extras::repo::debian::ubuntu':
release => 'kilo',
package_require => true,
}
$package_provider = 'apt'
}
'RedHat': {
class { '::openstack_extras::repo::redhat::redhat':
# Kilo is not GA yet, so let's use the testing repo
manage_rdo => false,
repo_hash => {
'rdo-kilo-testing' => {
'baseurl' => 'https://repos.fedorapeople.org/repos/openstack/openstack-kilo/testing/el7/',
# packages are not GA so not signed
'gpgcheck' => '0',
'priority' => 97,
},
},
}
$package_provider = 'yum'
}
default: {
fail("Unsupported osfamily (${::osfamily})")
}
}
class { '::mysql::server': }
class { '::rabbitmq':
delete_guest_user => true,
erlang_cookie => 'secrete',
package_provider => $package_provider,
}
rabbitmq_vhost { '/':
provider => 'rabbitmqctl',
require => Class['rabbitmq'],
}
rabbitmq_user { 'cinder':
admin => true,
password => 'an_even_bigger_secret',
provider => 'rabbitmqctl',
require => Class['rabbitmq'],
}
rabbitmq_user_permissions { 'cinder@/':
configure_permission => '.*',
write_permission => '.*',
read_permission => '.*',
provider => 'rabbitmqctl',
require => Class['rabbitmq'],
}
# Keystone resources, needed by Cinder to run
class { '::keystone::db::mysql':
password => 'keystone',
}
class { '::keystone':
verbose => true,
debug => true,
database_connection => 'mysql://keystone:keystone@127.0.0.1/keystone',
admin_token => 'admin_token',
enabled => true,
}
class { '::keystone::roles::admin':
email => 'test@example.tld',
password => 'a_big_secret',
}
class { '::keystone::endpoint':
public_url => "https://${::fqdn}:5000/",
admin_url => "https://${::fqdn}:35357/",
}
# Cinder resources
class { '::cinder':
database_connection => 'mysql://cinder:a_big_secret@127.0.0.1/cinder?charset=utf8',
rabbit_userid => 'cinder',
rabbit_password => 'an_even_bigger_secret',
rabbit_host => '127.0.0.1',
}
class { '::cinder::keystone::auth':
password => 'a_big_secret',
}
class { '::cinder::db::mysql':
password => 'a_big_secret',
}
class { '::cinder::api':
keystone_password => 'a_big_secret',
identity_uri => 'http://127.0.0.1:35357/',
default_volume_type => 'iscsi_backend',
}
class { '::cinder::backup': }
class { '::cinder::ceilometer': }
class { '::cinder::client': }
class { '::cinder::quota': }
class { '::cinder::scheduler': }
class { '::cinder::scheduler::filter': }
class { '::cinder::volume': }
# TODO: create a backend and spawn a volume
EOS
# Run it twice to test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe port(8776) do
it { is_expected.to be_listening.with('tcp') }
end
end
end

View File

@ -0,0 +1,9 @@
HOSTS:
ubuntu-14.04-amd64:
roles:
- master
platform: ubuntu-14.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss

View File

@ -0,0 +1,10 @@
HOSTS:
centos-70-x64:
roles:
- master
platform: el-7-x86_64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss
set_env: false

View File

@ -0,0 +1,10 @@
HOSTS:
ubuntu-14.04-amd64:
roles:
- master
platform: ubuntu-14.04-amd64
hypervisor : none
ip: 127.0.0.1
CONFIG:
type: foss
set_env: false

View File

@ -6,7 +6,8 @@ describe 'cinder::api' do
{:keystone_password => 'foo'}
end
let :facts do
{:osfamily => 'Debian'}
{:osfamily => 'Debian',
:processorcount => 8 }
end
describe 'with only required params' do
@ -14,55 +15,61 @@ describe 'cinder::api' do
req_params
end
it { should contain_service('cinder-api').with(
it { is_expected.to contain_service('cinder-api').with(
'hasstatus' => true,
'ensure' => 'running'
)}
it 'should configure cinder api correctly' do
should contain_cinder_config('DEFAULT/auth_strategy').with(
is_expected.to contain_cinder_config('DEFAULT/auth_strategy').with(
:value => 'keystone'
)
should contain_cinder_config('DEFAULT/osapi_volume_listen').with(
is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen').with(
:value => '0.0.0.0'
)
should contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
is_expected.to contain_cinder_config('DEFAULT/osapi_volume_workers').with(
:value => '8'
)
is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with(
:ensure => 'absent'
)
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
:value => 'http'
)
should contain_cinder_api_paste_ini('filter:authtoken/service_host').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_host').with(
:value => 'localhost'
)
should contain_cinder_api_paste_ini('filter:authtoken/service_port').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_port').with(
:value => '5000'
)
should contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with(
:value => 'http'
)
should contain_cinder_api_paste_ini('filter:authtoken/auth_host').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_host').with(
:value => 'localhost'
)
should contain_cinder_api_paste_ini('filter:authtoken/auth_port').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_port').with(
:value => '35357'
)
should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
:ensure => 'absent'
)
should contain_cinder_api_paste_ini('filter:authtoken/admin_tenant_name').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/admin_tenant_name').with(
:value => 'services'
)
should contain_cinder_api_paste_ini('filter:authtoken/admin_user').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/admin_user').with(
:value => 'cinder'
)
should contain_cinder_api_paste_ini('filter:authtoken/admin_password').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/admin_password').with(
:value => 'foo',
:secret => true
)
should contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://localhost:5000/'
)
should_not contain_cinder_config('DEFAULT/os_region_name')
is_expected.to_not contain_cinder_config('DEFAULT/os_region_name')
end
end
@ -71,19 +78,30 @@ describe 'cinder::api' do
req_params.merge({'os_region_name' => 'MyRegion'})
end
it 'should configure the region for nova' do
should contain_cinder_config('DEFAULT/os_region_name').with(
is_expected.to contain_cinder_config('DEFAULT/os_region_name').with(
:value => 'MyRegion'
)
end
end
describe 'with a default volume type' do
let :params do
req_params.merge({'default_volume_type' => 'foo'})
end
it 'should configure the default volume type for cinder' do
is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with(
:value => 'foo'
)
end
end
describe 'with custom auth_uri' do
let :params do
req_params.merge({'keystone_auth_uri' => 'http://foo.bar:8080/v2.0/'})
req_params.merge({'keystone_auth_uri' => 'http://localhost:8080/v2.0/'})
end
it 'should configure cinder auth_uri correctly' do
should contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://foo.bar:8080/v2.0/'
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with(
:value => 'http://localhost:8080/v2.0/'
)
end
end
@ -93,14 +111,25 @@ describe 'cinder::api' do
req_params.merge({'bind_host' => '192.168.1.3'})
end
it 'should configure cinder api correctly' do
should contain_cinder_config('DEFAULT/osapi_volume_listen').with(
is_expected.to contain_cinder_config('DEFAULT/osapi_volume_listen').with(
:value => '192.168.1.3'
)
end
end
[ '/keystone', '/keystone/admin', '' ].each do |keystone_auth_admin_prefix|
describe "with keystone_auth_admin_prefix containing incorrect value #{keystone_auth_admin_prefix}" do
describe 'with sync_db set to false' do
let :params do
{
:keystone_password => 'dummy',
:enabled => 'true',
:sync_db => false,
}
end
it { is_expected.not_to contain_exec('cinder-manage db_sync') }
end
[ '/keystone', '/keystone/admin' ].each do |keystone_auth_admin_prefix|
describe "with keystone_auth_admin_prefix containing correct value #{keystone_auth_admin_prefix}" do
let :params do
{
:keystone_auth_admin_prefix => keystone_auth_admin_prefix,
@ -108,12 +137,23 @@ describe 'cinder::api' do
}
end
it { should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
:value => keystone_auth_admin_prefix
it { is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(
:value => "#{keystone_auth_admin_prefix}"
)}
end
end
describe "with keystone_auth_admin_prefix containing correct value ''" do
let :params do
{
:keystone_auth_admin_prefix => '',
:keystone_password => 'dummy'
}
end
it { is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix')}
end
[
'/keystone/',
'keystone/',
@ -130,7 +170,7 @@ describe 'cinder::api' do
}
end
it { expect { should contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix') }.to \
it { expect { is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix') }.to \
raise_error(Puppet::Error, /validate_re\(\): "#{keystone_auth_admin_prefix}" does not match/) }
end
end
@ -140,10 +180,10 @@ describe 'cinder::api' do
req_params.merge({'enabled' => false})
end
it 'should stop the service' do
should contain_service('cinder-api').with_ensure('stopped')
is_expected.to contain_service('cinder-api').with_ensure('stopped')
end
it 'should contain db_sync exec' do
should_not contain_exec('cinder-manage db_sync')
is_expected.to contain_exec('cinder-manage db_sync')
end
end
@ -152,7 +192,10 @@ describe 'cinder::api' do
req_params.merge({'manage_service' => false})
end
it 'should not change the state of the service' do
should contain_service('cinder-api').without_ensure
is_expected.to contain_service('cinder-api').without_ensure
end
it 'should contain db_sync exec' do
is_expected.to contain_exec('cinder-manage db_sync')
end
end
@ -161,9 +204,78 @@ describe 'cinder::api' do
req_params.merge({ :ratelimits => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)' })
end
it { should contain_cinder_api_paste_ini('filter:ratelimit/limits').with(
it { is_expected.to contain_cinder_api_paste_ini('filter:ratelimit/limits').with(
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
)}
end
describe 'while validating the service with default command' do
let :params do
req_params.merge({
:validate => true,
})
end
it { is_expected.to contain_exec('execute cinder-api validation').with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:tries => '10',
:try_sleep => '2',
:command => 'cinder --os-auth-url http://localhost:5000/ --os-tenant-name services --os-username cinder --os-password foo list',
)}
it { is_expected.to contain_anchor('create cinder-api anchor').with(
:require => 'Exec[execute cinder-api validation]',
)}
end
describe 'while validating the service with custom command' do
let :params do
req_params.merge({
:validate => true,
:validation_options => { 'cinder-api' => { 'command' => 'my-script' } }
})
end
it { is_expected.to contain_exec('execute cinder-api validation').with(
:path => '/usr/bin:/bin:/usr/sbin:/sbin',
:provider => 'shell',
:tries => '10',
:try_sleep => '2',
:command => 'my-script',
)}
it { is_expected.to contain_anchor('create cinder-api anchor').with(
:require => 'Exec[execute cinder-api validation]',
)}
end
describe "with custom keystone identity_uri and auth_uri" do
let :params do
req_params.merge({
:identity_uri => 'https://localhost:35357/',
:auth_uri => 'https://localhost:5000/v2.0/',
})
end
it 'configures identity_uri and auth_uri but deprecates old auth settings' do
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/identity_uri').with_value("https://localhost:35357/");
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_uri').with_value("https://localhost:5000/v2.0/");
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_admin_prefix').with(:ensure => 'absent')
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_port').with(:ensure => 'absent')
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_port').with(:ensure => 'absent')
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_protocol').with(:ensure => 'absent')
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(:ensure => 'absent')
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/auth_host').with(:ensure => 'absent')
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_host').with(:ensure => 'absent')
end
end
describe 'when someone sets keystone_auth_uri and auth_uri' do
let :params do
req_params.merge({
:keystone_auth_uri => 'http://thisis',
:auth_uri => 'http://broken',
})
end
it_raises 'a Puppet::Error', /both keystone_auth_uri and auth_uri are set and they have the same meaning/
end
end

View File

@ -45,22 +45,19 @@ describe 'cinder::backends' do
end
it 'configures cinder.conf with default params' do
should contain_cinder_config('DEFAULT/enabled_backends').with_value(p[:enabled_backends].join(','))
should contain_cinder_config('DEFAULT/default_volume_type').with_ensure('absent')
is_expected.to contain_cinder_config('DEFAULT/enabled_backends').with_value(p[:enabled_backends].join(','))
end
end
context 'configure cinder with a default volume type' do
before :each do
params.merge!(
:enabled_backends => ['lowcost', 'regular', 'premium'],
:enabled_backends => ['foo', 'bar'],
:default_volume_type => 'regular'
)
end
it 'configures cinder.conf with default params' do
should contain_cinder_config('DEFAULT/default_volume_type').with_value('regular')
end
it_raises 'a Puppet::Error', /The default_volume_type parameter is deprecated in this class, you should declare it in cinder::api./
end
end

View File

@ -41,13 +41,13 @@ describe 'cinder::backup::ceph' do
end
it 'configures cinder.conf' do
should contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.ceph')
should contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
should contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
should contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
should contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.ceph')
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
end
context 'when overriding default parameters' do
@ -60,12 +60,12 @@ describe 'cinder::backup::ceph' do
params.merge!(:backup_ceph_stripe_count => '67')
end
it 'should replace default parameters with new values' do
should contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
should contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
should contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
should contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
should contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_conf').with_value(p[:backup_ceph_conf])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_user').with_value(p[:backup_ceph_user])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_chunk_size').with_value(p[:backup_ceph_chunk_size])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_pool').with_value(p[:backup_ceph_pool])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_unit').with_value(p[:backup_ceph_stripe_unit])
is_expected.to contain_cinder_config('DEFAULT/backup_ceph_stripe_count').with_value(p[:backup_ceph_stripe_count])
end
end
end

View File

@ -0,0 +1,83 @@
# === Author(s)
#
# Ryan Hefner <ryan.hefner@netapp.com>
#
# === Copyright
#
# Copyright (C) 2015 Ryan Hefner <ryan.hefner@netapp.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.
#
#
require 'spec_helper'
describe 'cinder::backup::nfs' do
let :params do
{
:backup_share => '10.0.0.1:/nfs_backup',
}
end
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_compression_algorithm => 'zlib',
}
end
shared_examples_for 'cinder backup with nfs' do
let :all_params do
default_params.merge(params)
end
it 'configures cinder.conf' do
all_params.each_pair do |config,value|
is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value( value )
end
end
context 'with optional parameters' do
let (:all_params) { params.merge!({
:backup_mount_options => 'sec=sys',
:backup_container => 'container',
}) }
it 'should include optional values' do
is_expected.to contain_cinder_config('DEFAULT/backup_mount_options').with_value(all_params[:backup_mount_options])
is_expected.to contain_cinder_config('DEFAULT/backup_container').with_value(all_params[:backup_container])
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'cinder backup with nfs'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'cinder backup with nfs'
end
end

View File

@ -39,28 +39,29 @@ describe 'cinder::backup' do
default_params.merge(params)
end
it { should contain_class('cinder::params') }
it { is_expected.to contain_class('cinder::params') }
it 'installs cinder backup package' do
if platform_params.has_key?(:backup_package)
should contain_package('cinder-backup').with(
is_expected.to contain_package('cinder-backup').with(
:name => platform_params[:backup_package],
:ensure => 'present'
:ensure => 'present',
:tag => 'openstack'
)
should contain_package('cinder-backup').with_before(/Cinder_config\[.+\]/)
should contain_package('cinder-backup').with_before(/Service\[cinder-backup\]/)
is_expected.to contain_package('cinder-backup').with_before(/Cinder_config\[.+\]/)
is_expected.to contain_package('cinder-backup').with_before(/Service\[cinder-backup\]/)
end
end
it 'ensure cinder backup service is running' do
should contain_service('cinder-backup').with('hasstatus' => true)
is_expected.to contain_service('cinder-backup').with('hasstatus' => true)
end
it 'configures cinder.conf' do
should contain_cinder_config('DEFAULT/backup_topic').with_value(p[:backup_topic])
should contain_cinder_config('DEFAULT/backup_manager').with_value(p[:backup_manager])
should contain_cinder_config('DEFAULT/backup_api_class').with_value(p[:backup_api_class])
should contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template])
is_expected.to contain_cinder_config('DEFAULT/backup_topic').with_value(p[:backup_topic])
is_expected.to contain_cinder_config('DEFAULT/backup_manager').with_value(p[:backup_manager])
is_expected.to contain_cinder_config('DEFAULT/backup_api_class').with_value(p[:backup_api_class])
is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template])
end
context 'when overriding backup_name_template' do
@ -68,7 +69,7 @@ describe 'cinder::backup' do
params.merge!(:backup_name_template => 'foo-bar-%s')
end
it 'should replace default parameter with new value' do
should contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template])
is_expected.to contain_cinder_config('DEFAULT/backup_name_template').with_value(p[:backup_name_template])
end
end
end
@ -92,7 +93,7 @@ describe 'cinder::backup' do
end
let :platform_params do
{ :backup_service => 'cinder-backup' }
{ :backup_service => 'opentack-cinder-backup' }
end
it_configures 'cinder backup'

View File

@ -23,11 +23,12 @@ require 'spec_helper'
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_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' }
end
let :params do
@ -40,12 +41,13 @@ describe 'cinder::backup::swift' do
end
it 'configures cinder.conf' do
should contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.swift')
should contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
should contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
should contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
should contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
should contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.swift')
is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
is_expected.to contain_cinder_config('DEFAULT/backup_compression_algorithm').with_value(p[:backup_compression_algorithm])
end
context 'when overriding default parameters' do
@ -55,13 +57,15 @@ describe 'cinder::backup::swift' do
params.merge!(:backup_swift_object_size => '123')
params.merge!(:backup_swift_retry_attempts => '99')
params.merge!(:backup_swift_retry_backoff => '56')
params.merge!(:backup_compression_algorithm => 'None')
end
it 'should replace default parameters with new values' do
should contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
should contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
should contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
should contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
should contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_url').with_value(p[:backup_swift_url])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_container').with_value(p[:backup_swift_container])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_object_size').with_value(p[:backup_swift_object_size])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_attempts').with_value(p[:backup_swift_retry_attempts])
is_expected.to contain_cinder_config('DEFAULT/backup_swift_retry_backoff').with_value(p[:backup_swift_retry_backoff])
is_expected.to contain_cinder_config('DEFAULT/backup_compression_algorithm').with_value(p[:backup_compression_algorithm])
end
end
end

View File

@ -4,7 +4,7 @@ describe 'cinder::ceilometer' do
describe 'with default parameters' do
it 'contains default values' do
should contain_cinder_config('DEFAULT/notification_driver').with(
is_expected.to contain_cinder_config('DEFAULT/notification_driver').with(
:value => 'cinder.openstack.common.notifier.rpc_notifier')
end
end

View File

@ -1,14 +1,45 @@
require 'spec_helper'
describe 'cinder::client' do
it { should contain_package('python-cinderclient').with_ensure('present') }
let :facts do
{:osfamily => 'Debian'}
let :params do
{}
end
context 'with params' do
let :params do
{:package_ensure => 'latest'}
let :default_params do
{ :package_ensure => 'present' }
end
shared_examples_for 'cinder client' do
let :p do
default_params.merge(params)
end
it { should contain_package('python-cinderclient').with_ensure('latest') }
it { is_expected.to contain_class('cinder::params') }
it 'installs cinder client package' do
is_expected.to contain_package('python-cinderclient').with(
:name => 'python-cinderclient',
:ensure => p[:package_ensure],
:tag => 'openstack'
)
end
end
context 'on Debian platform' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'cinder client'
end
context 'on RedHat platform' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'cinder client'
end
end

View File

@ -4,7 +4,7 @@ describe 'cinder::db::mysql' do
let :req_params do
{:password => 'pw',
:mysql_module => '0.9'}
}
end
let :facts do
@ -19,11 +19,12 @@ describe 'cinder::db::mysql' do
let :params do
req_params
end
it { should contain_mysql__db('cinder').with(
:user => 'cinder',
:password => 'pw',
:host => '127.0.0.1',
:charset => 'utf8'
it { is_expected.to contain_openstacklib__db__mysql('cinder').with(
:user => 'cinder',
:password_hash => '*D821809F681A40A6E379B50D0463EFAE20BDD122',
:host => '127.0.0.1',
:charset => 'utf8',
:collate => 'utf8_general_ci',
) }
end
describe "overriding allowed_hosts param to array" do
@ -34,16 +35,6 @@ describe 'cinder::db::mysql' do
}
end
it {should_not contain_cinder__db__mysql__host_access("127.0.0.1").with(
:user => 'cinder',
:password => 'cinderpass',
:database => 'cinder'
)}
it {should contain_cinder__db__mysql__host_access("%").with(
:user => 'cinder',
:password => 'cinderpass',
:database => 'cinder'
)}
end
describe "overriding allowed_hosts param to string" do
let :params do
@ -53,11 +44,6 @@ describe 'cinder::db::mysql' do
}
end
it {should contain_cinder__db__mysql__host_access("192.168.1.1").with(
:user => 'cinder',
:password => 'cinderpass2',
:database => 'cinder'
)}
end
describe "overriding allowed_hosts param equals to host param " do
@ -68,10 +54,5 @@ describe 'cinder::db::mysql' do
}
end
it {should_not contain_cinder__db__mysql__host_access("127.0.0.1").with(
:user => 'cinder',
:password => 'cinderpass2',
:database => 'cinder'
)}
end
end

View File

@ -3,24 +3,56 @@ require 'spec_helper'
describe 'cinder::db::postgresql' do
let :req_params do
{:password => 'pw'}
{ :password => 'pw' }
end
let :facts do
{
:postgres_default_version => '8.4',
:osfamily => 'RedHat',
}
let :pre_condition do
'include postgresql::server'
end
describe 'with only required params' do
let :params do
req_params
context 'on a RedHat osfamily' do
let :facts do
{
:osfamily => 'RedHat',
:operatingsystemrelease => '7.0',
:concat_basedir => '/var/lib/puppet/concat'
}
end
it { should contain_postgresql__db('cinder').with(
:user => 'cinder',
:password => 'pw'
) }
context 'with only required parameters' do
let :params do
req_params
end
it { is_expected.to contain_postgresql__server__db('cinder').with(
:user => 'cinder',
:password => 'md506736c3030793e09882cc536063d433f'
)}
end
end
context 'on a Debian osfamily' do
let :facts do
{
:operatingsystemrelease => '7.8',
:operatingsystem => 'Debian',
:osfamily => 'Debian',
:concat_basedir => '/var/lib/puppet/concat'
}
end
context 'with only required parameters' do
let :params do
req_params
end
it { is_expected.to contain_postgresql__server__db('cinder').with(
:user => 'cinder',
:password => 'md506736c3030793e09882cc536063d433f'
)}
end
end
end

View File

@ -5,7 +5,7 @@ describe 'cinder::db::sync' do
let :facts do
{:osfamily => 'Debian'}
end
it { should contain_exec('cinder-manage db_sync').with(
it { is_expected.to contain_exec('cinder-manage db_sync').with(
:command => 'cinder-manage db sync',
:path => '/usr/bin',
:user => 'cinder',

View File

@ -39,9 +39,9 @@ describe 'cinder::glance' do
end
it 'configures cinder.conf with default params' do
should contain_cinder_config('DEFAULT/glance_api_version').with_value(p[:glance_api_version])
should contain_cinder_config('DEFAULT/glance_num_retries').with_value(p[:glance_num_retries])
should contain_cinder_config('DEFAULT/glance_api_insecure').with_value(p[:glance_api_insecure])
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])
end
context 'configure cinder with one glance server' do
@ -49,7 +49,7 @@ describe 'cinder::glance' do
params.merge!(:glance_api_servers => '10.0.0.1:9292')
end
it 'should configure one glance server' do
should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers])
is_expected.to contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers])
end
end
@ -58,7 +58,7 @@ describe 'cinder::glance' do
params.merge!(:glance_api_servers => ['10.0.0.1:9292','10.0.0.2:9292'])
end
it 'should configure two glance servers' do
should contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers].join(','))
is_expected.to contain_cinder_config('DEFAULT/glance_api_servers').with_value(p[:glance_api_servers].join(','))
end
end
end

View File

@ -14,35 +14,35 @@ describe 'cinder::keystone::auth' do
it 'should contain auth info' do
should contain_keystone_user('cinder').with(
is_expected.to contain_keystone_user('cinder').with(
:ensure => 'present',
:password => 'pw',
:email => 'cinder@localhost',
:tenant => 'services'
)
should contain_keystone_user_role('cinder@services').with(
is_expected.to contain_keystone_user_role('cinder@services').with(
:ensure => 'present',
:roles => 'admin'
:roles => ['admin']
)
should contain_keystone_service('cinder').with(
is_expected.to contain_keystone_service('cinder').with(
:ensure => 'present',
:type => 'volume',
:description => 'Cinder Service'
)
should contain_keystone_service('cinderv2').with(
is_expected.to contain_keystone_service('cinderv2').with(
:ensure => 'present',
:type => 'volumev2',
:description => 'Cinder Service v2'
)
end
it { should contain_keystone_endpoint('RegionOne/cinder').with(
it { is_expected.to contain_keystone_endpoint('RegionOne/cinder').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s',
:internal_url => 'http://127.0.0.1:8776/v1/%(tenant_id)s'
) }
it { should contain_keystone_endpoint('RegionOne/cinderv2').with(
it { is_expected.to contain_keystone_endpoint('RegionOne/cinderv2').with(
:ensure => 'present',
:public_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
:admin_url => 'http://127.0.0.1:8776/v2/%(tenant_id)s',
@ -66,25 +66,88 @@ describe 'cinder::keystone::auth' do
)
end
it { should contain_keystone_endpoint('RegionThree/cinder').with(
it { is_expected.to contain_keystone_endpoint('RegionThree/cinder').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v42/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v42/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v42/%(tenant_id)s'
)}
it { is_expected.to contain_keystone_endpoint('RegionThree/cinderv2').with(
:ensure => 'present',
:public_url => 'https://10.0.42.1:4242/v2/%(tenant_id)s',
:admin_url => 'https://10.0.42.2:4242/v2/%(tenant_id)s',
:internal_url => 'https://10.0.42.3:4242/v2/%(tenant_id)s'
)}
end
describe 'when endpoint should not be configured' do
describe 'when endpoint is_expected.to not be configured' do
let :params do
req_params.merge(
:configure_endpoint => false,
:configure_endpoint_v2 => false
)
end
it { should_not contain_keystone_endpoint('RegionOne/cinder') }
it { should_not contain_keystone_endpoint('RegionOne/cinderv2') }
it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinder') }
it { is_expected.to_not contain_keystone_endpoint('RegionOne/cinderv2') }
end
describe 'when user is_expected.to not be configured' do
let :params do
req_params.merge(
:configure_user => false
)
end
it { is_expected.to_not contain_keystone_user('cinder') }
it { is_expected.to contain_keystone_user_role('cinder@services') }
it { is_expected.to contain_keystone_service('cinder').with(
:ensure => 'present',
:type => 'volume',
:description => 'Cinder Service'
) }
end
describe 'when user and user role is_expected.to not be configured' do
let :params do
req_params.merge(
:configure_user => false,
:configure_user_role => false
)
end
it { is_expected.to_not contain_keystone_user('cinder') }
it { is_expected.to_not contain_keystone_user_role('cinder@services') }
it { is_expected.to contain_keystone_service('cinder').with(
:ensure => 'present',
:type => 'volume',
:description => 'Cinder Service'
) }
end
describe 'when overriding service names' do
let :params do
req_params.merge(
:service_name => 'cinder_service',
:service_name_v2 => 'cinder_service_v2',
)
end
it { should contain_keystone_user('cinder') }
it { should contain_keystone_user_role('cinder@services') }
it { should contain_keystone_service('cinder_service') }
it { should contain_keystone_service('cinder_service_v2') }
it { should contain_keystone_endpoint('RegionOne/cinder_service') }
it { should contain_keystone_endpoint('RegionOne/cinder_service_v2') }
end
end

View File

@ -0,0 +1,107 @@
require 'spec_helper'
describe 'cinder::logging' do
let :params do
{
}
end
let :log_params do
{
:logging_context_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s',
:logging_default_format_string => '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s',
:logging_debug_format_suffix => '%(funcName)s %(pathname)s:%(lineno)d',
:logging_exception_prefix => '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s',
:log_config_append => '/etc/cinder/logging.conf',
:publish_errors => true,
:default_log_levels => {
'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
'iso8601' => 'WARN',
'requests.packages.urllib3.connectionpool' => 'WARN' },
:fatal_deprecations => true,
:instance_format => '[instance: %(uuid)s] ',
:instance_uuid_format => '[instance: %(uuid)s] ',
:log_date_format => '%Y-%m-%d %H:%M:%S',
}
end
shared_examples_for 'cinder-logging' do
context 'with extended logging options' do
before { params.merge!( log_params ) }
it_configures 'logging params set'
end
context 'without extended logging options' do
it_configures 'logging params unset'
end
end
shared_examples_for 'logging params set' do
it 'enables logging params' do
is_expected.to contain_cinder_config('DEFAULT/logging_context_format_string').with_value(
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s')
is_expected.to contain_cinder_config('DEFAULT/logging_default_format_string').with_value(
'%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s')
is_expected.to contain_cinder_config('DEFAULT/logging_debug_format_suffix').with_value(
'%(funcName)s %(pathname)s:%(lineno)d')
is_expected.to contain_cinder_config('DEFAULT/logging_exception_prefix').with_value(
'%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s')
is_expected.to contain_cinder_config('DEFAULT/log_config_append').with_value(
'/etc/cinder/logging.conf')
is_expected.to contain_cinder_config('DEFAULT/publish_errors').with_value(
true)
is_expected.to contain_cinder_config('DEFAULT/default_log_levels').with_value(
'amqp=WARN,amqplib=WARN,boto=WARN,iso8601=WARN,qpid=WARN,requests.packages.urllib3.connectionpool=WARN,sqlalchemy=WARN,suds=INFO')
is_expected.to contain_cinder_config('DEFAULT/fatal_deprecations').with_value(
true)
is_expected.to contain_cinder_config('DEFAULT/instance_format').with_value(
'[instance: %(uuid)s] ')
is_expected.to contain_cinder_config('DEFAULT/instance_uuid_format').with_value(
'[instance: %(uuid)s] ')
is_expected.to contain_cinder_config('DEFAULT/log_date_format').with_value(
'%Y-%m-%d %H:%M:%S')
end
end
shared_examples_for 'logging params unset' do
[ :logging_context_format_string, :logging_default_format_string,
:logging_debug_format_suffix, :logging_exception_prefix,
:log_config_append, :publish_errors,
:default_log_levels, :fatal_deprecations,
:instance_format, :instance_uuid_format,
:log_date_format, ].each { |param|
it { is_expected.to contain_cinder_config("DEFAULT/#{param}").with_ensure('absent') }
}
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'cinder-logging'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'cinder-logging'
end
end

View File

@ -0,0 +1,41 @@
require 'spec_helper'
describe 'cinder::policy' do
shared_examples_for 'cinder policies' do
let :params do
{
:policy_path => '/etc/cinder/policy.json',
:policies => {
'context_is_admin' => {
'key' => 'context_is_admin',
'value' => 'foo:bar'
}
}
}
end
it 'set up the policies' do
is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
:key => 'context_is_admin',
:value => 'foo:bar'
})
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'cinder policies'
end
context 'on RedHat platforms' do
let :facts do
{ :osfamily => 'RedHat' }
end
it_configures 'cinder policies'
end
end

View File

@ -11,7 +11,7 @@ describe 'cinder::qpid' do
it 'should contain all of the default resources' do
should contain_class('qpid::server').with(
is_expected.to contain_class('qpid::server').with(
:service_ensure => 'running',
:port => '5672'
)
@ -20,7 +20,7 @@ describe 'cinder::qpid' do
it 'should contain user' do
should contain_qpid_user('guest').with(
is_expected.to contain_qpid_user('guest').with(
:password => 'guest',
:file => '/var/lib/qpidd/qpidd.sasldb',
:realm => 'OPENSTACK',
@ -40,8 +40,8 @@ describe 'cinder::qpid' do
it 'should be disabled' do
should_not contain_qpid_user('guest')
should contain_class('qpid::server').with(
is_expected.to_not contain_qpid_user('guest')
is_expected.to contain_class('qpid::server').with(
:service_ensure => 'stopped'
)

View File

@ -4,13 +4,13 @@ describe 'cinder::quota' do
describe 'with default parameters' do
it 'contains default values' do
should contain_cinder_config('DEFAULT/quota_volumes').with(
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with(
:value => 10)
should contain_cinder_config('DEFAULT/quota_snapshots').with(
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with(
:value => 10)
should contain_cinder_config('DEFAULT/quota_gigabytes').with(
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with(
:value => 1000)
should contain_cinder_config('DEFAULT/quota_driver').with(
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with(
:value => 'cinder.quota.DbQuotaDriver')
end
end
@ -22,13 +22,13 @@ describe 'cinder::quota' do
:quota_gigabytes => 100000 }
end
it 'contains overrided values' do
should contain_cinder_config('DEFAULT/quota_volumes').with(
is_expected.to contain_cinder_config('DEFAULT/quota_volumes').with(
:value => 1000)
should contain_cinder_config('DEFAULT/quota_snapshots').with(
is_expected.to contain_cinder_config('DEFAULT/quota_snapshots').with(
:value => 1000)
should contain_cinder_config('DEFAULT/quota_gigabytes').with(
is_expected.to contain_cinder_config('DEFAULT/quota_gigabytes').with(
:value => 100000)
should contain_cinder_config('DEFAULT/quota_driver').with(
is_expected.to contain_cinder_config('DEFAULT/quota_driver').with(
:value => 'cinder.quota.DbQuotaDriver')
end
end

View File

@ -12,13 +12,13 @@ describe 'cinder::rabbitmq' do
it 'should contain all of the default resources' do
should contain_class('::rabbitmq').with(
is_expected.to contain_class('rabbitmq::server').with(
:service_ensure => 'running',
:port => '5672',
:delete_guest_user => false
)
should contain_rabbitmq_vhost('/').with(
is_expected.to contain_rabbitmq_vhost('/').with(
:provider => 'rabbitmqctl'
)
end
@ -36,13 +36,13 @@ describe 'cinder::rabbitmq' do
it 'should contain user and permissions' do
should contain_rabbitmq_user('dan').with(
is_expected.to contain_rabbitmq_user('dan').with(
:admin => true,
:password => 'pass',
:provider => 'rabbitmqctl'
)
should contain_rabbitmq_user_permissions('dan@/').with(
is_expected.to contain_rabbitmq_user_permissions('dan@/').with(
:configure_permission => '.*',
:write_permission => '.*',
:read_permission => '.*',
@ -64,18 +64,31 @@ describe 'cinder::rabbitmq' do
it 'should be disabled' do
should_not contain_rabbitmq_user('dan')
should_not contain_rabbitmq_user_permissions('dan@/')
should contain_class('::rabbitmq').with(
is_expected.to_not contain_rabbitmq_user('dan')
is_expected.to_not contain_rabbitmq_user_permissions('dan@/')
is_expected.to contain_class('rabbitmq::server').with(
:service_ensure => 'stopped',
:port => '5672',
:delete_guest_user => false
)
should_not contain_rabbitmq_vhost('/')
is_expected.to_not contain_rabbitmq_vhost('/')
end
end
describe 'when no rabbitmq class specified' do
let :params do
{
:rabbitmq_class => false
}
end
it 'should not contain rabbitmq class calls' do
is_expected.to_not contain_class('rabbitmq::server')
end
end
end

View File

@ -0,0 +1,17 @@
require 'spec_helper'
describe 'cinder::scheduler::filter' do
describe 'when overriding params' do
let :params do
{
:scheduler_default_filters => ['AvailabilityZoneFilter', 'CapacityFilter', 'CapabilitiesFilter']
}
end
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_default_filters').with_value('AvailabilityZoneFilter,CapacityFilter,CapabilitiesFilter') }
end
end

View File

@ -10,15 +10,17 @@ describe 'cinder::scheduler' do
describe 'with default parameters' do
it { should contain_class('cinder::params') }
it { is_expected.to contain_class('cinder::params') }
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_ensure('absent') }
it { should contain_package('cinder-scheduler').with(
:name => 'cinder-scheduler',
:ensure => 'present',
:before => 'Service[cinder-scheduler]'
it { is_expected.to contain_package('cinder-scheduler').with(
:name => 'cinder-scheduler',
:ensure => 'present',
:before => ['Cinder_config[DEFAULT/scheduler_driver]','Service[cinder-scheduler]'],
:tag => 'openstack',
) }
it { should contain_service('cinder-scheduler').with(
it { is_expected.to contain_service('cinder-scheduler').with(
:name => 'cinder-scheduler',
:enable => true,
:ensure => 'running',
@ -35,8 +37,8 @@ describe 'cinder::scheduler' do
}
end
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
it { should contain_package('cinder-scheduler').with_ensure('present') }
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
it { is_expected.to contain_package('cinder-scheduler').with_ensure('present') }
end
describe 'with manage_service false' do
@ -45,7 +47,7 @@ describe 'cinder::scheduler' do
}
end
it 'should not change the state of the service' do
should contain_service('cinder-scheduler').without_ensure
is_expected.to contain_service('cinder-scheduler').without_ensure
end
end
end
@ -59,9 +61,9 @@ describe 'cinder::scheduler' do
describe 'with default parameters' do
it { should contain_class('cinder::params') }
it { is_expected.to contain_class('cinder::params') }
it { should contain_service('cinder-scheduler').with(
it { is_expected.to contain_service('cinder-scheduler').with(
:name => 'openstack-cinder-scheduler',
:enable => true,
:ensure => 'running',
@ -75,7 +77,7 @@ describe 'cinder::scheduler' do
{ :scheduler_driver => 'cinder.scheduler.filter_scheduler.FilterScheduler' }
end
it { should contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('cinder.scheduler.filter_scheduler.FilterScheduler') }
end
end
end

View File

@ -2,14 +2,21 @@ require 'spec_helper'
describe 'cinder::setup_test_volume' do
it { should contain_package('lvm2').with(
it { is_expected.to contain_package('lvm2').with(
:ensure => 'present'
) }
it { is_expected.to contain_file('/var/lib/cinder').with(
:ensure => 'directory',
:require => 'Package[cinder]'
) }
it 'should contain volume creation execs' do
should contain_exec('/bin/dd if=/dev/zero of=cinder-volumes bs=1 count=0 seek=4G')
should contain_exec('/sbin/losetup /dev/loop2 cinder-volumes')
should contain_exec('/sbin/pvcreate /dev/loop2')
should contain_exec('/sbin/vgcreate cinder-volumes /dev/loop2')
is_expected.to contain_exec('create_/var/lib/cinder/cinder-volumes').with(
:command => 'dd if=/dev/zero of="/var/lib/cinder/cinder-volumes" bs=1 count=0 seek=4G'
)
is_expected.to contain_exec('losetup /dev/loop2 /var/lib/cinder/cinder-volumes')
is_expected.to contain_exec('pvcreate /dev/loop2')
is_expected.to contain_exec('vgcreate cinder-volumes /dev/loop2')
end
end

View File

@ -13,71 +13,42 @@ describe 'cinder' do
req_params
end
it { should contain_class('cinder::params') }
it { should contain_class('mysql::python') }
it { is_expected.to contain_class('cinder::params') }
it { is_expected.to contain_class('mysql::bindings::python') }
it 'should contain default config' do
should contain_cinder_config('DEFAULT/rpc_backend').with(
:value => 'cinder.openstack.common.rpc.impl_kombu'
)
should contain_cinder_config('DEFAULT/control_exchange').with(
:value => 'openstack'
)
should contain_cinder_config('DEFAULT/rabbit_password').with(
:value => 'guest',
:secret => true
)
should contain_cinder_config('DEFAULT/rabbit_host').with(
:value => '127.0.0.1'
)
should contain_cinder_config('DEFAULT/rabbit_port').with(
:value => '5672'
)
should contain_cinder_config('DEFAULT/rabbit_hosts').with(
:value => '127.0.0.1:5672'
)
should contain_cinder_config('DEFAULT/rabbit_ha_queues').with(
:value => false
)
should contain_cinder_config('DEFAULT/rabbit_virtual_host').with(
:value => '/'
)
should contain_cinder_config('DEFAULT/rabbit_userid').with(
:value => 'guest'
)
should contain_cinder_config('database/connection').with(
:value => 'mysql://user:password@host/database',
:secret => true
)
should contain_cinder_config('database/idle_timeout').with(
:value => '3600'
)
should contain_cinder_config('DEFAULT/verbose').with(
:value => false
)
should contain_cinder_config('DEFAULT/debug').with(
:value => false
)
should contain_cinder_config('DEFAULT/storage_availability_zone').with(
:value => 'nova'
)
should contain_cinder_config('DEFAULT/default_availability_zone').with(
:value => 'nova'
)
should contain_cinder_config('DEFAULT/api_paste_config').with(
:value => '/etc/cinder/api-paste.ini'
)
should contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder')
is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with(:value => 'cinder.openstack.common.rpc.impl_kombu')
is_expected.to contain_cinder_config('DEFAULT/control_exchange').with(:value => 'openstack')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_password').with(:value => 'guest', :secret => true)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => '127.0.0.1')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => '5672')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => '127.0.0.1:5672')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => false)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_virtual_host').with(:value => '/')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_userid').with(:value => 'guest')
is_expected.to contain_cinder_config('database/connection').with(:value => 'mysql://user:password@host/database', :secret => true)
is_expected.to contain_cinder_config('database/idle_timeout').with(:value => '3600')
is_expected.to contain_cinder_config('database/min_pool_size').with(:value => '1')
is_expected.to contain_cinder_config('database/max_pool_size').with_ensure('absent')
is_expected.to contain_cinder_config('database/max_retries').with(:value => '10')
is_expected.to contain_cinder_config('database/retry_interval').with(:value => '10')
is_expected.to contain_cinder_config('database/max_overflow').with_ensure('absent')
is_expected.to contain_cinder_config('DEFAULT/verbose').with(:value => false)
is_expected.to contain_cinder_config('DEFAULT/debug').with(:value => false)
is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => 'nova')
is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => 'nova')
is_expected.to contain_cinder_config('DEFAULT/api_paste_config').with(:value => '/etc/cinder/api-paste.ini')
is_expected.to contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder')
end
it { should contain_file('/etc/cinder/cinder.conf').with(
it { is_expected.to contain_file('/etc/cinder/cinder.conf').with(
:owner => 'cinder',
:group => 'cinder',
:mode => '0600',
:require => 'Package[cinder]'
) }
it { should contain_file('/etc/cinder/api-paste.ini').with(
it { is_expected.to contain_file('/etc/cinder/api-paste.ini').with(
:owner => 'cinder',
:group => 'cinder',
:mode => '0600',
@ -91,14 +62,10 @@ describe 'cinder' do
end
it 'should contain many' do
should_not contain_cinder_config('DEFAULT/rabbit_host')
should_not contain_cinder_config('DEFAULT/rabbit_port')
should contain_cinder_config('DEFAULT/rabbit_hosts').with(
:value => 'rabbit1:5672,rabbit2:5672'
)
should contain_cinder_config('DEFAULT/rabbit_ha_queues').with(
:value => true
)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => nil)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => nil)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => 'rabbit1:5672,rabbit2:5672')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => true)
end
end
@ -108,14 +75,10 @@ describe 'cinder' do
end
it 'should contain many' do
should_not contain_cinder_config('DEFAULT/rabbit_host')
should_not contain_cinder_config('DEFAULT/rabbit_port')
should contain_cinder_config('DEFAULT/rabbit_hosts').with(
:value => 'rabbit1:5672'
)
should contain_cinder_config('DEFAULT/rabbit_ha_queues').with(
:value => true
)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_host').with(:value => nil)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_port').with(:value => nil)
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_hosts').with(:value => 'rabbit1:5672')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_ha_queues').with(:value => true)
end
end
@ -129,21 +92,21 @@ describe 'cinder' do
}
end
it { should contain_cinder_config('database/connection').with_value('mysql://user:password@host/database') }
it { should contain_cinder_config('DEFAULT/rpc_backend').with_value('cinder.openstack.common.rpc.impl_qpid') }
it { should contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { should contain_cinder_config('DEFAULT/qpid_port').with_value('5672') }
it { should contain_cinder_config('DEFAULT/qpid_username').with_value('guest') }
it { should contain_cinder_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) }
it { should contain_cinder_config('DEFAULT/qpid_reconnect').with_value(true) }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { should contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { should contain_cinder_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { should contain_cinder_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
it { is_expected.to contain_cinder_config('database/connection').with_value('mysql://user:password@host/database') }
it { is_expected.to contain_cinder_config('DEFAULT/rpc_backend').with_value('cinder.openstack.common.rpc.impl_qpid') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_hostname').with_value('localhost') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_port').with_value('5672') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_username').with_value('guest') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_password').with_value('guest').with_secret(true) }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect').with_value(true) }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_timeout').with_value('0') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_limit').with_value('0') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval_min').with_value('0') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval_max').with_value('0') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_reconnect_interval').with_value('0') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_heartbeat').with_value('60') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_protocol').with_value('tcp') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_tcp_nodelay').with_value(true) }
end
describe 'with qpid rpc and no qpid_sasl_mechanisms' do
@ -155,7 +118,7 @@ describe 'cinder' do
}
end
it { should contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_ensure('absent') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_ensure('absent') }
end
describe 'with qpid rpc and qpid_sasl_mechanisms string' do
@ -168,7 +131,7 @@ describe 'cinder' do
}
end
it { should contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('PLAIN') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('PLAIN') }
end
describe 'with qpid rpc and qpid_sasl_mechanisms array' do
@ -181,7 +144,63 @@ describe 'cinder' do
}
end
it { should contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('DIGEST-MD5 GSSAPI PLAIN') }
it { is_expected.to contain_cinder_config('DEFAULT/qpid_sasl_mechanisms').with_value('DIGEST-MD5 GSSAPI PLAIN') }
end
describe 'with SSL enabled with kombu' do
let :params do
req_params.merge!({
:rabbit_use_ssl => true,
:kombu_ssl_ca_certs => '/path/to/ssl/ca/certs',
:kombu_ssl_certfile => '/path/to/ssl/cert/file',
:kombu_ssl_keyfile => '/path/to/ssl/keyfile',
:kombu_ssl_version => 'TLSv1'
})
end
it do
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('/path/to/ssl/ca/certs')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('/path/to/ssl/cert/file')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('/path/to/ssl/keyfile')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1')
end
end
describe 'with SSL enabled without kombu' do
let :params do
req_params.merge!({
:rabbit_use_ssl => true,
})
end
it do
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1')
end
end
describe 'with SSL disabled' do
let :params do
req_params.merge!({
:rabbit_use_ssl => false,
:kombu_ssl_ca_certs => 'undef',
:kombu_ssl_certfile => 'undef',
:kombu_ssl_keyfile => 'undef',
:kombu_ssl_version => 'TLSv1'
})
end
it do
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent')
end
end
describe 'with syslog disabled' do
@ -189,7 +208,7 @@ describe 'cinder' do
req_params
end
it { should contain_cinder_config('DEFAULT/use_syslog').with_value(false) }
it { is_expected.to contain_cinder_config('DEFAULT/use_syslog').with_value(false) }
end
describe 'with syslog enabled' do
@ -199,8 +218,8 @@ describe 'cinder' do
})
end
it { should contain_cinder_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
it { is_expected.to contain_cinder_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
end
describe 'with syslog enabled and custom settings' do
@ -211,13 +230,13 @@ describe 'cinder' do
})
end
it { should contain_cinder_config('DEFAULT/use_syslog').with_value(true) }
it { should contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
it { is_expected.to contain_cinder_config('DEFAULT/use_syslog').with_value(true) }
it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end
describe 'with log_dir disabled' do
let(:params) { req_params.merge!({:log_dir => false}) }
it { should contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') }
it { is_expected.to contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') }
end
describe 'with amqp_durable_queues disabled' do
@ -225,7 +244,7 @@ describe 'cinder' do
req_params
end
it { should contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(false) }
it { is_expected.to contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(false) }
end
describe 'with amqp_durable_queues enabled' do
@ -235,7 +254,7 @@ describe 'cinder' do
})
end
it { should contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(true) }
it { is_expected.to contain_cinder_config('DEFAULT/amqp_durable_queues').with_value(true) }
end
describe 'with postgresql' do
@ -246,12 +265,71 @@ describe 'cinder' do
}
end
it { should contain_cinder_config('database/connection').with(
it { is_expected.to contain_cinder_config('database/connection').with(
:value => 'postgresql://user:drowssap@host/database',
:secret => true
) }
it { should_not contain_class('mysql::python') }
it { should_not contain_class('mysql::bindings') }
it { should_not contain_class('mysql::bindings::python') }
it { is_expected.to_not contain_class('mysql::python') }
it { is_expected.to_not contain_class('mysql::bindings') }
it { is_expected.to_not contain_class('mysql::bindings::python') }
end
describe 'with SSL socket options set' do
let :params do
{
:use_ssl => true,
:cert_file => '/path/to/cert',
:ca_file => '/path/to/ca',
:key_file => '/path/to/key',
:rabbit_password => 'guest',
}
end
it { is_expected.to contain_cinder_config('DEFAULT/ssl_ca_file').with_value('/path/to/ca') }
it { is_expected.to contain_cinder_config('DEFAULT/ssl_cert_file').with_value('/path/to/cert') }
it { is_expected.to contain_cinder_config('DEFAULT/ssl_key_file').with_value('/path/to/key') }
end
describe 'with SSL socket options set to false' do
let :params do
{
:use_ssl => false,
:cert_file => false,
:ca_file => false,
:key_file => false,
:rabbit_password => 'guest',
}
end
it { is_expected.to contain_cinder_config('DEFAULT/ssl_ca_file').with_ensure('absent') }
it { is_expected.to contain_cinder_config('DEFAULT/ssl_cert_file').with_ensure('absent') }
it { is_expected.to contain_cinder_config('DEFAULT/ssl_key_file').with_ensure('absent') }
end
describe 'with SSL socket options set wrongly configured' do
let :params do
{
:use_ssl => true,
:ca_file => '/path/to/ca',
:key_file => '/path/to/key',
:rabbit_password => 'guest',
}
end
it_raises 'a Puppet::Error', /The cert_file parameter is required when use_ssl is set to true/
end
describe 'with APIs set for Kilo (proposed)' do
let :params do
{
:enable_v1_api => false,
:enable_v2_api => true,
:rabbit_password => 'guest',
}
end
it { should contain_cinder_config('DEFAULT/enable_v1_api').with_value(false) }
it { should contain_cinder_config('DEFAULT/enable_v2_api').with_value(true) }
end
end

View File

@ -11,23 +11,23 @@ describe 'cinder::vmware' do
describe 'with defaults' do
it 'should create vmware special types' do
should contain_cinder__type('vmware-thin').with(
is_expected.to contain_cinder__type('vmware-thin').with(
:set_key => 'vmware:vmdk_type',
:set_value => 'thin')
should contain_cinder__type('vmware-thick').with(
is_expected.to contain_cinder__type('vmware-thick').with(
:set_key => 'vmware:vmdk_type',
:set_value => 'thick')
should contain_cinder__type('vmware-eagerZeroedThick').with(
is_expected.to contain_cinder__type('vmware-eagerZeroedThick').with(
:set_key => 'vmware:vmdk_type',
:set_value => 'eagerZeroedThick')
should contain_cinder__type('vmware-full').with(
is_expected.to contain_cinder__type('vmware-full').with(
:set_key => 'vmware:clone_type',
:set_value => 'full')
should contain_cinder__type('vmware-linked').with(
is_expected.to contain_cinder__type('vmware-linked').with(
:set_key => 'vmware:clone_type',
:set_value => 'linked')
end

View File

@ -0,0 +1,57 @@
require 'spec_helper'
describe 'cinder::volume::dellsc_iscsi' do
let :params do
{
:san_ip => '172.23.8.101',
:san_login => 'Admin',
:san_password => '12345',
:iscsi_ip_address => '192.168.0.20',
:dell_sc_ssn => '64720',
}
end
let :default_params do
{
:dell_sc_api_port => 3033,
:dell_sc_server_folder => 'srv',
:dell_sc_volume_folder => 'vol',
:iscsi_port => 3260,
}
end
shared_examples_for 'dellsc_iscsi volume driver' do
let :params_hash do
default_params.merge(params)
end
it 'configures cinder volume driver' do
params_hash.each_pair do |config,value|
is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value( value )
end
end
it 'marks san_password as secret' do
is_expected.to contain_cinder_config('DEFAULT/san_password').with_secret( true )
end
end
context 'with parameters' do
it_configures 'dellsc_iscsi volume driver'
end
context 'dellsc_iscsi volume driver with additional configuration' do
before :each do
params.merge!({:extra_options => { 'dellsc_iscsi_backend/param1' => {'value' => 'value1'}}})
end
it 'configure dellsc_iscsi volume with additional configuration' do
should contain_cinder__backend__dellsc_iscsi('DEFAULT').with({
:extra_options => {'dellsc_iscsi_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -0,0 +1,46 @@
require 'spec_helper'
describe 'cinder::volume::emc_vnx' do
let :req_params do
{
:san_ip => '127.0.0.2',
:san_login => 'emc',
:san_password => 'password',
:iscsi_ip_address => '127.0.0.3',
:storage_vnx_pool_name => 'emc-storage-pool'
}
end
let :facts do
{:osfamily => 'Redhat' }
end
let :params do
req_params
end
describe 'emc vnx volume driver' do
it 'configure emc vnx volume driver' do
is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.emc.emc_cli_iscsi.EMCCLIISCSIDriver')
is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('127.0.0.2')
is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('emc')
is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password')
is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with_value('127.0.0.3')
is_expected.to contain_cinder_config('DEFAULT/storage_vnx_pool_name').with_value('emc-storage-pool')
end
end
describe 'emc vnx volume driver with additional configuration' do
before :each do
params.merge!({:extra_options => {'emc_vnx_backend/param1' => {'value' => 'value1'}}})
end
it 'configure emc vnx volume with additional configuration' do
should contain_cinder__backend__emc_vnx('DEFAULT').with({
:extra_options => {'emc_vnx_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -19,15 +19,30 @@ describe 'cinder::volume::eqlx' do
describe 'eqlx volume driver' do
it 'configures eqlx volume driver' do
should contain_cinder_config(
"DEFAULT/volume_driver").with_value(
'cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver')
should contain_cinder_config(
"DEFAULT/volume_backend_name").with_value('DEFAULT')
is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.eqlx.DellEQLSanISCSIDriver')
is_expected.to contain_cinder_config('DEFAULT/volume_backend_name').with_value('DEFAULT')
params.each_pair do |config,value|
should contain_cinder_config("DEFAULT/#{config}").with_value(value)
is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value(value)
end
end
it 'marks eqlx_chap_password as secret' do
is_expected.to contain_cinder_config('DEFAULT/eqlx_chap_password').with_secret( true )
end
end
describe 'eqlx volume driver with additional configuration' do
before :each do
params.merge!({:extra_options => {'eqlx_backend/param1' => {'value' => 'value1'}}})
end
it 'configure eqlx volume with additional configuration' do
should contain_cinder__backend__eqlx('DEFAULT').with({
:extra_options => {'eqlx_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -13,15 +13,11 @@ describe 'cinder::volume::glusterfs' do
end
it 'configures glusterfs volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value(
'cinder.volume.drivers.glusterfs.GlusterfsDriver')
should contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value(
'/etc/cinder/other_shares.conf')
should contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value(
true)
should contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value(
'/cinder_mount_point')
should contain_file('/etc/cinder/other_shares.conf').with(
is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.glusterfs.GlusterfsDriver')
is_expected.to contain_cinder_config('DEFAULT/glusterfs_shares_config').with_value('/etc/cinder/other_shares.conf')
is_expected.to contain_cinder_config('DEFAULT/glusterfs_sparsed_volumes').with_value(true)
is_expected.to contain_cinder_config('DEFAULT/glusterfs_mount_point_base').with_value('/cinder_mount_point')
is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/volumes\n10.10.10.11:/volumes\n",
:require => 'Package[cinder]',
:notify => 'Service[cinder-volume]'
@ -34,9 +30,20 @@ describe 'cinder::volume::glusterfs' do
:glusterfs_disk_util => 'foo',
})
end
it 'should fails' do
expect { subject }.to raise_error(Puppet::Error, /glusterfs_disk_util is removed in Icehouse./)
it_raises 'a Puppet::Error', /glusterfs_disk_util is removed in Icehouse./
end
context 'glusterfs volume driver with additional configuration' do
before do
params.merge!({:extra_options => {'glusterfs_backend/param1' => { 'value' => 'value1' }}})
end
it 'configure glusterfs volume with additional configuration' do
should contain_cinder__backend__glusterfs('DEFAULT').with({
:extra_options => {'glusterfs_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -0,0 +1,45 @@
require 'spec_helper'
describe 'cinder::volume::hp3par_iscsi' do
let :req_params do
{
:hp3par_api_url => 'https://172.0.0.2:8080/api/v1',
:hp3par_username => '3paradm',
:hp3par_password => 'password',
:hp3par_iscsi_ips => '172.0.0.3',
:san_ip => '172.0.0.2',
:san_login => '3paradm',
:san_password => 'password',
}
end
let :params do
req_params
end
describe 'hp3par_iscsi volume driver' do
it 'configure hp3par_iscsi volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver')
should contain_cinder_config('DEFAULT/hp3par_api_url').with_value('https://172.0.0.2:8080/api/v1')
should contain_cinder_config('DEFAULT/hp3par_username').with_value('3paradm')
should contain_cinder_config('DEFAULT/hp3par_password').with_value('password')
should contain_cinder_config('DEFAULT/hp3par_iscsi_ips').with_value('172.0.0.3')
should contain_cinder_config('DEFAULT/san_ip').with_value('172.0.0.2')
should contain_cinder_config('DEFAULT/san_login').with_value('3paradm')
should contain_cinder_config('DEFAULT/san_password').with_value('password')
end
end
describe 'hp3par_iscsi volume driver with additional configuration' do
before :each do
params.merge!({:extra_options => {'hp3par_iscsi_backend/param1' => {'value' => 'value1'}}})
end
it 'configure hp3par_iscsi volume with additional configuration' do
should contain_cinder__backend__hp3par_iscsi('DEFAULT').with({
:extra_options => {'hp3par_iscsi_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -2,10 +2,8 @@ require 'spec_helper'
describe 'cinder::volume::iscsi' do
let :req_params do {
:iscsi_ip_address => '127.0.0.2',
:iscsi_helper => 'tgtadm'
}
let :req_params do
{:iscsi_ip_address => '127.0.0.2'}
end
let :facts do
@ -18,30 +16,48 @@ describe 'cinder::volume::iscsi' do
req_params
end
it { should contain_cinder_config('DEFAULT/iscsi_ip_address').with(
:value => '127.0.0.2'
) }
it { should contain_cinder_config('DEFAULT/iscsi_helper').with(
:value => 'tgtadm'
) }
it { should contain_cinder_config('DEFAULT/volume_group').with(
:value => 'cinder-volumes'
) }
it { is_expected.to contain_cinder_config('DEFAULT/volume_driver').with(
:value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')}
it { is_expected.to contain_cinder_config('DEFAULT/iscsi_ip_address').with(:value => '127.0.0.2')}
it { is_expected.to contain_cinder_config('DEFAULT/iscsi_helper').with(:value => 'tgtadm')}
it { is_expected.to contain_cinder_config('DEFAULT/volume_group').with(:value => 'cinder-volumes')}
it { is_expected.to contain_cinder_config('DEFAULT/volumes_dir').with(:value => '/var/lib/cinder/volumes')}
it { is_expected.to contain_cinder_config('DEFAULT/iscsi_protocol').with(:value => 'iscsi')}
end
describe 'with RedHat' do
describe 'with a non-default $volumes_dir' do
let(:params) { req_params.merge(:volumes_dir => '/etc/cinder/volumes')}
it 'should contain a cinder::backend::iscsi resource with /etc/cinder/volumes as $volumes dir' do
is_expected.to contain_cinder__backend__iscsi('DEFAULT').with({
:volumes_dir => '/etc/cinder/volumes'
})
end
end
describe 'with a unsupported iscsi helper' do
let(:params) { req_params.merge(:iscsi_helper => 'fooboozoo')}
it_raises 'a Puppet::Error', /Unsupported iscsi helper: fooboozoo/
end
describe 'on RHEL Platforms' do
let :params do
req_params
end
let :facts do
{:osfamily => 'RedHat'}
{:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => 6.5,
:operatingsystemmajrelease => '6'}
end
it { should contain_file_line('cinder include').with(
:line => 'include /etc/cinder/volumes/*',
it { is_expected.to contain_file_line('cinder include').with(
:line => 'include /var/lib/cinder/volumes/*',
:path => '/etc/tgt/targets.conf'
) }
@ -51,16 +67,34 @@ describe 'cinder::volume::iscsi' do
let :params do {
:iscsi_ip_address => '127.0.0.2',
:iscsi_helper => 'lioadm'
:iscsi_helper => 'lioadm'
}
end
let :facts do
{:osfamily => 'RedHat'}
{:osfamily => 'RedHat',
:operatingsystem => 'RedHat',
:operatingsystemrelease => 7.0,
:operatingsystemmajrelease => '7'}
end
it { should contain_package('targetcli').with_ensure('present')}
it { is_expected.to contain_package('targetcli').with_ensure('present')}
it { is_expected.to contain_service('target').with(
:ensure => 'running',
:enable => 'true',
:require => 'Package[targetcli]'
) }
end
describe 'iscsi volume driver with additional configuration' do
let(:params) { req_params.merge({:extra_options => {'iscsi_backend/param1' => {'value' => 'value1'}}}) }
it 'configure iscsi volume with additional configuration' do
should contain_cinder__backend__iscsi('DEFAULT').with({
:extra_options => {'iscsi_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -4,9 +4,17 @@ describe 'cinder::volume::netapp' do
let :params do
{
:netapp_login => 'netapp',
:netapp_password => 'password',
:netapp_server_hostname => '127.0.0.2',
:netapp_login => 'netapp',
:netapp_password => 'password',
:netapp_server_hostname => '127.0.0.2',
:netapp_vfiler => 'netapp_vfiler',
:netapp_volume_list => 'vol1,vol2',
:netapp_vserver => 'netapp_vserver',
:netapp_partner_backend_name => 'fc2',
:netapp_copyoffload_tool_path => '/tmp/na_copyoffload_64',
:netapp_controller_ips => '10.0.0.2,10.0.0.3',
:netapp_sa_password => 'password',
:netapp_storage_pools => 'pool1,pool2',
}
end
@ -17,17 +25,12 @@ describe 'cinder::volume::netapp' do
: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 => '',
:netapp_copyoffload_tool_path => '',
:netapp_controller_ips => '',
:netapp_sa_password => '',
:netapp_storage_pools => '',
:nfs_shares_config => '/etc/cinder/shares.conf',
:netapp_eseries_host_type => 'linux_dm_mp',
:nfs_mount_options => nil,
:netapp_webservice_path => '/devmgr/v2',
}
end
@ -39,15 +42,19 @@ describe 'cinder::volume::netapp' do
end
it 'configures netapp volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value(
is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value(
'cinder.volume.drivers.netapp.common.NetAppDriver')
params_hash.each_pair do |config,value|
should contain_cinder_config("DEFAULT/#{config}").with_value( value )
is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value( value )
end
end
it 'marks netapp_password as secret' do
should contain_cinder_config('DEFAULT/netapp_password').with_secret( true )
is_expected.to contain_cinder_config('DEFAULT/netapp_password').with_secret( true )
end
it 'marks netapp_sa_password as secret' do
is_expected.to contain_cinder_config('DEFAULT/netapp_sa_password').with_secret( true )
end
end
@ -63,4 +70,29 @@ describe 'cinder::volume::netapp' do
context 'with provided parameters' do
it_configures 'netapp volume driver'
end
context 'with NFS shares provided' do
let (:req_params) { params.merge!({
:nfs_shares => ['10.0.0.1:/test1', '10.0.0.2:/test2'],
:nfs_shares_config => '/etc/cinder/shares.conf',
}) }
it 'writes NFS shares to file' do
is_expected.to contain_file("#{req_params[:nfs_shares_config]}")
.with_content("10.0.0.1:/test1\n10.0.0.2:/test2")
end
end
context 'with netapp volume drivers additional configuration' do
before do
params.merge!({:extra_options => {'netapp_backend/param1' => { 'value' => 'value1' }}})
end
it 'configure netapp volume with additional configuration' do
should contain_cinder__backend__netapp('DEFAULT').with({
:extra_options => {'netapp_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -8,7 +8,8 @@ describe 'cinder::volume::nexenta' do
let :params do
{ :nexenta_user => 'nexenta',
:nexenta_password => 'password',
:nexenta_host => '127.0.0.2' }
:nexenta_host => '127.0.0.2',
}
end
let :default_params do
@ -19,6 +20,7 @@ describe 'cinder::volume::nexenta' do
:nexenta_sparse => true }
end
let :facts do
{ :osfamily => 'Debian' }
end
@ -31,8 +33,26 @@ describe 'cinder::volume::nexenta' do
it 'configures nexenta volume driver' do
params_hash.each_pair do |config, value|
should contain_cinder_config("DEFAULT/#{config}").with_value(value)
is_expected.to contain_cinder_config("DEFAULT/#{config}").with_value(value)
end
end
it 'marks nexenta_password as secret' do
is_expected.to contain_cinder_config('DEFAULT/nexenta_password').with_secret( true )
end
end
context 'nexenta volume drive with additional configuration' do
before :each do
params.merge!({:extra_options => {'nexenta_backend/param1' => {'value' => 'value1'}}})
end
it 'configure nexenta volume with additional configuration' do
should contain_cinder__backend__nexenta('DEFAULT').with({
:extra_options => {'nexenta_backend/param1' => {'value' => 'value1'}}
})
end
end
end

View File

@ -17,27 +17,41 @@ describe 'cinder::volume::nfs' do
describe 'nfs volume driver' do
it 'configures nfs volume driver' do
should contain_cinder_config('DEFAULT/volume_driver').with_value(
is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value(
'cinder.volume.drivers.nfs.NfsDriver')
should contain_cinder_config('DEFAULT/nfs_shares_config').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_shares_config').with_value(
'/etc/cinder/other_shares.conf')
should contain_cinder_config('DEFAULT/nfs_mount_options').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_mount_options').with_value(
'vers=3')
should contain_cinder_config('DEFAULT/nfs_sparsed_volumes').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_sparsed_volumes').with_value(
true)
should contain_cinder_config('DEFAULT/nfs_mount_point_base').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_mount_point_base').with_value(
'/cinder_mount_point')
should contain_cinder_config('DEFAULT/nfs_disk_util').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_disk_util').with_value(
'du')
should contain_cinder_config('DEFAULT/nfs_used_ratio').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_used_ratio').with_value(
'0.95')
should contain_cinder_config('DEFAULT/nfs_oversub_ratio').with_value(
is_expected.to contain_cinder_config('DEFAULT/nfs_oversub_ratio').with_value(
'1.0')
should contain_file('/etc/cinder/other_shares.conf').with(
is_expected.to contain_file('/etc/cinder/other_shares.conf').with(
:content => "10.10.10.10:/shares\n10.10.10.10:/shares2",
:require => 'Package[cinder]',
:notify => 'Service[cinder-volume]'
)
end
end
describe 'nfs volume driver with additional configuration' do
before :each do
params.merge!({:extra_options => {'nfs_backend/param1' => {'value' => 'value1'}}})
end
it 'configure nfs volume with additional configuration' do
should contain_cinder__backend__nfs('DEFAULT').with({
:extra_options => {'nfs_backend/param1' => {'value' => 'value1'}}
})
end
end
end

Some files were not shown because too many files have changed in this diff Show More