Merge "Support configuring multiple Dell EMC Unity cinder backends"
This commit is contained in:
commit
5f7136dc89
|
@ -19,8 +19,12 @@
|
|||
# === Parameters
|
||||
#
|
||||
# [*backend_name*]
|
||||
# (Optional) Name given to the Cinder backend stanza
|
||||
# Defaults to lookup('cinder::backend::dellemc_unity::volume_backend_name', undef, undef, 'tripleo_dellemc_unity')
|
||||
# (Optional) List of names given to the Cinder backend stanza.
|
||||
# Defaults to lookup('cinder::backend::dellemc_unity::volume_backend_name', undef, undef, ['tripleo_dellemc_unity'])
|
||||
#
|
||||
# [*multi_config*]
|
||||
# (Optional) A config hash when multiple backends are used.
|
||||
# Defaults to lookup('cinder::backend::dellemc_unity::volume_multi_config', undef, undef, {})
|
||||
#
|
||||
# [*step*]
|
||||
# (Optional) The current step in deployment. See tripleo-heat-templates
|
||||
|
@ -28,21 +32,35 @@
|
|||
# Defaults to Integer(lookup('step'))
|
||||
#
|
||||
class tripleo::profile::base::cinder::volume::dellemc_unity (
|
||||
$backend_name = lookup('cinder::backend::dellemc_unity::volume_backend_name', undef, undef, 'tripleo_dellemc_unity'),
|
||||
$backend_name = lookup('cinder::backend::dellemc_unity::volume_backend_name', undef, undef, ['tripleo_dellemc_unity']),
|
||||
$multi_config = lookup('cinder::backend::dellemc_unity::volume_multi_config', undef, undef, {}),
|
||||
$step = Integer(lookup('step')),
|
||||
) {
|
||||
include tripleo::profile::base::cinder::volume
|
||||
|
||||
if $step >= 4 {
|
||||
create_resources('cinder::backend::dellemc_unity', { $backend_name => delete_undef_values({
|
||||
'backend_availability_zone' => lookup('cinder::backend::dellemc_unity::backend_availability_zone', undef, undef, undef),
|
||||
'san_ip' => lookup('cinder::backend::dellemc_unity::san_ip', undef, undef, undef),
|
||||
'san_login' => lookup('cinder::backend::dellemc_unity::san_login', undef, undef, undef),
|
||||
'san_password' => lookup('cinder::backend::dellemc_unity::san_password', undef, undef, undef),
|
||||
'storage_protocol' => lookup('cinder::backend::dellemc_unity::storage_protocol', undef, undef, undef),
|
||||
'unity_io_ports' => lookup('cinder::backend::dellemc_unity::unity_io_ports', undef, undef, undef),
|
||||
'unity_storage_pool_names' => lookup('cinder::backend::dellemc_unity::unity_storage_pool_names', undef, undef, undef),
|
||||
})})
|
||||
$backend_defaults = {
|
||||
'CinderDellEMCUnityAvailabilityZone' => lookup('cinder::backend::dellemc_unity::backend_availability_zone', undef, undef, undef),
|
||||
'CinderDellEMCUnitySanIp' => lookup('cinder::backend::dellemc_unity::san_ip', undef, undef, undef),
|
||||
'CinderDellEMCUnitySanLogin' => lookup('cinder::backend::dellemc_unity::san_login', undef, undef, undef),
|
||||
'CinderDellEMCUnitySanPassword' => lookup('cinder::backend::dellemc_unity::san_password', undef, undef, undef),
|
||||
'CinderDellEMCUnityStorageProtocol' => lookup('cinder::backend::dellemc_unity::storage_protocol', undef, undef, undef),
|
||||
'CinderDellEMCUnityIoPorts' => lookup('cinder::backend::dellemc_unity::unity_io_ports', undef, undef, undef),
|
||||
'CinderDellEMCUnityStoragePoolNames' => lookup('cinder::backend::dellemc_unity::unity_storage_pool_names', undef, undef, undef),
|
||||
}
|
||||
any2array($backend_name).each |String $backend| {
|
||||
$backend_config = merge($backend_defaults, pick($multi_config[$backend], {}))
|
||||
|
||||
create_resources('cinder::backend::dellemc_unity', { $backend => delete_undef_values({
|
||||
'backend_availability_zone' => $backend_config['CinderDellEMCUnityAvailabilityZone'],
|
||||
'san_ip' => $backend_config['CinderDellEMCUnitySanIp'],
|
||||
'san_login' => $backend_config['CinderDellEMCUnitySanLogin'],
|
||||
'san_password' => $backend_config['CinderDellEMCUnitySanPassword'],
|
||||
'storage_protocol' => $backend_config['CinderDellEMCUnityStorageProtocol'],
|
||||
'unity_io_ports' => $backend_config['CinderDellEMCUnityIoPorts'],
|
||||
'unity_storage_pool_names' => $backend_config['CinderDellEMCUnityStoragePoolNames'],
|
||||
})})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,10 +41,26 @@ describe 'tripleo::profile::base::cinder::volume::dellemc_unity' do
|
|||
# TODO(aschultz): check hiera parameters
|
||||
is_expected.to contain_cinder__backend__dellemc_unity('tripleo_dellemc_unity')
|
||||
end
|
||||
context 'with multiple backends' do
|
||||
let(:params) { {
|
||||
:backend_name => ['tripleo_dellemc_unity_1', 'tripleo_dellemc_unity_2'],
|
||||
:multi_config => { 'tripleo_dellemc_unity_2' => { 'CinderDellEMCUnityStorageProtocol' => 'FC' }},
|
||||
:step => 4,
|
||||
} }
|
||||
it 'should configure each backend' do
|
||||
is_expected.to contain_cinder__backend__dellemc_unity('tripleo_dellemc_unity_1')
|
||||
is_expected.to contain_cinder_config('tripleo_dellemc_unity_1/volume_driver')
|
||||
.with_value('cinder.volume.drivers.dell_emc.unity.Driver')
|
||||
is_expected.to contain_cinder_config('tripleo_dellemc_unity_1/storage_protocol')
|
||||
.with_value('iSCSI')
|
||||
is_expected.to contain_cinder__backend__dellemc_unity('tripleo_dellemc_unity_2')
|
||||
is_expected.to contain_cinder_config('tripleo_dellemc_unity_2/storage_protocol')
|
||||
.with_value('FC')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
on_supported_os.each do |os, facts|
|
||||
context "on #{os}" do
|
||||
let(:facts) do
|
||||
|
|
|
@ -205,6 +205,34 @@ describe 'tripleo::profile::base::cinder::volume' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'with only unity' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
:cinder_enable_dellemc_unity_backend => true,
|
||||
:cinder_enable_iscsi_backend => false,
|
||||
})
|
||||
end
|
||||
it 'should configure only unity' do
|
||||
is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_unity')
|
||||
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_unity']
|
||||
)
|
||||
end
|
||||
context 'with multiple unity backends' do
|
||||
# Step 5's hiera specifies multiple unity backend names
|
||||
let(:params) { { :step => 5 } }
|
||||
it 'should enable each backend' do
|
||||
is_expected.to contain_class('cinder::backends').with(
|
||||
:enabled_backends => ['tripleo_dellemc_unity_1', 'tripleo_dellemc_unity_2']
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with only dellsc' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
|
|
|
@ -22,6 +22,9 @@ cinder::backend::dellemc_powerstore::volume_backend_name:
|
|||
cinder::backend::dellemc_sc::volume_backend_name:
|
||||
- 'tripleo_dellemc_sc_1'
|
||||
- 'tripleo_dellemc_sc_2'
|
||||
cinder::backend::dellemc_unity::volume_backend_name:
|
||||
- 'tripleo_dellemc_unity_1'
|
||||
- 'tripleo_dellemc_unity_2'
|
||||
cinder::backend::dellemc_xtremio::volume_backend_name:
|
||||
- 'tripleo_dellemc_xtremio_1'
|
||||
- 'tripleo_dellemc_xtremio_2'
|
||||
|
|
Loading…
Reference in New Issue