multi rbd: add opts, deprecate glance_api_version
- Add all cinder rbd params (multi-backends) - Update documentation/tests - Deprecate glance_api_version to avoid duplicate definition with cinder::glance class. (use glance_api_version of cinder::glance class instead.) Change-Id: I957d81647cd0320a52be00dceff23692ba208017
This commit is contained in:
parent
1e6463cbbc
commit
dda201af2a
@ -15,35 +15,70 @@
|
||||
# (optional) Allows for the volume_backend_name to be separate of $name.
|
||||
# Defaults to: $name
|
||||
#
|
||||
# [*glance_api_version*]
|
||||
# (required) Required for Ceph functionality.
|
||||
# [*rbd_ceph_conf*]
|
||||
# (optional) Path to the ceph configuration file to use
|
||||
# Defaults to '/etc/ceph/ceph.conf'
|
||||
#
|
||||
# [*rbd_flatten_volume_from_snapshot*]
|
||||
# (optional) Enable flatten volumes created from snapshots.
|
||||
# Defaults to false
|
||||
#
|
||||
# [*rbd_secret_uuid*]
|
||||
# (optional) A required parameter to use cephx.
|
||||
# Defaults to false
|
||||
#
|
||||
# [*volume_tmp_dir*]
|
||||
# (optional) Location to store temporary image files if the volume
|
||||
# driver does not write them directly to the volume
|
||||
# Defaults to false
|
||||
#
|
||||
# [*rbd_max_clone_depth*]
|
||||
# (optional) Maximum number of nested clones that can be taken of a
|
||||
# volume before enforcing a flatten prior to next clone.
|
||||
# A value of zero disables cloning
|
||||
# Defaults to '5'
|
||||
#
|
||||
# [*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
|
||||
#
|
||||
|
||||
define cinder::backend::rbd (
|
||||
$rbd_pool,
|
||||
$rbd_user,
|
||||
$volume_backend_name = $name,
|
||||
$glance_api_version = '2',
|
||||
$rbd_ceph_conf = '/etc/ceph/ceph.conf',
|
||||
$rbd_flatten_volume_from_snapshot = false,
|
||||
$rbd_secret_uuid = false,
|
||||
$volume_tmp_dir = false,
|
||||
$rbd_max_clone_depth = '5',
|
||||
# DEPRECATED PARAMETERS
|
||||
$glance_api_version = undef,
|
||||
) {
|
||||
|
||||
include cinder::params
|
||||
|
||||
if $glance_api_version {
|
||||
warning('The glance_api_version parameter is deprecated, use glance_api_version of cinder::glance class instead.')
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
"${name}/volume_backend_name": value => $volume_backend_name;
|
||||
"${name}/volume_driver": value =>
|
||||
'cinder.volume.drivers.rbd.RBDDriver';
|
||||
"${name}/glance_api_version": value => $glance_api_version;
|
||||
"${name}/volume_driver": value => 'cinder.volume.drivers.rbd.RBDDriver';
|
||||
"${name}/rbd_ceph_conf": value => $rbd_ceph_conf;
|
||||
"${name}/rbd_user": value => $rbd_user;
|
||||
"${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;
|
||||
}
|
||||
|
||||
if $rbd_secret_uuid {
|
||||
cinder_config {
|
||||
"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;
|
||||
cinder_config {"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;}
|
||||
}
|
||||
|
||||
if $volume_tmp_dir {
|
||||
cinder_config {"${name}/volume_tmp_dir": value => $volume_tmp_dir;}
|
||||
}
|
||||
|
||||
case $::osfamily {
|
||||
|
@ -2,14 +2,19 @@ require 'spec_helper'
|
||||
|
||||
describe 'cinder::backend::rbd' do
|
||||
|
||||
let (:title) {'hippo'}
|
||||
let (:title) {'rbd-ssd'}
|
||||
|
||||
let :req_params do
|
||||
{
|
||||
:volume_backend_name => 'rbd-ssd',
|
||||
:rbd_pool => 'volumes',
|
||||
:glance_api_version => '2',
|
||||
:rbd_user => 'test',
|
||||
:rbd_secret_uuid => '0123456789',
|
||||
:rbd_ceph_conf => '/foo/boo/zoo/ceph.conf',
|
||||
:rbd_flatten_volume_from_snapshot => true,
|
||||
:volume_tmp_dir => '/foo/tmp',
|
||||
:rbd_max_clone_depth => '0'
|
||||
}
|
||||
end
|
||||
|
||||
@ -23,22 +28,18 @@ describe 'cinder::backend::rbd' do
|
||||
{:osfamily => 'Debian'}
|
||||
end
|
||||
|
||||
describe 'rbd volume driver' do
|
||||
|
||||
describe 'rbd backend volume driver' do
|
||||
it 'configure rbd volume driver' do
|
||||
should contain_cinder_config('hippo/volume_backend_name').with(
|
||||
:value => 'hippo')
|
||||
should contain_cinder_config('hippo/volume_driver').with_value(
|
||||
'cinder.volume.drivers.rbd.RBDDriver')
|
||||
should contain_cinder_config('hippo/rbd_pool').with_value(
|
||||
'volumes')
|
||||
should contain_cinder_config('hippo/rbd_user').with_value(
|
||||
'test')
|
||||
should contain_cinder_config('hippo/rbd_secret_uuid').with_value(
|
||||
'0123456789')
|
||||
should contain_file('/etc/init/cinder-volume.override').with(
|
||||
:ensure => 'present'
|
||||
)
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_backend_name").with_value(req_params[:volume_backend_name])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_driver").with_value('cinder.volume.drivers.rbd.RBDDriver')
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_ceph_conf").with_value(req_params[:rbd_ceph_conf])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_flatten_volume_from_snapshot").with_value(req_params[:rbd_flatten_volume_from_snapshot])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_value(req_params[:volume_tmp_dir])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_max_clone_depth").with_value(req_params[:rbd_max_clone_depth])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_pool").with_value(req_params[:rbd_pool])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user])
|
||||
should contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_value(req_params[:rbd_secret_uuid])
|
||||
should contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present')
|
||||
should contain_file_line('set initscript env').with(
|
||||
:line => /env CEPH_ARGS=\"--id test\"/,
|
||||
:path => '/etc/init/cinder-volume.override',
|
||||
@ -47,7 +48,6 @@ describe 'cinder::backend::rbd' do
|
||||
end
|
||||
|
||||
describe 'with RedHat' do
|
||||
|
||||
let :facts do
|
||||
{ :osfamily => 'RedHat' }
|
||||
end
|
||||
@ -71,4 +71,3 @@ describe 'cinder::backend::rbd' do
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user