Add support for multiple Cinder RBD backends
Add a parameter that allows the user to optionally specify a list of extra Ceph pools to be used as additional RBD backends for Cinder. A separate RBD backend is created for each pool in the list. Implements: blueprint multiple-cinder-rbd-backend Change-Id: I3318b9eaef607d6992f9a8cb605817b6f76dd331
This commit is contained in:
parent
9939df4c17
commit
f08484480f
@ -163,8 +163,17 @@ class tripleo::profile::base::cinder::volume (
|
||||
if $cinder_enable_rbd_backend {
|
||||
include ::tripleo::profile::base::cinder::volume::rbd
|
||||
$cinder_rbd_backend_name = hiera('cinder::backend::rbd::volume_backend_name', 'tripleo_ceph')
|
||||
|
||||
$cinder_rbd_extra_pools = hiera('tripleo::profile::base::cinder::volume::rbd::cinder_rbd_extra_pools', undef)
|
||||
if $cinder_rbd_extra_pools {
|
||||
$base_name = $cinder_rbd_backend_name
|
||||
$cinder_rbd_extra_backend_names = $cinder_rbd_extra_pools.map |$pool_name| { "${base_name}_${pool_name}" }
|
||||
} else {
|
||||
$cinder_rbd_extra_backend_names = undef
|
||||
}
|
||||
} else {
|
||||
$cinder_rbd_backend_name = undef
|
||||
$cinder_rbd_extra_backend_names = undef
|
||||
}
|
||||
|
||||
if $cinder_enable_scaleio_backend {
|
||||
@ -181,8 +190,9 @@ class tripleo::profile::base::cinder::volume (
|
||||
$cinder_veritas_hyperscale_backend_name = undef
|
||||
}
|
||||
|
||||
$backends = delete_undef_values([$cinder_iscsi_backend_name,
|
||||
$backends = delete_undef_values(concat([], $cinder_iscsi_backend_name,
|
||||
$cinder_rbd_backend_name,
|
||||
$cinder_rbd_extra_backend_names,
|
||||
$cinder_pure_backend_name,
|
||||
$cinder_dellps_backend_name,
|
||||
$cinder_dellsc_backend_name,
|
||||
@ -193,7 +203,7 @@ class tripleo::profile::base::cinder::volume (
|
||||
$cinder_nfs_backend_name,
|
||||
$cinder_scaleio_backend_name,
|
||||
$cinder_veritas_hyperscale_backend_name,
|
||||
$cinder_user_enabled_backends])
|
||||
$cinder_user_enabled_backends))
|
||||
# NOTE(aschultz): during testing it was found that puppet 3 may incorrectly
|
||||
# include a "" in the previous array which is not removed by the
|
||||
# delete_undef_values function. So we need to make sure we don't have any
|
||||
|
@ -30,6 +30,11 @@
|
||||
# (Optional) The name of the RBD pool to use
|
||||
# Defaults to 'volumes'
|
||||
#
|
||||
# [*cinder_rbd_extra_pools*]
|
||||
# (Optional) List of additional pools to use for Cinder. A separate RBD
|
||||
# backend is created for each additional pool.
|
||||
# Defaults to undef
|
||||
#
|
||||
# [*cinder_rbd_secret_uuid*]
|
||||
# (Optional) UUID of the of the libvirt secret storing the Cephx key
|
||||
# Defaults to 'ceph::profile::params::fsid'
|
||||
@ -47,6 +52,7 @@ class tripleo::profile::base::cinder::volume::rbd (
|
||||
$backend_name = hiera('cinder::backend::rbd::volume_backend_name', 'tripleo_ceph'),
|
||||
$cinder_rbd_backend_host = hiera('cinder::host', 'hostgroup'),
|
||||
$cinder_rbd_pool_name = 'volumes',
|
||||
$cinder_rbd_extra_pools = undef,
|
||||
$cinder_rbd_secret_uuid = hiera('ceph::profile::params::fsid', undef),
|
||||
$cinder_rbd_user_name = 'openstack',
|
||||
$step = Integer(hiera('step')),
|
||||
@ -60,6 +66,17 @@ class tripleo::profile::base::cinder::volume::rbd (
|
||||
rbd_user => $cinder_rbd_user_name,
|
||||
rbd_secret_uuid => $cinder_rbd_secret_uuid,
|
||||
}
|
||||
|
||||
if $cinder_rbd_extra_pools {
|
||||
$cinder_rbd_extra_pools.each |$pool_name| {
|
||||
cinder::backend::rbd { "${backend_name}_${pool_name}" :
|
||||
backend_host => $cinder_rbd_backend_host,
|
||||
rbd_pool => $pool_name,
|
||||
rbd_user => $cinder_rbd_user_name,
|
||||
rbd_secret_uuid => $cinder_rbd_secret_uuid,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Add support for specifying a list of Ceph pools to be used for additional
|
||||
Cinder RBD backends. This is in addition to the Ceph pool associated with
|
||||
the first Cinder RBD backend. The list of extra pools is optional, and
|
||||
defaults to an empty list.
|
@ -54,6 +54,7 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
|
||||
:backend_name => 'poodles',
|
||||
:cinder_rbd_backend_host => 'fe80::fc54:ff:fe9e:7846',
|
||||
:cinder_rbd_pool_name => 'poolname',
|
||||
:cinder_rbd_extra_pools => ['aplenty', 'galore'],
|
||||
:cinder_rbd_secret_uuid => 'secretuuid',
|
||||
:cinder_rbd_user_name => 'kcatsnepo'
|
||||
})
|
||||
@ -65,6 +66,18 @@ describe 'tripleo::profile::base::cinder::volume::rbd' do
|
||||
:rbd_user => 'kcatsnepo',
|
||||
:rbd_secret_uuid => 'secretuuid'
|
||||
)
|
||||
is_expected.to contain_cinder__backend__rbd('poodles_aplenty').with(
|
||||
:backend_host => 'fe80::fc54:ff:fe9e:7846',
|
||||
:rbd_pool => 'aplenty',
|
||||
:rbd_user => 'kcatsnepo',
|
||||
:rbd_secret_uuid => 'secretuuid'
|
||||
)
|
||||
is_expected.to contain_cinder__backend__rbd('poodles_galore').with(
|
||||
:backend_host => 'fe80::fc54:ff:fe9e:7846',
|
||||
:rbd_pool => 'galore',
|
||||
:rbd_user => 'kcatsnepo',
|
||||
:rbd_secret_uuid => 'secretuuid'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -187,6 +187,18 @@ describe 'tripleo::profile::base::cinder::volume' do
|
||||
:enabled_backends => ['tripleo_ceph']
|
||||
)
|
||||
end
|
||||
context 'additional rbd pools' do
|
||||
# The list of additional rbd pools is not an input, but instead comes
|
||||
# from hiera. Step 4's hiera data doesn't define additional RBD pools,
|
||||
# so test the feature by defining extra pools in step 5 (see
|
||||
# ../fixtures/hieradata/step5.yaml).
|
||||
let(:params) { { :step => 5 } }
|
||||
it 'should configure additional rbd backends' do
|
||||
is_expected.to contain_class('cinder::backends').with(
|
||||
:enabled_backends => ['tripleo_ceph', 'tripleo_ceph_foo', 'tripleo_ceph_bar']
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with only user backend' do
|
||||
|
3
spec/fixtures/hieradata/step5.yaml
vendored
3
spec/fixtures/hieradata/step5.yaml
vendored
@ -1,2 +1,5 @@
|
||||
---
|
||||
step: 5
|
||||
tripleo::profile::base::cinder::volume::rbd::cinder_rbd_extra_pools:
|
||||
- 'foo'
|
||||
- 'bar'
|
||||
|
Loading…
Reference in New Issue
Block a user