Configure cinder's default volume type

Add a resource that creates Cinder's default volume type. The
cinder::type provider executes osc commands, so this is only done once
on the bootstrap node, and at step 4 when the cinder_api service is
running.

Partial-Bug: #1782217
Change-Id: Ia23996abefdd1410fb86f04ed84a314f4364339c
(cherry picked from commit 5e87dffbee)
This commit is contained in:
Alan Bishop 2018-08-06 10:21:53 -04:00
parent 72496d6a88
commit 5096691354
4 changed files with 21 additions and 1 deletions

View File

@ -49,6 +49,10 @@
# specified.
# Defaults to hiera('cinder::api::keymgr_backend', 'cinder.keymgr.conf_key_mgr.ConfKeyManager')
#
# [*default_volume_type*]
# (Optional) The name of the default volume type.
# Defaults to hiera('cinder::api::default_volume_type', '')
#
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
# for more details.
@ -68,14 +72,17 @@ class tripleo::profile::base::cinder::api (
$cinder_api_network = hiera('cinder_api_network', undef),
$enable_internal_tls = hiera('enable_internal_tls', false),
$keymgr_backend = hiera('cinder::api::keymgr_backend', 'cinder.keymgr.conf_key_mgr.ConfKeyManager'),
$default_volume_type = hiera('cinder::api::default_volume_type', ''),
$step = Integer(hiera('step')),
# DEPRECATED PARAMETERS
$keymgr_api_class = undef,
) {
if $::hostname == downcase($bootstrap_node) {
$sync_db = true
$manage_type = true
} else {
$sync_db = false
$manage_type = false
}
include ::tripleo::profile::base::cinder
@ -111,4 +118,8 @@ class tripleo::profile::base::cinder::api (
include ::cinder::ceilometer
}
if $step == 4 and $manage_type and $default_volume_type != '' {
cinder::type { $default_volume_type : }
}
}

View File

@ -0,0 +1,6 @@
---
features:
- |
Add the ability to create Cinder's default volume type. This capability
will be used to fix `bug 1782217
<https://bugs.launchpad.net/tripleo/+bug/1782217>`__.

View File

@ -77,6 +77,7 @@ describe 'tripleo::profile::base::cinder::api' do
:keymgr_backend => 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager',
)
is_expected.to contain_class('cinder::ceilometer')
is_expected.to contain_cinder__type('tripleo')
end
end
@ -86,12 +87,13 @@ describe 'tripleo::profile::base::cinder::api' do
:bootstrap_node => 'other.example.com',
} }
it 'should trigger complete configuration but with no db sync' do
it 'should trigger complete configuration but with no db sync or default volume type' do
is_expected.to contain_class('cinder::api').with(
:sync_db => false,
:keymgr_backend => 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager',
)
is_expected.to contain_class('cinder::ceilometer')
is_expected.to_not contain_cinder__type('tripleo')
end
end

View File

@ -1,5 +1,6 @@
---
step: 4
cinder::api::default_volume_type: 'tripleo'
cinder::api::keymgr_backend: 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager'
nova::compute::keymgr_backend: 'castellan.key_manager.barbican_key_manager.BarbicanKeyManager'
# items needed for tripleo::profile::base::cinder::volume