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 f21f50ce92)
This commit is contained in:
rajinir 2020-03-10 16:17:41 -05:00
parent 18d5f082ea
commit 5d41a0971a
6 changed files with 192 additions and 0 deletions

View File

@ -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,

View File

@ -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'],
}
}
}
}

View File

@ -0,0 +1,5 @@
---
features:
- Add new PowerMax backend Cinder driver options.
Supports both iSCSI and FC volume drivers and
multiple backends as well.

View File

@ -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

View File

@ -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!({

View File

@ -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'