Merge "Add additional backend options for cinder"

This commit is contained in:
Jenkins 2015-12-29 17:59:16 +00:00 committed by Gerrit Code Review
commit bab8cb706a
16 changed files with 150 additions and 47 deletions

View File

@ -31,6 +31,10 @@
# (optional) Name of the server folder to use on the Storage Center.
# Defaults to 'srv'
#
# [*dell_sc_verify_cert*]
# (optional) Enable HTTPS SC ceritifcate verification
# Defaults to $::os_service_default
#
# [*dell_sc_volume_folder*]
# (optional) Name of the volume folder to use on the Storage Center.
# Defaults to 'vol'
@ -54,6 +58,7 @@ define cinder::backend::dellsc_iscsi (
$volume_backend_name = $name,
$dell_sc_api_port = $::os_service_default,
$dell_sc_server_folder = 'srv',
$dell_sc_verify_cert = $::os_service_default,
$dell_sc_volume_folder = 'vol',
$iscsi_port = $::os_service_default,
$extra_options = {},
@ -78,6 +83,7 @@ define cinder::backend::dellsc_iscsi (
"${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_verify_cert": value => $dell_sc_verify_cert;
"${name}/dell_sc_volume_folder": value => $dell_sc_volume_folder;
"${name}/iscsi_port": value => $iscsi_port;
}

View File

@ -13,8 +13,14 @@
# (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name
#
# [*glusterfs_disk_util*]
# Removed in Icehouse.
# [*glusterfs_backup_mount_point*]
# (optional) Base dir containing mount point for gluster share.
# Defaults to $::os_service_default
#
# [*glusterfs_backup_share*]
# (optonal) GlusterFS share in <hostname|ipv4addr|ipv6addr>:<gluster_vol_name>
# format. Eg: 1.2.3.4:backup_vol
# Defaults to $::os_service_default
#
# [*glusterfs_sparsed_volumes*]
# (optional) Whether or not to use sparse (thin) volumes.
@ -43,18 +49,15 @@
#
define cinder::backend::glusterfs (
$glusterfs_shares,
$volume_backend_name = $name,
$glusterfs_disk_util = false,
$glusterfs_sparsed_volumes = $::os_service_default,
$glusterfs_mount_point_base = $::os_service_default,
$glusterfs_shares_config = '/etc/cinder/shares.conf',
$extra_options = {},
$volume_backend_name = $name,
$glusterfs_backup_mount_point = $::os_service_default,
$glusterfs_backup_share = $::os_service_default,
$glusterfs_sparsed_volumes = $::os_service_default,
$glusterfs_mount_point_base = $::os_service_default,
$glusterfs_shares_config = '/etc/cinder/shares.conf',
$extra_options = {},
) {
if $glusterfs_disk_util {
fail('glusterfs_disk_util is removed in Icehouse.')
}
$content = join($glusterfs_shares, "\n")
file { $glusterfs_shares_config:
@ -67,6 +70,8 @@ define cinder::backend::glusterfs (
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value =>
'cinder.volume.drivers.glusterfs.GlusterfsDriver';
"${name}/glusterfs_backup_mount_point": value => $glusterfs_backup_mount_point;
"${name}/glusterfs_backup_share": value => $glusterfs_backup_share;
"${name}/glusterfs_shares_config": value => $glusterfs_shares_config;
"${name}/glusterfs_sparsed_volumes": value => $glusterfs_sparsed_volumes;
"${name}/glusterfs_mount_point_base": value => $glusterfs_mount_point_base;

View File

@ -10,6 +10,12 @@
# (Required) Description
# Defaults to '[]'
#
# [*nfs_mount_attempts*]
# (optional) The number of attempts to mount nfs shares before raising an
# error. At least one attempt will be made to mount an nfs share, regardless
# of the value specified.
# Defaults to $::os_service_default
#
# [*nfs_mount_options*]
# (Optional) Mount options passed to the nfs client.
# Defaults to $::os_service_default
@ -52,6 +58,7 @@
define cinder::backend::nfs (
$volume_backend_name = $name,
$nfs_servers = [],
$nfs_mount_attempts = $::os_service_default,
$nfs_mount_options = $::os_service_default,
$nfs_disk_util = $::os_service_default,
$nfs_sparsed_volumes = $::os_service_default,
@ -73,6 +80,7 @@ define cinder::backend::nfs (
"${name}/volume_driver": value =>
'cinder.volume.drivers.nfs.NfsDriver';
"${name}/nfs_shares_config": value => $nfs_shares_config;
"${name}/nfs_mount_attempts": value => $nfs_mount_attempts;
"${name}/nfs_mount_options": value => $nfs_mount_options;
"${name}/nfs_disk_util": value => $nfs_disk_util;
"${name}/nfs_sparsed_volumes": value => $nfs_sparsed_volumes;

View File

@ -44,6 +44,24 @@
# A value of zero disables cloning
# Defaults to $::os_service_default
#
# [*rados_connect_timeout*]
# (optional) Timeout value (in seconds) used when connecting to ceph cluster.
# If value < 0, no timeout is set and default librados value is used.
# Defaults to $::os_service_default
#
# [*rados_connection_interval*]
# (optional) Interval value (in seconds) between connection retries to ceph
# cluster.
# Defaults to $::os_service_default
#
# [*rados_connection_retries*]
# (optional) Number of retries if connection to ceph cluster failed.
# Defaults to $::os_service_default
#
# [*rbd_store_chunk_size*]
# (optional) Volumes will be chunked into objects of this size (in megabytes).
# Defaults to $::os_service_default
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
@ -60,6 +78,10 @@ define cinder::backend::rbd (
$rbd_secret_uuid = $::os_service_default,
$volume_tmp_dir = $::os_service_default,
$rbd_max_clone_depth = $::os_service_default,
$rados_connect_timeout = $::os_service_default,
$rados_connection_interval = $::os_service_default,
$rados_connection_retries = $::os_service_default,
$rbd_store_chunk_size = $::os_service_default,
$extra_options = {},
) {
@ -74,6 +96,10 @@ define cinder::backend::rbd (
"${name}/rbd_max_clone_depth": value => $rbd_max_clone_depth;
"${name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot;
"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;
"${name}/rados_connect_timeout": value => $rados_connect_timeout;
"${name}/rados_connection_interval": value => $rados_connection_interval;
"${name}/rados_connection_retries": value => $rados_connection_retries;
"${name}/rbd_store_chunk_size": value => $rbd_store_chunk_size;
"${name}/volume_tmp_dir": value => $volume_tmp_dir;
}

View File

@ -27,6 +27,10 @@
# (optional) Name of the server folder to use on the Storage Center.
# Defaults to 'srv'
#
# [*dell_sc_verify_cert*]
# (optional) Enable HTTPS SC certificate verification
# Defaults to $:os_service_default
#
# [*dell_sc_volume_folder*]
# (optional) Name of the volume folder to use on the Storage Center.
# Defaults to 'vol'
@ -49,6 +53,7 @@ class cinder::volume::dellsc_iscsi (
$dell_sc_ssn,
$dell_sc_api_port = $::os_service_default,
$dell_sc_server_folder = 'srv',
$dell_sc_verify_cert = $::os_service_default,
$dell_sc_volume_folder = 'vol',
$iscsi_port = $::os_service_default,
$extra_options = {},
@ -61,6 +66,7 @@ class cinder::volume::dellsc_iscsi (
dell_sc_ssn => $dell_sc_ssn,
dell_sc_api_port => $dell_sc_api_port,
dell_sc_server_folder => $dell_sc_server_folder,
dell_sc_verify_cert => $dell_sc_verify_cert,
dell_sc_volume_folder => $dell_sc_volume_folder,
iscsi_port => $iscsi_port,
extra_options => $extra_options,

View File

@ -9,6 +9,15 @@
# (required) An array of GlusterFS volume locations.
# Must be an array even if there is only one volume.
#
# [*glusterfs_backup_mount_point*]
# (optional) Base dir containing mount point for gluster share.
# Defaults to $::os_service_default
#
# [*glusterfs_backup_share*]
# (optonal) GlusterFS share in <hostname|ipv4addr|ipv6addr>:<gluster_vol_name>
# format. Eg: 1.2.3.4:backup_vol
# Defaults to $::os_service_default
#
# [*glusterfs_sparsed_volumes*]
# (optional) Whether or not to use sparse (thin) volumes.
# Defaults to $::os_service_default which uses the driver's default of "true".
@ -27,11 +36,6 @@
# Example :
# { 'glusterfs_backend/param1' => { 'value' => value1 } }
#
# *Deprecated*
#
# [*glusterfs_disk_util*]
# Removed in Icehouse.
#
# === Examples
#
# class { 'cinder::volume::glusterfs':
@ -40,19 +44,21 @@
#
class cinder::volume::glusterfs (
$glusterfs_shares,
$glusterfs_disk_util = false,
$glusterfs_sparsed_volumes = $::os_service_default,
$glusterfs_mount_point_base = $::os_service_default,
$glusterfs_shares_config = '/etc/cinder/shares.conf',
$extra_options = {},
$glusterfs_backup_mount_point = $::os_service_default,
$glusterfs_backup_share = $::os_service_default,
$glusterfs_sparsed_volumes = $::os_service_default,
$glusterfs_mount_point_base = $::os_service_default,
$glusterfs_shares_config = '/etc/cinder/shares.conf',
$extra_options = {},
) {
cinder::backend::glusterfs { 'DEFAULT':
glusterfs_shares => $glusterfs_shares,
glusterfs_disk_util => $glusterfs_disk_util,
glusterfs_sparsed_volumes => $glusterfs_sparsed_volumes,
glusterfs_mount_point_base => $glusterfs_mount_point_base,
glusterfs_shares_config => $glusterfs_shares_config,
extra_options => $extra_options,
glusterfs_shares => $glusterfs_shares,
glusterfs_backup_mount_point => $glusterfs_backup_mount_point,
glusterfs_backup_share => $glusterfs_backup_share,
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

@ -7,6 +7,12 @@
# (Required) Description
# Defaults to '[]'
#
# [*nfs_mount_attempts*]
# (optional) The number of attempts to mount nfs shares before raising an
# error. At least one attempt will be made to mount an nfs share, regardless
# of the value specified.
# Defaults to $::os_service_default
#
# [*nfs_mount_options*]
# (Optional) Mount options passed to the nfs client.
# Defaults to $::os_service_default.
@ -48,6 +54,7 @@
#
class cinder::volume::nfs (
$nfs_servers = [],
$nfs_mount_attempts = $::os_service_default,
$nfs_mount_options = $::os_service_default,
$nfs_disk_util = $::os_service_default,
$nfs_sparsed_volumes = $::os_service_default,
@ -60,6 +67,7 @@ class cinder::volume::nfs (
cinder::backend::nfs { 'DEFAULT':
nfs_servers => $nfs_servers,
nfs_mount_attempts => $nfs_mount_attempts,
nfs_mount_options => $nfs_mount_options,
nfs_disk_util => $nfs_disk_util,
nfs_sparsed_volumes => $nfs_sparsed_volumes,

View File

@ -33,6 +33,24 @@
# A value of zero disables cloning
# Defaults to $::os_service_default
#
# [*rados_connect_timeout*]
# (optional) Timeout value (in seconds) used when connecting to ceph cluster.
# If value < 0, no timeout is set and default librados value is used.
# Defaults to $::os_service_default
#
# [*rados_connection_interval*]
# (optional) Interval value (in seconds) between connection retries to ceph
# cluster.
# Defaults to $::os_service_default
#
# [*rados_connection_retries*]
# (optional) Number of retries if connection to ceph cluster failed.
# Defaults to $::os_service_default
#
# [*rbd_store_chunk_size*]
# (optional) Volumes will be chunked into objects of this size (in megabytes).
# Defaults to $::os_service_default
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza
# Defaults to: {}
@ -47,6 +65,10 @@ class cinder::volume::rbd (
$rbd_secret_uuid = false,
$volume_tmp_dir = false,
$rbd_max_clone_depth = $::os_service_default,
$rados_connect_timeout = $::os_service_default,
$rados_connection_interval = $::os_service_default,
$rados_connection_retries = $::os_service_default,
$rbd_store_chunk_size = $::os_service_default,
$extra_options = {},
) {
@ -58,6 +80,10 @@ class cinder::volume::rbd (
rbd_secret_uuid => $rbd_secret_uuid,
volume_tmp_dir => $volume_tmp_dir,
rbd_max_clone_depth => $rbd_max_clone_depth,
rados_connect_timeout => $rados_connect_timeout,
rados_connection_interval => $rados_connection_interval,
rados_connection_retries => $rados_connection_retries,
rbd_store_chunk_size => $rbd_store_chunk_size,
extra_options => $extra_options,
}
}

View File

@ -16,6 +16,7 @@ describe 'cinder::volume::dellsc_iscsi' do
{
:dell_sc_api_port => '<SERVICE DEFAULT>',
:dell_sc_server_folder => 'srv',
:dell_sc_verify_cert => '<SERVICE DEFAULT>',
:dell_sc_volume_folder => 'vol',
:iscsi_port => '<SERVICE DEFAULT>',
}

View File

@ -17,6 +17,8 @@ describe 'cinder::volume::glusterfs' do
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_cinder_config('DEFAULT/glusterfs_backup_mount_point').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/glusterfs_backup_share').with_value('<SERVICE DEFAULT>')
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]',
@ -24,15 +26,6 @@ describe 'cinder::volume::glusterfs' do
)
end
context "with an parameter which has been removed" do
before do
params.merge!({
:glusterfs_disk_util => 'foo',
})
end
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' }}})

View File

@ -47,11 +47,14 @@ describe 'cinder::volume::nfs' do
describe 'nfs volume driver with additional configuration' do
before :each do
params.merge!({:extra_options => {'nfs_backend/param1' => {'value' => 'value1'}}})
params.merge!({
:nfs_mount_attempts => 4,
:extra_options => {'nfs_backend/param1' => {'value' => 'value1'}}})
end
it 'configure nfs volume with additional configuration' do
is_expected.to contain_cinder__backend__nfs('DEFAULT').with({
:nfs_mount_attempts => params[:nfs_mount_attempts],
:extra_options => {'nfs_backend/param1' => {'value' => 'value1'}}
})
end

View File

@ -11,6 +11,10 @@ describe 'cinder::volume::rbd' do
:rbd_flatten_volume_from_snapshot => true,
:volume_tmp_dir => '<SERVICE DEFAULT>',
:rbd_max_clone_depth => '0',
:rados_connect_timeout => '<SERVICE DEFAULT>',
:rados_connection_interval => '<SERVICE DEFAULT>',
:rados_connection_retries => '<SERVICE DEFAULT>',
:rbd_store_chunk_size => '<SERVICE DEFAULT>'
}
end
@ -35,6 +39,10 @@ describe 'cinder::volume::rbd' do
is_expected.to contain_cinder_config('DEFAULT/rbd_pool').with_value(req_params[:rbd_pool])
is_expected.to contain_cinder_config('DEFAULT/rbd_user').with_value(req_params[:rbd_user])
is_expected.to contain_cinder_config('DEFAULT/rbd_secret_uuid').with_value(req_params[:rbd_secret_uuid])
is_expected.to contain_cinder_config('DEFAULT/rados_connect_timeout').with_value(req_params[:rados_connect_timeout])
is_expected.to contain_cinder_config('DEFAULT/rados_connection_interval').with_value(req_params[:rados_connection_interval])
is_expected.to contain_cinder_config('DEFAULT/rados_connection_retries').with_value(req_params[:rados_connection_retries])
is_expected.to contain_cinder_config('DEFAULT/rbd_store_chunk_size').with_value(req_params[:rbd_store_chunk_size])
is_expected.to contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present')
is_expected.to contain_file_line('set initscript env DEFAULT').with(
:line => /env CEPH_ARGS=\"--id test\"/,

View File

@ -20,6 +20,7 @@ describe 'cinder::backend::dellsc_iscsi' do
{
:dell_sc_api_port => '<SERVICE DEFAULT>',
:dell_sc_server_folder => 'srv',
:dell_sc_verify_cert => '<SERVICE DEFAULT>',
:dell_sc_volume_folder => 'vol',
:iscsi_port => '<SERVICE DEFAULT>',
}

View File

@ -21,6 +21,10 @@ describe 'cinder::backend::glusterfs' do
it 'configures glusterfs volume driver' do
is_expected.to contain_cinder_config('mygluster/volume_driver').with_value(
'cinder.volume.drivers.glusterfs.GlusterfsDriver')
is_expected.to contain_cinder_config('mygluster/glusterfs_backup_mount_point').with_value(
'<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('mygluster/glusterfs_backup_share').with_value(
'<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('mygluster/glusterfs_shares_config').with_value(
'/etc/cinder/other_shares.conf')
is_expected.to contain_cinder_config('mygluster/glusterfs_sparsed_volumes').with_value(
@ -34,15 +38,6 @@ describe 'cinder::backend::glusterfs' do
)
end
context "with an parameter which has been removed" do
before do
params.merge!({
:glusterfs_disk_util => 'foo',
})
end
it_raises 'a Puppet::Error', /glusterfs_disk_util is removed in Icehouse./
end
context 'glusterfs backend with additional configuration' do
before do
params.merge!({:extra_options => {'mygluster/param1' => { 'value' => 'value1' }}})

View File

@ -7,6 +7,7 @@ describe 'cinder::backend::nfs' do
let :params do
{
:nfs_servers => ['10.10.10.10:/shares', '10.10.10.10:/shares2'],
:nfs_mount_attempts => '4',
:nfs_mount_options => 'vers=3',
:nfs_shares_config => '/etc/cinder/other_shares.conf',
:nfs_disk_util => 'du',
@ -26,6 +27,8 @@ describe 'cinder::backend::nfs' do
'cinder.volume.drivers.nfs.NfsDriver')
is_expected.to contain_cinder_config('hippo/nfs_shares_config').with_value(
'/etc/cinder/other_shares.conf')
is_expected.to contain_cinder_config('hippo/nfs_mount_attempts').with_value(
'4')
is_expected.to contain_cinder_config('hippo/nfs_mount_options').with_value(
'vers=3')
is_expected.to contain_cinder_config('hippo/nfs_sparsed_volumes').with_value(

View File

@ -18,6 +18,10 @@ describe 'cinder::backend::rbd' do
:rbd_flatten_volume_from_snapshot => true,
:volume_tmp_dir => '<SERVICE DEFAULT>',
:rbd_max_clone_depth => '0',
:rados_connect_timeout => '<SERVICE DEFAULT>',
:rados_connection_interval => '<SERVICE DEFAULT>',
:rados_connection_retries => '<SERVICE DEFAULT>',
:rbd_store_chunk_size => '<SERVICE DEFAULT>'
}
end
@ -43,6 +47,10 @@ describe 'cinder::backend::rbd' do
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_user").with_value(req_params[:rbd_user])
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_value(req_params[:rbd_secret_uuid])
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/backend_host").with_value('rbd:'"#{req_params[:rbd_pool]}")
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rados_connect_timeout").with_value(req_params[:rados_connect_timeout])
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rados_connection_interval").with_value(req_params[:rados_connection_interval])
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rados_connection_retries").with_value(req_params[:rados_connection_retries])
is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_store_chunk_size").with_value(req_params[:rbd_store_chunk_size])
is_expected.to contain_file('/etc/init/cinder-volume.override').with(:ensure => 'present')
is_expected.to contain_file_line('set initscript env rbd-ssd').with(
:line => /env CEPH_ARGS=\"--id test\"/,