diff --git a/manifests/profile/base/cinder/volume.pp b/manifests/profile/base/cinder/volume.pp index a69e04186..ece14fdee 100644 --- a/manifests/profile/base/cinder/volume.pp +++ b/manifests/profile/base/cinder/volume.pp @@ -38,6 +38,10 @@ # (Optional) Whether to enable the powermax backend # Defaults to false # +# [*cinder_enable_dellemc_powerstore_backend*] +# (Optional) Whether to enable the powerstore backend +# Defaults to false +# # [*cinder_enable_dellemc_vmax_iscsi_backend*] # (Optional) Whether to enable the vmax iscsi backend # Defaults to false @@ -133,6 +137,7 @@ class tripleo::profile::base::cinder::volume ( $cinder_enable_dellemc_sc_backend = false, $cinder_enable_dellemc_unity_backend = false, $cinder_enable_dellemc_powermax_backend = false, + $cinder_enable_dellemc_powerstore_backend = false, $cinder_enable_dellemc_vmax_iscsi_backend = false, $cinder_enable_dellemc_vnx_backend = false, $cinder_enable_dellemc_vxflexos_backend = false, @@ -226,6 +231,14 @@ class tripleo::profile::base::cinder::volume ( $cinder_dellemc_powermax_backend_name = undef } + if $cinder_enable_dellemc_powerstore_backend { + include tripleo::profile::base::cinder::volume::dellemc_powerstore + $cinder_dellemc_powerstore_backend_name = hiera('cinder::backend::dellemc_powerstore::volume_backend_name', + 'tripleo_dellemc_powerstore') + } else { + $cinder_dellemc_powerstore_backend_name = undef + } + if $cinder_enable_dellemc_vmax_iscsi_backend { include tripleo::profile::base::cinder::volume::dellemc_vmax_iscsi $cinder_dellemc_vmax_iscsi_backend_name = hiera('cinder::backend::dellemc_vmax_iscsi::volume_backend_name', @@ -350,6 +363,7 @@ class tripleo::profile::base::cinder::volume ( $cinder_dellemc_sc_backend_name, $cinder_dellemc_unity_backend_name, $cinder_dellemc_powermax_backend_name, + $cinder_dellemc_powerstore_backend_name, $cinder_dellemc_vmax_iscsi_backend_name, $cinder_dellemc_vnx_backend_name, $cinder_dellemc_vxflexos_backend_name, diff --git a/manifests/profile/base/cinder/volume/dellemc_powerstore.pp b/manifests/profile/base/cinder/volume/dellemc_powerstore.pp new file mode 100644 index 000000000..b3b38d70c --- /dev/null +++ b/manifests/profile/base/cinder/volume/dellemc_powerstore.pp @@ -0,0 +1,68 @@ +# Copyright (c) 2020 Dell Inc, or its subsidiaries. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# == Class: tripleo::profile::base::cinder::volume::dellemc_powerstore +# +# Cinder Volume dellemc_powerstore profile for tripleo +# +# === Parameters +# +# [*backend_name*] +# (Optional) List of names given to the Cinder backend stanza. +# Defaults to hiera('cinder::backend:dellemc_powerstore::volume_backend_name,' +# ['tripleo_dellemc_powerstore']) +# +# [*multi_config*] +# (Optional) A config hash when multiple backends are used. +# Defaults to hiera('cinder::backend::dellemc_powerstore::volume_multi_config', {}) +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::base::cinder::volume::dellemc_powerstore ( + $backend_name = hiera('cinder::backend::dellemc_powerstore::volume_backend_name', ['tripleo_dellemc_powerstore']), + $multi_config = hiera('cinder::backend::dellemc_powerstore::volume_multi_config', {}), + $step = Integer(hiera('step')), +) { + include tripleo::profile::base::cinder::volume + + if $step >= 4 { + $backend_defaults = { + 'CinderPowerStoreAvailabilityZone' => hiera('cinder::backend::dellemc_powerstore::backend_availability_zone', undef), + 'CinderPowerStoreSanIp' => hiera('cinder::backend::dellemc_powerstore::san_ip', undef), + 'CinderPowerStoreSanLogin' => hiera('cinder::backend::dellemc_powerstore::san_login', undef), + 'CinderPowerStoreSanPassword' => hiera('cinder::backend::dellemc_powerstore::san password', undef), + 'CinderPowerStoreStorageProtocol' => hiera('cinder::backend::dellemc_powerstore::storage_protocol', undef), + 'CinderPowerStoreAppliances' => hiera('cinder::backend::dellemc_powerstore::powerstore_appliances', undef), + 'CinderPowerStorePorts' => hiera('cinder::backend::dellemc_powerstore::powerstore_ports', undef), + } + + any2array($backend_name).each |String $backend| { + $backend_config = merge($backend_defaults, pick($multi_config[$backend], {})) + + cinder::backend::dellemc_powerstore { $backend : + backend_availability_zone => $backend_config['CinderPowerStoreAvailabilityZone'], + san_ip => $backend_config['CinderPowerStoreSanIp'], + san_login => $backend_config['CinderPowerStoreSanLogin'], + san_password => $backend_config['CinderPowerStoreSanPassword'], + storage_protocol => $backend_config['CinderPowerStoreStorageProtocol'], + powerstore_appliances => $backend_config['CinderPowerStoreAppliances'], + powerstore_ports => $backend_config['CinderPowerStorePorts'], + } + } + } + +} diff --git a/releasenotes/notes/powerstore-driver-e428e372280c44e6.yaml b/releasenotes/notes/powerstore-driver-e428e372280c44e6.yaml new file mode 100644 index 000000000..8f6461a9e --- /dev/null +++ b/releasenotes/notes/powerstore-driver-e428e372280c44e6.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add new PowerStore backend Cinder driver options. diff --git a/spec/classes/tripleo_profile_base_cinder_powerstore_spec.rb b/spec/classes/tripleo_profile_base_cinder_powerstore_spec.rb new file mode 100644 index 000000000..5301bf3a1 --- /dev/null +++ b/spec/classes/tripleo_profile_base_cinder_powerstore_spec.rb @@ -0,0 +1,79 @@ +# Copyright (c) 2020 Dell Inc, or its subsidiaries +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# + +require 'spec_helper' + +describe 'tripleo::profile::base::cinder::volume::dellemc_powerstore' do + shared_examples_for 'tripleo::profile::base::cinder::volume::dellemc_powerstore' do + before :each do + facts.merge!({ :step => params[:step] }) + end + + context 'with step less than 4' do + let(:params) { { :step => 3 } } + + it 'should do nothing' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_powerstore') + is_expected.to contain_class('tripleo::profile::base::cinder::volume') + is_expected.to contain_class('tripleo::profile::base::cinder') + is_expected.to_not contain_cinder__backend__dellemc_powerstore('tripleo_dellemc_powerstore') + end + end + + context 'with step 4' do + let(:params) { { + :step => 4, + } } + + it 'should trigger complete configuration' do + is_expected.to contain_cinder__backend__dellemc_powerstore('tripleo_dellemc_powerstore') + end + + context 'with multiple backends' do + let(:params) { { + :backend_name => ['tripleo_dellemc_powerstore_1', 'tripleo_dellemc_powerstore_2'], + :multi_config => { 'tripleo_dellemc_powerstore_2' => { 'CinderPowerStoreStorageProtocol' => 'FC' }}, + :step => 4, + } } + + it 'should configure each backend' do + + is_expected.to contain_cinder__backend__dellemc_powerstore('tripleo_dellemc_powerstore_1') + is_expected.to contain_cinder_config('tripleo_dellemc_powerstore_1/volume_driver') + .with_value('cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver') + is_expected.to contain_cinder_config('tripleo_dellemc_powerstore_1/storage_protocol') + .with_value('iSCSI') + + is_expected.to contain_cinder__backend__dellemc_powerstore('tripleo_dellemc_powerstore_2') + is_expected.to contain_cinder_config('tripleo_dellemc_powerstore_2/volume_driver') + .with_value('cinder.volume.drivers.dell_emc.powerstore.driver.PowerStoreDriver') + is_expected.to contain_cinder_config('tripleo_dellemc_powerstore_2/storage_protocol') + .with_value('FC') + + end + end + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::cinder::volume::dellemc_powerstore' + 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 b77d0f6b3..6fca645c7 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb @@ -148,6 +148,35 @@ describe 'tripleo::profile::base::cinder::volume' do end end + context 'with only powerstore' do + before :each do + params.merge!({ + :cinder_enable_dellemc_powerstore_backend => true, + :cinder_enable_iscsi_backend => false, + }) + end + it 'should configure only powerstore' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_powerstore') + is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::iscsi') + is_expected.to contain_class('tripleo::profile::base::cinder::volume') + is_expected.to contain_class('tripleo::profile::base::cinder') + is_expected.to contain_class('cinder::volume') + is_expected.to contain_class('cinder::backends').with( + :enabled_backends => ['tripleo_dellemc_powerstore'] + ) + end + context 'with multiple powerstore backends' do + # Step 5's hiera specifies two powerstore backend names + let(:params) { { :step => 5 } } + it 'should enable each backend' do + is_expected.to contain_class('cinder::backends').with( + :enabled_backends => ['tripleo_dellemc_powerstore_1', 'tripleo_dellemc_powerstore_2'] + ) + end + end + end + + context 'with only sc' do before :each do params.merge!({ @@ -195,7 +224,7 @@ describe 'tripleo::profile::base::cinder::volume' do end end - context 'with only vxflexos' do + context 'with only vxflexos' do before :each do params.merge!({ :cinder_enable_dellemc_vxflexos_backend => true, @@ -319,6 +348,7 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_xtremio') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellsc') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_powermax') + is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_powerstore') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_vxflexos') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::netapp') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::veritas_hyperscale') @@ -336,17 +366,18 @@ describe 'tripleo::profile::base::cinder::volume' do context 'with all tripleo backends' do before :each do params.merge!({ - :cinder_enable_nfs_backend => true, - :cinder_enable_rbd_backend => true, - :cinder_enable_iscsi_backend => true, - :cinder_enable_pure_backend => true, - :cinder_enable_dellemc_powermax_backend => true, - :cinder_enable_dellemc_sc_backend => true, - :cinder_enable_dellsc_backend => true, - :cinder_enable_dellemc_xtremio_backend => true, - :cinder_enable_dellemc_vxflexos_backend => true, - :cinder_enable_netapp_backend => true, - :cinder_enable_vrts_hs_backend => true, + :cinder_enable_nfs_backend => true, + :cinder_enable_rbd_backend => true, + :cinder_enable_iscsi_backend => true, + :cinder_enable_pure_backend => true, + :cinder_enable_dellemc_powermax_backend => true, + :cinder_enable_dellemc_powerstore_backend => true, + :cinder_enable_dellemc_sc_backend => true, + :cinder_enable_dellsc_backend => true, + :cinder_enable_dellemc_xtremio_backend => true, + :cinder_enable_dellemc_vxflexos_backend => true, + :cinder_enable_netapp_backend => true, + :cinder_enable_vrts_hs_backend => true, }) end it 'should configure all backends' do @@ -356,6 +387,7 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_xtremio') is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellsc') is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_powermax') + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_powerstore') is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_vxflexos') is_expected.to contain_class('tripleo::profile::base::cinder::volume::netapp') is_expected.to contain_class('tripleo::profile::base::cinder::volume::veritas_hyperscale') @@ -366,7 +398,8 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to contain_class('cinder::volume') is_expected.to contain_class('cinder::backends').with( :enabled_backends => ['tripleo_iscsi', 'tripleo_ceph', 'tripleo_pure', 'tripleo_dellsc', 'tripleo_dellemc_sc','tripleo_dellemc_powermax', - 'tripleo_dellemc_vxflexos', 'tripleo_dellemc_xtremio', 'tripleo_netapp','tripleo_nfs','Veritas_HyperScale'] + 'tripleo_dellemc_powerstore','tripleo_dellemc_vxflexos', 'tripleo_dellemc_xtremio', + 'tripleo_netapp','tripleo_nfs','Veritas_HyperScale'] ) end end diff --git a/spec/fixtures/hieradata/step5.yaml b/spec/fixtures/hieradata/step5.yaml index b04af19d9..35933cdd5 100644 --- a/spec/fixtures/hieradata/step5.yaml +++ b/spec/fixtures/hieradata/step5.yaml @@ -9,6 +9,9 @@ cinder::backend::pure::volume_backend_name: cinder::backend::dellemc_powermax::volume_backend_name: - 'tripleo_dellemc_powermax_1' - 'tripleo_dellemc_powermax_2' +cinder::backend::dellemc_powerstore::volume_backend_name: + - 'tripleo_dellemc_powerstore_1' + - 'tripleo_dellemc_powerstore_2' cinder::backend::dellemc_sc::volume_backend_name: - 'tripleo_dellemc_sc_1' - 'tripleo_dellemc_sc_2'