Skip to content

Commit

Permalink
Update cinder to d6ccce6554e85ee50d926bbc413c1a1ea2ddffbf
Browse files Browse the repository at this point in the history
d6ccce6554e85ee50d926bbc413c1a1ea2ddffbf add backup compression variable
1d752f201b4d01f665d8b4016ff32a9742892578 Merge "Clean Gemfile: drop rspec-puppet and rake"
09887d1c6448db1cc0184524ad92f091689009ba Merge "Beaker tests"
4d8736b1f72b29747775e7857fd882fe831db570 Clean Gemfile: drop rspec-puppet and rake
e09f3c41ab45fe01c6b9bd56a27745cfff1fde77 Beaker tests
8edb8b6e07ac7ce64a70396f54910eda7e93406c Add support for NFS Backup
4a3bfbce84de3d20a5e8c7ec3d5bcdcd3f248bc3 Fix spec tests for RSpec 3.x and Puppet 4.x
9bb2361d4bc91418392157c08ca5282b5d9bc47d Bump rspec-puppet to 2.1.0
d85984552fd321cdac16bfd607ce955779b23bd5 Merge "Add nfs_mount_options variable when backend is NetApp"
3fec66b4614118c9b2a3fc48090ca18f1d6ffc80 Merge "MySQL: change default MySQL collate to utf8_general_ci"
08be3c0df1bce50cdc2f2f85cf0d9ea1016faca9 MySQL: change default MySQL collate to utf8_general_ci
fae6f15f8623e3a857bd60ea0ce8290d32e280eb Add nfs_mount_options variable when backend is NetApp
  • Loading branch information
xbezdick committed May 11, 2015
1 parent 5d31489 commit 38f4cf2
Show file tree
Hide file tree
Showing 19 changed files with 447 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mod 'certmonger',
:git => 'https://github.com/rcritten/puppet-certmonger.git'

mod 'cinder',
:commit => 'cc7279832bb7bd2840c831219f5f00a0f2efb8a3',
:commit => 'd6ccce6554e85ee50d926bbc413c1a1ea2ddffbf',
:git => 'https://github.com/stackforge/puppet-cinder.git'

mod 'common',
Expand Down
4 changes: 2 additions & 2 deletions cinder/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ source 'https://rubygems.org'

group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'rspec-puppet', '~> 2.1.0', :require => false

gem 'puppet-lint', '~> 1.1'
gem 'puppet-lint-param-docs', '1.1.0'
Expand All @@ -14,8 +15,7 @@ group :development, :test do
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-numericvariable'

gem 'rspec-puppet', '~> 2.0.0', :require => false
gem 'rake', '10.1.1'
gem 'beaker-rspec', '~> 2.2.4', :require => false
gem 'json'
gem 'webmock'
end
Expand Down
12 changes: 12 additions & 0 deletions cinder/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +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'].

Beaker-Rspec
------------

This module has beaker-rspec tests

To run:

``shell
bundle install
bundle exec rspec spec/acceptance
``

Development
-----------

Expand Down
16 changes: 16 additions & 0 deletions cinder/manifests/backend/netapp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
# (optional) File with the list of available NFS shares
# 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
Expand Down Expand Up @@ -188,6 +193,7 @@
$thres_avl_size_perc_stop = '60',
$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,
Expand All @@ -206,6 +212,16 @@
}
}

if $nfs_mount_options {
cinder_config {
"${volume_backend_name}/nfs_mount_options": value => $nfs_mount_options;
}
} else {
cinder_config {
"${volume_backend_name}/nfs_mount_options": ensure => absent;
}
}

cinder_config {
"${volume_backend_name}/volume_backend_name": value => $volume_backend_name;
"${volume_backend_name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';
Expand Down
106 changes: 106 additions & 0 deletions cinder/manifests/backup/nfs.pp
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
#
# === Copyright
#
# Copyright (C) 2015 Ryan Hefner <[email protected]>
#
# 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;
}

}
31 changes: 19 additions & 12 deletions cinder/manifests/backup/swift.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
# (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 <[email protected]>
Expand All @@ -51,21 +56,23 @@
#
#
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;
}

}
4 changes: 2 additions & 2 deletions cinder/manifests/db/mysql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# the database charset. Optional. Defaults to 'utf8'
#
# [*collate*]
# the database collation. Optional. Defaults to 'utf8_unicode_ci'
# the database collation. Optional. Defaults to 'utf8_general_ci'
#
# [*cluster_id*]
# (Optional) TODO
Expand All @@ -44,7 +44,7 @@
$host = '127.0.0.1',
$allowed_hosts = undef,
$charset = 'utf8',
$collate = 'utf8_unicode_ci',
$collate = 'utf8_general_ci',
$cluster_id = 'localzone',
# DEPRECATED
$mysql_module = undef,
Expand Down
7 changes: 7 additions & 0 deletions cinder/manifests/volume/netapp.pp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
# (optional) File with the list of available NFS shares
# 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
Expand Down Expand Up @@ -192,6 +197,7 @@
$netapp_storage_pools = undef,
$netapp_eseries_host_type = 'linux_dm_mp',
$netapp_webservice_path = '/devmgr/v2',
$nfs_mount_options = undef,
$extra_options = {},
) {

Expand Down Expand Up @@ -219,6 +225,7 @@
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,
}
}
113 changes: 113 additions & 0 deletions cinder/spec/acceptance/basic_cinder_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
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
include ::apt
# some packages are not autoupgraded in trusty.
# it will be fixed in liberty, but broken in kilo.
$need_to_be_upgraded = ['python-tz', 'python-pbr']
apt::source { 'trusty-updates-kilo':
location => 'http://ubuntu-cloud.archive.canonical.com/ubuntu/',
release => 'trusty-updates',
required_packages => 'ubuntu-cloud-keyring',
repos => 'kilo/main',
trusted_source => true,
} ~>
exec { '/usr/bin/apt-get -y dist-upgrade':
refreshonly => true,
}
Apt::Source['trusty-updates-kilo'] -> Package<| |>
class { '::mysql::server': }
class { '::rabbitmq':
delete_guest_user => true,
erlang_cookie => 'secrete',
}
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:[email protected]/keystone',
admin_token => 'admin_token',
enabled => true,
}
class { '::keystone::roles::admin':
email => '[email protected]',
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:[email protected]/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::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
Loading

0 comments on commit 38f4cf2

Please sign in to comment.