Support for Dell EMC SC Volume Config

Added support for SC volume config options.
Supports both iSCSI and FC drivers.
Supports deploying multiple instances of the
cinder::backend::dellemc_sc backend
(e.g. one iscsi + one fc, multiple iscsi, etc.).

Change-Id: I2f441a9df5bda4e1c646b3259d233f760fd3e742
This commit is contained in:
rajinir 2020-04-23 16:40:49 -05:00
parent b8ed26353e
commit bd15ac0a1f
6 changed files with 219 additions and 8 deletions

View File

@ -26,6 +26,10 @@
# (Optional) Whether to enable the delsc backend
# Defaults to false
#
# [*cinder_enable_dellemc_sc_backend*]
# (Optional) Whether to enable the sc backend
# Defaults to false
#
# [*cinder_enable_dellemc_unity_backend*]
# (Optional) Whether to enable the unity backend
# Defaults to false
@ -118,6 +122,7 @@
class tripleo::profile::base::cinder::volume (
$cinder_enable_pure_backend = false,
$cinder_enable_dellsc_backend = false,
$cinder_enable_dellemc_sc_backend = false,
$cinder_enable_dellemc_unity_backend = false,
$cinder_enable_dellemc_powermax_backend = false,
$cinder_enable_dellemc_vmax_iscsi_backend = false,
@ -190,6 +195,13 @@ class tripleo::profile::base::cinder::volume (
$cinder_dellsc_backend_name = undef
}
if $cinder_enable_dellemc_sc_backend {
include tripleo::profile::base::cinder::volume::dellemc_sc
$cinder_dellemc_sc_backend_name = hiera('cinder::backend::dellemc_sc::volume_backend_name', 'tripleo_dellemc_sc')
} else {
$cinder_dellemc_sc_backend_name = undef
}
if $cinder_enable_dellemc_unity_backend {
include tripleo::profile::base::cinder::volume::dellemc_unity
$cinder_dellemc_unity_backend_name = hiera('cinder::backend::dellemc_unity::volume_backend_name', 'tripleo_dellemc_unity')
@ -309,6 +321,7 @@ class tripleo::profile::base::cinder::volume (
$cinder_rbd_extra_backend_names,
$cinder_pure_backend_name,
$cinder_dellsc_backend_name,
$cinder_dellemc_sc_backend_name,
$cinder_dellemc_unity_backend_name,
$cinder_dellemc_powermax_backend_name,
$cinder_dellemc_vmax_iscsi_backend_name,

View File

@ -0,0 +1,87 @@
# 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_sc
#
# Cinder Volume dellemc_sc profile for tripleo
#
# === Parameters
#
# [*backend_name*]
# (Optional) Name given to the Cinder backend stanza
# Defaults to 'tripleo_dellemc_sc'
#
# [*multi_config*]
# (Optional) A config hash when multiple backends are used.
# Defaults to hiera('cinder::backend::dellemc_sc::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_sc (
$backend_name = hiera('cinder::backend::dellemc_sc::volume_backend_name', ['tripleo_dellemc_sc']),
$multi_config = hiera('cinder::backend::dellemc_sc::volume_multi_config', {}),
$step = Integer(hiera('step')),
) {
include tripleo::profile::base::cinder::volume
if $step >= 4 {
$backend_defaults = {
'CinderSCAvailabilityZone' => hiera('cinder::backend::dellemc_sc::backend_availability_zone', undef),
'CinderSCSanIp' => hiera('cinder::backend::dellemc_sc::san_ip', undef),
'CinderSCSanLogin' => hiera('cinder::backend::dellemc_sc::san_login', undef),
'CinderSCSanPassword' => hiera('cinder::backend::dellemc_sc::san password', undef),
'CinderSCStorageProtocol' => hiera('cinder::backend::dellemc_sc::sc_storage_protocol', undef),
'CinderSCSSN' => hiera('cinder::backend::dellemc_sc::dell_sc_ssn', undef),
'CinderSCTargetIpAddress' => hiera('cinder::backend::dellemc_sc::iscsi_ip_address', undef),
'CinderSCTargetPort' => hiera('cinder::backend::dellemc_sc::iscsi_port', undef),
'CinderSCApiPort' => hiera('cinder::backend::dellemc_sc::dell_sc_api_port', undef),
'CinderSCServerFolder' => hiera('cinder::backend::dellemc_sc::dell_sc_server_folder', undef),
'CinderSCVolumeFolder' => hiera('cinder::backend::dellemc_sc::dell_sc_volume_folder', undef),
'CinderSCExcludedDomainIps' => hiera('cinder::backend::dellemc_sc::excluded_domain_ips', undef),
'CinderSCSecondarySanIp' => hiera('cinder::backend::dellemc_sc::secondary_san_ip', undef),
'CinderSCSecondarySanLogin' => hiera('cinder::backend::dellemc_sc::secondary_san_login', undef),
'CinderSCSecondarySanPassword' => hiera('cinder::backend::dellemc_sc::secondary_san_password', undef),
'CinderSCSecondaryApiPort' => hiera('cinder::backend::dellemc_sc::secondary_sc_api_port', undef),
'CinderSCUseMultipathForImageXfer' => hiera('cinder::backend::dellemc_sc::use_multipath_for_image_xfer', undef),
}
any2array($backend_name).each |String $backend| {
$backend_config = merge($backend_defaults, pick($multi_config[$backend], {}))
cinder::backend::dellemc_sc { $backend :
backend_availability_zone => $backend_config['CinderSCAvailabilityZone'],
san_ip => $backend_config['CinderSCSanIp'],
san_login => $backend_config['CinderSCSanLogin'],
san_password => $backend_config['CinderSCSanPassword'],
sc_storage_protocol => $backend_config['CinderSCStorageProtocol'],
dell_sc_ssn => $backend_config['CinderSCSSN'],
target_ip_address => $backend_config['CinderSCTargetIpAddress'],
target_port => $backend_config['CinderSCTargetPort'],
dell_sc_api_port => $backend_config['CinderSCApiPort'],
dell_sc_server_folder => $backend_config['CinderSCServerFolder'],
dell_sc_volume_folder => $backend_config['CinderSCVolumeFolder'],
excluded_domain_ips => $backend_config['CinderSCExcludedDomainIps'],
secondary_san_ip => $backend_config['CinderSCSecondarySanIp'],
secondary_san_login => $backend_config['CinderSCSecondarySanLogin'],
secondary_san_password => $backend_config['CinderSCSecondarySanPassword'],
secondary_sc_api_port => $backend_config['CinderSCSecondaryApiPort'],
use_multipath_for_image_xfer => $backend_config['CinderSCUseMultipathForImageXfer'],
}
}
}
}

View File

@ -0,0 +1,5 @@
---
features:
- Add Dell EMC SC 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_sc' do
shared_examples_for 'tripleo::profile::base::cinder::volume::dellemc_sc' 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_sc')
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_sc('tripleo_dellemc_sc')
end
end
context 'with step 4' do
let(:params) { {
:step => 4,
} }
it 'should trigger complete configuration' do
is_expected.to contain_cinder__backend__dellemc_sc('tripleo_dellemc_sc')
end
context 'with multiple backends' do
let(:params) { {
:backend_name => ['tripleo_dellemc_sc_1', 'tripleo_dellemc_sc_2'],
:multi_config => { 'tripleo_dellemc_sc_2' => { 'CinderSCStorageProtocol' => 'FC' }},
:step => 4,
} }
it 'should configure each backend' do
is_expected.to contain_cinder__backend__dellemc_sc('tripleo_dellemc_sc_1')
is_expected.to contain_cinder_config('tripleo_dellemc_sc_1/volume_driver')
.with_value('cinder.volume.drivers.dell_emc.sc.storagecenter_iscsi.SCISCSIDriver')
is_expected.to contain_cinder__backend__dellemc_sc('tripleo_dellemc_sc_2')
is_expected.to contain_cinder_config('tripleo_dellemc_sc_2/volume_driver')
.with_value('cinder.volume.drivers.dell_emc.sc.storagecenter_fc.SCFCDriver')
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_sc'
end
end
end

View File

@ -120,6 +120,34 @@ describe 'tripleo::profile::base::cinder::volume' do
end
end
context 'with only sc' do
before :each do
params.merge!({
:cinder_enable_dellemc_sc_backend => true,
:cinder_enable_iscsi_backend => false,
})
end
it 'should configure only sc' do
is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_sc')
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_sc']
)
end
context 'with multiple sc backends' do
# Step 5's hiera specifies multiple sc backend names
let(:params) { { :step => 5 } }
it 'should enable each backend' do
is_expected.to contain_class('cinder::backends').with(
:enabled_backends => ['tripleo_dellemc_sc_1', 'tripleo_dellemc_sc_2']
)
end
end
end
context 'with only dellsc' do
before :each do
params.merge!({
@ -240,6 +268,7 @@ describe 'tripleo::profile::base::cinder::volume' do
it 'should configure only user backend' do
is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::iscsi')
is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::pure')
is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_sc')
is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellsc')
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')
@ -257,18 +286,20 @@ 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_dellsc_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_sc_backend => true,
:cinder_enable_dellsc_backend => true,
:cinder_enable_netapp_backend => true,
:cinder_enable_vrts_hs_backend => true,
})
end
it 'should configure all backends' do
is_expected.to contain_class('tripleo::profile::base::cinder::volume::iscsi')
is_expected.to contain_class('tripleo::profile::base::cinder::volume::pure')
is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_sc')
is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellsc')
is_expected.to contain_class('tripleo::profile::base::cinder::volume::netapp')
is_expected.to contain_class('tripleo::profile::base::cinder::volume::veritas_hyperscale')
@ -278,7 +309,7 @@ describe 'tripleo::profile::base::cinder::volume' do
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_iscsi', 'tripleo_ceph', 'tripleo_pure', 'tripleo_dellsc',
:enabled_backends => ['tripleo_iscsi', 'tripleo_ceph', 'tripleo_pure', 'tripleo_dellsc', 'tripleo_dellemc_sc',
'tripleo_netapp','tripleo_nfs','Veritas_HyperScale']
)
end

View File

@ -9,3 +9,6 @@ cinder::backend::pure::volume_backend_name:
cinder::backend::dellemc_powermax::volume_backend_name:
- 'tripleo_dellemc_powermax_1'
- 'tripleo_dellemc_powermax_2'
cinder::backend::dellemc_sc::volume_backend_name:
- 'tripleo_dellemc_sc_1'
- 'tripleo_dellemc_sc_2'