Add new backup driver manifests
Cinder has backup drivers for glusterfs, google, posix, and tsm that aren't yet include in puppet-cinder. This patch adds those backup drivers to the module. Change-Id: I550bd059dbd219f8428ecdc15ffe09a7d765a142 Closes-Bug: #1602454
This commit is contained in:
53
manifests/backup/glusterfs.pp
Normal file
53
manifests/backup/glusterfs.pp
Normal file
@@ -0,0 +1,53 @@
|
||||
# == Class: cinder::backup::glusterfs
|
||||
#
|
||||
# Setup Cinder to backup volumes into GlusterFS
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*backup_driver*]
|
||||
# (Optional) The backup driver for GlisterFS backend.
|
||||
# Defaults to 'cinder.backup.drivers.glusterfs'.
|
||||
#
|
||||
# [*glusterfs_backup_mount_point*]
|
||||
# (optional) Base dir container mount point for gluster share.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*glusterfs_backup_share*]
|
||||
# (optional) GlusterFS share in <homename|ipv4addr|ipv6addr>:<gluster_vol_name> format.
|
||||
# Eg: 1.2.3.4:backup_vol
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# === Author(s)
|
||||
#
|
||||
# Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# 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::glusterfs (
|
||||
$backup_driver = 'cinder.backup.drivers.glusterfs',
|
||||
$glusterfs_backup_mount_point = $::os_service_default,
|
||||
$glusterfs_backup_share = $::os_service_default,
|
||||
) {
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/backup_driver': value => $backup_driver;
|
||||
'DEFAULT/glusterfs_backup_mount_point': value => $glusterfs_backup_mount_point;
|
||||
'DEFAULT/glusterfs_backup_share': value => $glusterfs_backup_share;
|
||||
}
|
||||
|
||||
}
|
||||
123
manifests/backup/google.pp
Normal file
123
manifests/backup/google.pp
Normal file
@@ -0,0 +1,123 @@
|
||||
# == Class: cinder::backup::google
|
||||
#
|
||||
# Setup Cinder to backup volumes into Google Cloud Storage
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*backup_driver*]
|
||||
# (Optional) The backup driver for GCS back-end.
|
||||
# Defaults to 'cinder.backup.drivers.google'.
|
||||
#
|
||||
# [*backup_gcs_bucket*]
|
||||
# (optional) The GCS bucket to use.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_object_size*]
|
||||
# (optional) The size in bytes of GCS backup objects.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_block_size*]
|
||||
# (optional) The size in bytes that changes are tracked for
|
||||
# incremental backups. backup_gcs_object_size has to be a multiple
|
||||
# of backup_gcs_block_size.
|
||||
#
|
||||
# [*backup_gcs_reader_chunk_size*]
|
||||
# (optional) GCS object will be downloaded in chunks of bytes.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_writer_chunk_size*]
|
||||
# (optional) The GCS object will be uploaded in chunks of bytes.
|
||||
# Pass in a value of -1 if the file is to be uploaded as a
|
||||
# single chunk.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_num_retries*]
|
||||
# (optional) Number of times to retry.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_retry_error_codes*]
|
||||
# (optional) List of GCS error codes.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_bucket_location*]
|
||||
# (optional) Location of GCS bucket.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_storage_class*]
|
||||
# (optional) Storage class of GCS bucket.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_credential_file*]
|
||||
# (optional) Absolute path of GCS service account credential file.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_project_id*]
|
||||
# (optional) Owner project id for GCS bucket.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_user_agent*]
|
||||
# (optional) Http user-agent string for GCS API.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_gcs_enable_progress_timer*]
|
||||
# (optional) Enable or disable the timer to send the periodic
|
||||
# progress notifications to ceilometer when backing up the
|
||||
# volume to the GCS backend storage.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# === Author(s)
|
||||
#
|
||||
# Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# 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::google (
|
||||
$backup_driver = 'cinder.backup.drivers.google',
|
||||
$backup_gcs_bucket = $::os_service_default,
|
||||
$backup_gcs_object_size = $::os_service_default,
|
||||
$backup_gcs_block_size = $::os_service_default,
|
||||
$backup_gcs_reader_chunk_size = $::os_service_default,
|
||||
$backup_gcs_writer_chunk_size = $::os_service_default,
|
||||
$backup_gcs_num_retries = $::os_service_default,
|
||||
$backup_gcs_retry_error_codes = $::os_service_default,
|
||||
$backup_gcs_bucket_location = $::os_service_default,
|
||||
$backup_gcs_storage_class = $::os_service_default,
|
||||
$backup_gcs_credential_file = $::os_service_default,
|
||||
$backup_gcs_project_id = $::os_service_default,
|
||||
$backup_gcs_user_agent = $::os_service_default,
|
||||
$backup_gcs_enable_progress_timer = $::os_service_default,
|
||||
) {
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/backup_driver': value => $backup_driver;
|
||||
'DEFAULT/backup_gcs_bucket': value => $backup_gcs_bucket;
|
||||
'DEFAULT/backup_gcs_object_size': value => $backup_gcs_object_size;
|
||||
'DEFAULT/backup_gcs_block_size': value => $backup_gcs_block_size;
|
||||
'DEFAULT/backup_gcs_reader_chunk_size': value => $backup_gcs_reader_chunk_size;
|
||||
'DEFAULT/backup_gcs_writer_chunk_size': value => $backup_gcs_writer_chunk_size;
|
||||
'DEFAULT/backup_gcs_num_retries': value => $backup_gcs_num_retries;
|
||||
'DEFAULT/backup_gcs_retry_error_codes': value => $backup_gcs_retry_error_codes;
|
||||
'DEFAULT/backup_gcs_bucket_location': value => $backup_gcs_bucket_location;
|
||||
'DEFAULT/backup_gcs_storage_class': value => $backup_gcs_storage_class;
|
||||
'DEFAULT/backup_gcs_credential_file': value => $backup_gcs_credential_file;
|
||||
'DEFAULT/backup_gcs_project_id': value => $backup_gcs_project_id;
|
||||
'DEFAULT/backup_gcs_user_agent': value => $backup_gcs_user_agent;
|
||||
'DEFAULT/backup_gcs_enable_project_timer': value => $backup_gcs_enable_progress_timer;
|
||||
}
|
||||
|
||||
}
|
||||
74
manifests/backup/posix.pp
Normal file
74
manifests/backup/posix.pp
Normal file
@@ -0,0 +1,74 @@
|
||||
# == Class: cinder::backup::posix
|
||||
#
|
||||
# Setup Cinder to backup volumes into a posix filesystem
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*backup_driver*]
|
||||
# (Optional) The backup driver for posix backend.
|
||||
# Defaults to 'cinder.backup.drivers.posix'.
|
||||
#
|
||||
# [*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. backup_file_size must be a multiple of
|
||||
# backup_sha_block_size_bytes.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_sha_block_size_bytes*]
|
||||
# (optional) The size in bytes that changes are tracked for incremental
|
||||
# backups. backup_file_size has to be a multiple of backup_sha_block_size_bytes.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_enable_progress_timer*]
|
||||
# (optional) Enable or Disable the timer to send the periodic progress
|
||||
# notifications to Ceilometer when backing up the volume to the backend
|
||||
# storage.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_posix_path*]
|
||||
# (optional) Path specifying where to store backups.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_container*]
|
||||
# (optional) Custom directory to use for backups.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# === Author(s)
|
||||
#
|
||||
# Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# 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::posix (
|
||||
$backup_driver = 'cinder.backup.drivers.posix',
|
||||
$backup_file_size = $::os_service_default,
|
||||
$backup_sha_block_size_bytes = $::os_service_default,
|
||||
$backup_posix_path = $::os_service_default,
|
||||
$backup_container = $::os_service_default,
|
||||
) {
|
||||
|
||||
cinder_config {
|
||||
'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_posix_path': value => $backup_posix_path;
|
||||
'DEFAULT/backup_container': value => $backup_container;
|
||||
}
|
||||
|
||||
}
|
||||
58
manifests/backup/tsm.pp
Normal file
58
manifests/backup/tsm.pp
Normal file
@@ -0,0 +1,58 @@
|
||||
# == Class: cinder::backup::tsm
|
||||
#
|
||||
# Setup Cinder to backup volumes into the Tivoli Storage Manager (TSM)
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*backup_driver*]
|
||||
# (Optional) The backup driver for tsm backend.
|
||||
# Defaults to 'cinder.backup.drivers.tsm'.
|
||||
#
|
||||
# [*backup_tsm_volume_prefix*]
|
||||
# (optional) Volume prefix for the backup id when backing up to TSM.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_tsm_password*]
|
||||
# (optional) TSM password for the running username.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*backup_tsm_compression*]
|
||||
# (optional) Enable or Disable compression for backups.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# === Author(s)
|
||||
#
|
||||
# Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# === Copyright
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# 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::tsm (
|
||||
$backup_driver = 'cinder.backup.drivers.tsm',
|
||||
$backup_tsm_volume_prefix = $::os_service_default,
|
||||
$backup_tsm_password = $::os_service_default,
|
||||
$backup_tsm_compression = $::os_service_default,
|
||||
) {
|
||||
|
||||
cinder_config {
|
||||
'DEFAULT/backup_driver': value => $backup_driver;
|
||||
'DEFAULT/backup_tsm_volume_prefix': value => $backup_tsm_volume_prefix;
|
||||
'DEFAULT/backup_tsm_password': value => $backup_tsm_password;
|
||||
'DEFAULT/backup_tsm_compression': value => $backup_tsm_compression;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- Added new manifests to configure cinder backup drivers
|
||||
for GlusterFS, Google Cloud Storage, Posix filesystem,
|
||||
and Tivoli Storage Manager.
|
||||
69
spec/classes/cinder_backup_glusterfs_spec.rb
Normal file
69
spec/classes/cinder_backup_glusterfs_spec.rb
Normal file
@@ -0,0 +1,69 @@
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# Author: Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for cinder::backup:glusterfs class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::backup::glusterfs' do
|
||||
|
||||
let :default_params do
|
||||
{ :glusterfs_backup_mount_point => '<SERVICE DEFAULT>',
|
||||
:glusterfs_backup_share => '<SERVICE DEFAULT>' }
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'cinder backup with glusterfs' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'configures cinder.conf' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.glusterfs')
|
||||
is_expected.to contain_cinder_config('DEFAULT/glusterfs_backup_mount_point').with_value(p[:glusterfs_backup_mount_point])
|
||||
is_expected.to contain_cinder_config('DEFAULT/glusterfs_backup_share').with_value(p[:glusterfs_backup_share])
|
||||
end
|
||||
|
||||
context 'when overriding default parameters' do
|
||||
before :each do
|
||||
params.merge!(:glusterfs_backup_mount_point => '/usr/backup_mount')
|
||||
params.merge!(:glusterfs_backup_share => '1.2.3.4:backup_vol')
|
||||
end
|
||||
it 'should replace default parameters with new values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/glusterfs_backup_mount_point').with_value(p[:glusterfs_backup_mount_point])
|
||||
is_expected.to contain_cinder_config('DEFAULT/glusterfs_backup_share').with_value(p[:glusterfs_backup_share])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
|
||||
end
|
||||
|
||||
it_configures 'cinder backup with glusterfs'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
113
spec/classes/cinder_backup_google_spec.rb
Normal file
113
spec/classes/cinder_backup_google_spec.rb
Normal file
@@ -0,0 +1,113 @@
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# Author: Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for cinder::backup::google class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::backup::google' do
|
||||
|
||||
let :default_params do
|
||||
{ :backup_gcs_bucket => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_object_size => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_block_size => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_reader_chunk_size => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_writer_chunk_size => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_num_retries => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_retry_error_codes => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_bucket_location => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_storage_class => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_credential_file => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_project_id => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_user_agent => '<SERVICE DEFAULT>',
|
||||
:backup_gcs_enable_progress_timer => '<SERVICE DEFAULT>' }
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'cinder backup with google cloud storage' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'configures cinder.conf' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.google')
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_bucket').with_value(p[:backup_gcs_bucket])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_object_size').with_value(p[:backup_gcs_object_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_block_size').with_value(p[:backup_gcs_block_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_reader_chunk_size').with_value(p[:backup_gcs_reader_chunk_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_writer_chunk_size').with_value(p[:backup_gcs_writer_chunk_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_num_retries').with_value(p[:backup_gcs_num_retries])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_retry_error_codes').with_value(p[:backup_gcs_retry_error_codes])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_bucket_location').with_value(p[:backup_gcs_bucket_location])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_storage_class').with_value(p[:backup_gcs_storage_class])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_credential_file').with_value(p[:backup_gcs_credential_file])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_project_id').with_value(p[:backup_gcs_project_id])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_user_agent').with_value(p[:backup_gcs_user_agent])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_enable_project_timer').with_value(p[:backup_gcs_enable_progress_timer])
|
||||
end
|
||||
|
||||
context 'when overriding default parameters' do
|
||||
before :each do
|
||||
params.merge!(:backup_gcs_bucket => 'bigbucket')
|
||||
params.merge!(:backup_gcs_object_size => '1992')
|
||||
params.merge!(:backup_gcs_block_size => '12')
|
||||
params.merge!(:backup_gcs_reader_chunk_size => '27')
|
||||
params.merge!(:backup_gcs_writer_chunk_size => '-1')
|
||||
params.merge!(:backup_gcs_num_retries => '42')
|
||||
params.merge!(:backup_gcs_retry_error_codes => '430')
|
||||
params.merge!(:backup_gcs_bucket_location => 'NO')
|
||||
params.merge!(:backup_gcs_storage_class => 'FARLINE')
|
||||
params.merge!(:backup_gcs_credential_file => '/etc/file')
|
||||
params.merge!(:backup_gcs_project_id => 'me')
|
||||
params.merge!(:backup_gcs_user_agent => '007')
|
||||
params.merge!(:backup_gcs_enable_progress_timer => 'false')
|
||||
end
|
||||
it 'should replace default parameters with new values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_bucket').with_value(p[:backup_gcs_bucket])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_object_size').with_value(p[:backup_gcs_object_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_block_size').with_value(p[:backup_gcs_block_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_reader_chunk_size').with_value(p[:backup_gcs_reader_chunk_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_writer_chunk_size').with_value(p[:backup_gcs_writer_chunk_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_num_retries').with_value(p[:backup_gcs_num_retries])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_retry_error_codes').with_value(p[:backup_gcs_retry_error_codes])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_bucket_location').with_value(p[:backup_gcs_bucket_location])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_storage_class').with_value(p[:backup_gcs_storage_class])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_credential_file').with_value(p[:backup_gcs_credential_file])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_project_id').with_value(p[:backup_gcs_project_id])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_user_agent').with_value(p[:backup_gcs_user_agent])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_gcs_enable_project_timer').with_value(p[:backup_gcs_enable_progress_timer])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
|
||||
end
|
||||
|
||||
it_configures 'cinder backup with google cloud storage'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
78
spec/classes/cinder_backup_posix_spec.rb
Normal file
78
spec/classes/cinder_backup_posix_spec.rb
Normal file
@@ -0,0 +1,78 @@
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# Author: Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for cinder::backup:posix class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::backup::posix' do
|
||||
|
||||
let :default_params do
|
||||
{ :backup_file_size => '<SERVICE DEFAULT>',
|
||||
:backup_sha_block_size_bytes => '<SERVICE DEFAULT>',
|
||||
:backup_enable_progress_timer => '<SERVICE DEFAULT>',
|
||||
:backup_posix_path => '<SERVICE DEFAULT>',
|
||||
:backup_container => '<SERVICE DEFAULT>' }
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'cinder backup with posix' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'configures cinder.conf' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.posix')
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_file_size').with_value(p[:backup_file_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_sha_block_size_bytes').with_value(p[:backup_sha_block_size_bytes])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_posix_path').with_value(p[:backup_posix_path])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_container').with_value(p[:backup_container])
|
||||
end
|
||||
|
||||
context 'when overriding default parameters' do
|
||||
before :each do
|
||||
params.merge!(:backup_file_size => '4')
|
||||
params.merge!(:backup_sha_block_size_bytes => '2')
|
||||
params.merge!(:backup_posix_path => '/etc/backup')
|
||||
params.merge!(:backup_container => 'mycontainer')
|
||||
end
|
||||
it 'should replace default parameters with new values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_file_size').with_value(p[:backup_file_size])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_sha_block_size_bytes').with_value(p[:backup_sha_block_size_bytes])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_posix_path').with_value(p[:backup_posix_path])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_container').with_value(p[:backup_container])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
|
||||
end
|
||||
|
||||
it_configures 'cinder backup with posix'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
73
spec/classes/cinder_backup_tsm_spec.rb
Normal file
73
spec/classes/cinder_backup_tsm_spec.rb
Normal file
@@ -0,0 +1,73 @@
|
||||
#
|
||||
# Copyright (C) 2016 Intel
|
||||
#
|
||||
# Author: Nate Potter <nathaniel.potter@intel.com>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
# Unit tests for cinder::backup:tsm class
|
||||
#
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::backup::tsm' do
|
||||
|
||||
let :default_params do
|
||||
{ :backup_tsm_volume_prefix => '<SERVICE DEFAULT>',
|
||||
:backup_tsm_password => '<SERVICE DEFAULT>',
|
||||
:backup_tsm_compression => '<SERVICE DEFAULT>' }
|
||||
end
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
shared_examples_for 'cinder backup with tsm' do
|
||||
let :p do
|
||||
default_params.merge(params)
|
||||
end
|
||||
|
||||
it 'configures cinder.conf' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_driver').with_value('cinder.backup.drivers.tsm')
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_tsm_volume_prefix').with_value(p[:backup_tsm_volume_prefix])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_tsm_password').with_value(p[:backup_tsm_password])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_tsm_compression').with_value(p[:backup_tsm_compression])
|
||||
end
|
||||
|
||||
context 'when overriding default parameters' do
|
||||
before :each do
|
||||
params.merge!(:backup_tsm_volume_prefix => 'vol-')
|
||||
params.merge!(:backup_tsm_password => 'secrete')
|
||||
params.merge!(:backup_tsm_compression => 'False')
|
||||
end
|
||||
it 'should replace default parameters with new values' do
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_tsm_volume_prefix').with_value(p[:backup_tsm_volume_prefix])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_tsm_password').with_value(p[:backup_tsm_password])
|
||||
is_expected.to contain_cinder_config('DEFAULT/backup_tsm_compression').with_value(p[:backup_tsm_compression])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
|
||||
end
|
||||
|
||||
it_configures 'cinder backup with tsm'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user