From 5d41a0971aaa15b1244f10cd05fe7f8f6abe7ad1 Mon Sep 17 00:00:00 2001 From: rajinir Date: Tue, 10 Mar 2020 16:17:41 -0500 Subject: [PATCH] Support for PowerMax Volume Config PowerMax config options have changed since newton. Updating them to the latest. Supports both iSCSI and FC drivers. Supports deploying multiple instances of the cinder::backend::dellemc_powermax backend (e.g. one iscsi + one fc, multiple iscsi, etc.). Depends-On: https://review.opendev.org/#/c/708960/ Change-Id: I25be51121390afd7ed3d0f0249733d3ccaf557de (cherry picked from commit f21f50ce92eca114b171a9d03f6f020cddf4c0de) --- manifests/profile/base/cinder/volume.pp | 13 ++++ .../base/cinder/volume/dellemc_powermax.pp | 70 ++++++++++++++++++ .../powermax-driver-d428e372280c44e6.yaml | 5 ++ ...ipleo_profile_base_cinder_powermax_spec.rb | 72 +++++++++++++++++++ ...tripleo_profile_base_cinder_volume_spec.rb | 29 ++++++++ spec/fixtures/hieradata/step5.yaml | 3 + 6 files changed, 192 insertions(+) create mode 100644 manifests/profile/base/cinder/volume/dellemc_powermax.pp create mode 100644 releasenotes/notes/powermax-driver-d428e372280c44e6.yaml create mode 100644 spec/classes/tripleo_profile_base_cinder_powermax_spec.rb diff --git a/manifests/profile/base/cinder/volume.pp b/manifests/profile/base/cinder/volume.pp index 67636c31c..0c3c84021 100644 --- a/manifests/profile/base/cinder/volume.pp +++ b/manifests/profile/base/cinder/volume.pp @@ -30,6 +30,10 @@ # (Optional) Whether to enable the unity backend # Defaults to false # +# [*cinder_enable_dellemc_powermax_backend*] +# (Optional) Whether to enable the powermax backend +# Defaults to false +# # [*cinder_enable_dellemc_vmax_iscsi_backend*] # (Optional) Whether to enable the vmax iscsi backend # Defaults to false @@ -115,6 +119,7 @@ class tripleo::profile::base::cinder::volume ( $cinder_enable_pure_backend = false, $cinder_enable_dellsc_backend = false, $cinder_enable_dellemc_unity_backend = false, + $cinder_enable_dellemc_powermax_backend = false, $cinder_enable_dellemc_vmax_iscsi_backend = false, $cinder_enable_dellemc_vnx_backend = false, $cinder_enable_dellemc_xtremio_iscsi_backend = false, @@ -188,6 +193,13 @@ class tripleo::profile::base::cinder::volume ( $cinder_dellemc_unity_backend_name = undef } + if $cinder_enable_dellemc_powermax_backend { + include tripleo::profile::base::cinder::volume::dellemc_powermax + $cinder_dellemc_powermax_backend_name = hiera('cinder::backend::dellemc_powermax::volume_backend_name', 'tripleo_dellemc_powermax') + } else { + $cinder_dellemc_powermax_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', @@ -302,6 +314,7 @@ class tripleo::profile::base::cinder::volume ( $cinder_dellps_backend_name, $cinder_dellsc_backend_name, $cinder_dellemc_unity_backend_name, + $cinder_dellemc_powermax_backend_name, $cinder_dellemc_vmax_iscsi_backend_name, $cinder_dellemc_vnx_backend_name, $cinder_dellemc_xtremio_iscsi_backend_name, diff --git a/manifests/profile/base/cinder/volume/dellemc_powermax.pp b/manifests/profile/base/cinder/volume/dellemc_powermax.pp new file mode 100644 index 000000000..98e455604 --- /dev/null +++ b/manifests/profile/base/cinder/volume/dellemc_powermax.pp @@ -0,0 +1,70 @@ +# 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_powermax +# +# Cinder Volume dellemc_powermax profile for tripleo +# +# === Parameters +# +# [*backend_name*] +# (Optional) List of names given to the Cinder backend stanza. +# Defaults to hiera('cinder::backend:dellemc_powermax::volume_backend_name,' +# ['tripleo_dellemc_powermax']) +# +# [*multi_config*] +# (Optional) A config hash when multiple backends are used. +# Defaults to hiera('cinder::backend::dellemc_powermax::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_powermax ( + $backend_name = hiera('cinder::backend::dellemc_powermax::volume_backend_name', ['tripleo_dellemc_powermx']), + $multi_config = hiera('cinder::backend::dellemc_powermax::volume_multi_config', {}), + $step = Integer(hiera('step')), +) { + include tripleo::profile::base::cinder::volume + + if $step >= 4 { + $backend_defaults = { + 'CinderPowermaxAvailabilityZone' => hiera('cinder::backend::dellemc_powermax::backend_availability_zone', undef), + 'CinderPowermaxSanIp' => hiera('cinder::backend::dellemc_powermax::san_ip', undef), + 'CinderPowermaxSanLogin' => hiera('cinder::backend::dellemc_powermax::san_login', undef), + 'CinderPowermaxSanPassword' => hiera('cinder::backend::dellemc_powermax::san password', undef), + 'CinderPowermaxStorageProtocol' => hiera('cinder::backend::dellemc_powermax::powermax_storage_protocol', undef), + 'CinderPowermaxArray' => hiera('cinder::backend::dellemc_powermax::powermax_array', undef), + 'CinderPowermaxSrp' => hiera('cinder::backend::dellemc_powermax::powermax_srp', undef), + 'CinderPowermaxPortGroups' => hiera('cinder::backend::dellemc_powermax::powermax_port_groups', undef), + } + + $backend_name.each |String $backend| { + $backend_config = merge($backend_defaults, pick($multi_config[$backend], {})) + + cinder::backend::dellemc_powermax { $backend : + backend_availability_zone => $backend_config['CinderPowermaxAvailabilityZone'], + san_ip => $backend_config['CinderPowermaxSanIp'], + san_login => $backend_config['CinderPowermaxSanLogin'], + san_password => $backend_config['CinderPowermaxSanPassword'], + powermax_storage_protocol => $backend_config['CinderPowermaxStorageProtocol'], + powermax_array => $backend_config['CinderPowermaxArray'], + powermax_srp => $backend_config['CinderPowermaxSrp'], + powermax_port_groups => $backend_config['CinderPowermaPortGroups'], + } + } + } + +} diff --git a/releasenotes/notes/powermax-driver-d428e372280c44e6.yaml b/releasenotes/notes/powermax-driver-d428e372280c44e6.yaml new file mode 100644 index 000000000..d0f586df2 --- /dev/null +++ b/releasenotes/notes/powermax-driver-d428e372280c44e6.yaml @@ -0,0 +1,5 @@ +--- +features: + - Add new PowerMax backend Cinder driver options. + Supports both iSCSI and FC volume drivers and + multiple backends as well. diff --git a/spec/classes/tripleo_profile_base_cinder_powermax_spec.rb b/spec/classes/tripleo_profile_base_cinder_powermax_spec.rb new file mode 100644 index 000000000..58d448501 --- /dev/null +++ b/spec/classes/tripleo_profile_base_cinder_powermax_spec.rb @@ -0,0 +1,72 @@ +# 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_powermax' do + shared_examples_for 'tripleo::profile::base::cinder::volume::dellemc_powermax' 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_powermax') + 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_powermax('tripleo_dellemc_powermax') + end + end + + context 'with step 4' do + let(:params) { { + :step => 4, + } } + + it 'should trigger complete configuration' do + is_expected.to contain_cinder__backend__dellemc_powermax('tripleo_dellemc_powermax') + end + end + + context 'with multiple backends' do + let(:params) { { + :backend_name => ['tripleo_dellemc_powermax_1', 'tripleo_dellemc_powermax_2'], + :multi_config => { 'tripleo_dellemc_powermax_2' => { 'CinderPowermaxStorageProtocol' => 'FC' }}, + :step => 4, + } } + + it 'should configure each backend' do + is_expected.to contain_cinder__backend__dellemc_powermax('tripleo_dellemc_powermax_1') + is_expected.to contain_cinder_config('tripleo_dellemc_powermax_1/volume_driver') + .with_value('cinder.volume.drivers.dell_emc.powermax.iscsi.PowerMaxISCSIDriver') + is_expected.to contain_cinder__backend__dellemc_powermax('tripleo_dellemc_powermax_2') + is_expected.to contain_cinder_config('tripleo_dellemc_powermax_2/volume_driver') + .with_value('cinder.volume.drivers.dell_emc.powermax.fc.PowerMaxFCDriver') + 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_powermax' + end + 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 c3b900bb3..cbb4e44e3 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb @@ -63,6 +63,7 @@ describe 'tripleo::profile::base::cinder::volume' do end end + context 'with only pure' do before :each do params.merge!({ @@ -91,6 +92,34 @@ describe 'tripleo::profile::base::cinder::volume' do end end + context 'with only powermax' do + before :each do + params.merge!({ + :cinder_enable_dellemc_powermax_backend => true, + :cinder_enable_iscsi_backend => false, + }) + end + it 'should configure only powermax' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_powermax') + 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_powermax'] + ) + end + context 'with multiple powermax backends' do + # Step 5's hiera specifies two powermax backend names + let(:params) { { :step => 5 } } + it 'should enable each backend' do + is_expected.to contain_class('cinder::backends').with( + :enabled_backends => ['tripleo_dellemc_powermax_1', 'tripleo_dellemc_powermax_2'] + ) + end + end + end + context 'with only dellsc' do before :each do params.merge!({ diff --git a/spec/fixtures/hieradata/step5.yaml b/spec/fixtures/hieradata/step5.yaml index 4a4377a8b..2329e9394 100644 --- a/spec/fixtures/hieradata/step5.yaml +++ b/spec/fixtures/hieradata/step5.yaml @@ -6,3 +6,6 @@ tripleo::profile::base::cinder::volume::rbd::cinder_rbd_extra_pools: cinder::backend::pure::volume_backend_name: - 'tripleo_pure_1' - 'tripleo_pure_2' +cinder::backend::dellemc_powermax::volume_backend_name: + - 'tripleo_dellemc_powermax_1' + - 'tripleo_dellemc_powermax_2'