From 5e87dffbeed15756c55c397fb5962c551822336f Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Mon, 6 Aug 2018 10:21:53 -0400 Subject: [PATCH] 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 --- manifests/profile/base/cinder/api.pp | 11 +++++++++++ .../cinder-default-volume-type-a344cea7ab4b4b2a.yaml | 6 ++++++ spec/classes/tripleo_profile_base_cinder_api_spec.rb | 4 +++- spec/fixtures/hieradata/step4.yaml | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/cinder-default-volume-type-a344cea7ab4b4b2a.yaml diff --git a/manifests/profile/base/cinder/api.pp b/manifests/profile/base/cinder/api.pp index b55d0240f..d3c7ec11c 100644 --- a/manifests/profile/base/cinder/api.pp +++ b/manifests/profile/base/cinder/api.pp @@ -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 : } + } + } diff --git a/releasenotes/notes/cinder-default-volume-type-a344cea7ab4b4b2a.yaml b/releasenotes/notes/cinder-default-volume-type-a344cea7ab4b4b2a.yaml new file mode 100644 index 000000000..3be9342a7 --- /dev/null +++ b/releasenotes/notes/cinder-default-volume-type-a344cea7ab4b4b2a.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Add the ability to create Cinder's default volume type. This capability + will be used to fix `bug 1782217 + `__. diff --git a/spec/classes/tripleo_profile_base_cinder_api_spec.rb b/spec/classes/tripleo_profile_base_cinder_api_spec.rb index 044ce2c1d..5871c466e 100644 --- a/spec/classes/tripleo_profile_base_cinder_api_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_api_spec.rb @@ -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 diff --git a/spec/fixtures/hieradata/step4.yaml b/spec/fixtures/hieradata/step4.yaml index 5e45bf7e9..0ccb52c5d 100644 --- a/spec/fixtures/hieradata/step4.yaml +++ b/spec/fixtures/hieradata/step4.yaml @@ -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