diff --git a/manifests/profile/base/cinder/volume.pp b/manifests/profile/base/cinder/volume.pp index b9cee83c1..503b3f922 100644 --- a/manifests/profile/base/cinder/volume.pp +++ b/manifests/profile/base/cinder/volume.pp @@ -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 diff --git a/manifests/profile/base/cinder/volume/rbd.pp b/manifests/profile/base/cinder/volume/rbd.pp index dee2e726f..149f5a607 100644 --- a/manifests/profile/base/cinder/volume/rbd.pp +++ b/manifests/profile/base/cinder/volume/rbd.pp @@ -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, + } + } + } } } diff --git a/releasenotes/notes/multiple-cinder-rbd-backend-ef2767baf771b741.yaml b/releasenotes/notes/multiple-cinder-rbd-backend-ef2767baf771b741.yaml new file mode 100644 index 000000000..dd41990c2 --- /dev/null +++ b/releasenotes/notes/multiple-cinder-rbd-backend-ef2767baf771b741.yaml @@ -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. diff --git a/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb index 559b836f3..f986e7cd2 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_rbd_spec.rb @@ -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 diff --git a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb index 03f5325cd..fab47cfa1 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb @@ -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 diff --git a/spec/fixtures/hieradata/step5.yaml b/spec/fixtures/hieradata/step5.yaml index 442420f31..c85b4cb24 100644 --- a/spec/fixtures/hieradata/step5.yaml +++ b/spec/fixtures/hieradata/step5.yaml @@ -1,2 +1,5 @@ --- step: 5 +tripleo::profile::base::cinder::volume::rbd::cinder_rbd_extra_pools: + - 'foo' + - 'bar'