Merge "Support configuring multiple Dell EMC VNX cinder backends"

This commit is contained in:
Zuul 2022-06-06 02:56:34 +00:00 committed by Gerrit Code Review
commit 602e23fce7
6 changed files with 88 additions and 22 deletions

View File

@ -19,8 +19,12 @@
# === Parameters
#
# [*backend_name*]
# (Optional) Name given to the Cinder backend stanza
# Defaults to lookup('cinder::backend::emc_vnx::volume_backend_name', undef, undef, 'tripleo_dellemc_vnx')
# (Optional) List of names given to the Cinder backend stanza
# Defaults to lookup('cinder::backend::emc_vnx::volume_backend_name', undef, undef, ['tripleo_dellemc_vnx'])
#
# [*multi_config*]
# (Optional) A config hash when multiple backends are used.
# Defaults to lookup('cinder::backend::emc_vnx::volume_multi_config', undef, undef, {})
#
# [*step*]
# (Optional) The current step in deployment. See tripleo-heat-templates
@ -28,31 +32,45 @@
# Defaults to Integer(lookup('step'))
#
class tripleo::profile::base::cinder::volume::dellemc_vnx (
$backend_name = lookup('cinder::backend::emc_vnx::volume_backend_name', undef, undef, 'tripleo_dellemc_vnx'),
$backend_name = lookup('cinder::backend::emc_vnx::volume_backend_name', undef, undef, ['tripleo_dellemc_vnx']),
$multi_config = lookup('cinder::backend::emc_vnx::volume_multi_config', undef, undef, {}),
$step = Integer(lookup('step')),
) {
include tripleo::profile::base::cinder::volume
if $step >= 4 {
# Accept recently deprecated 'storage_vnx_pool_name'
$storage_vnx_pool_names_real = pick(lookup('cinder::backend::emc_vnx::storage_vnx_pool_names', undef, undef,
lookup('cinder::backend::emc_vnx::storage_vnx_pool_name',
undef, undef, undef)))
$backend_defaults = {
'CinderDellEMCVNXAvailabilityZone' => lookup('cinder::backend::emc_vnx::backend_availability_zone', undef, undef, undef),
'CinderDellEMCVNXSanIp' => lookup('cinder::backend::emc_vnx::san_ip', undef, undef, undef),
'CinderDellEMCVNXSanLogin' => lookup('cinder::backend::emc_vnx::san_login', undef, undef, undef),
'CinderDellEMCVNXSanPassword' => lookup('cinder::backend::emc_vnx::san_password', undef, undef, undef),
'CinderDellEMCVNXStorageProtocol' => lookup('cinder::backend::emc_vnx::storage_protocol', undef, undef, undef),
'CinderDellEMCVNXStoragePoolNames' => lookup('cinder::backend::emc_vnx::storage_vnx_pool_names', undef, undef, undef),
'CinderDellEMCVNXDefaultTimeout' => lookup('cinder::backend::emc_vnx::default_timeout', undef, undef, undef),
'CinderDellEMCVNXMaxLunsPerStorageGroup' => lookup('cinder::backend::emc_vnx::max_luns_per_storage_group', undef, undef, undef),
'CinderDellEMCVNXInitiatorAutoRegistration' => lookup('cinder::backend::emc_vnx::initiator_auto_registration', undef, undef, undef),
'CinderDellEMCVNXAuthType' => lookup('cinder::backend::emc_vnx::storage_vnx_auth_type', undef, undef, undef),
'CinderDellEMCVNXStorageSecurityFileDir' => lookup('cinder::backend::emc_vnx::storage_vnx_security_file_dir', undef, undef, undef),
'CinderDellEMCVNXNaviseccliPath' => lookup('cinder::backend::emc_vnx::naviseccli_path', undef, undef, undef),
}
any2array($backend_name).each |String $backend| {
$backend_config = merge($backend_defaults, pick($multi_config[$backend], {}))
create_resources('cinder::backend::emc_vnx', { $backend_name => delete_undef_values({
'backend_availability_zone' => lookup('cinder::backend::emc_vnx::backend_availability_zone', undef, undef, undef),
'san_ip' => lookup('cinder::backend::emc_vnx::san_ip', undef, undef, undef),
'san_login' => lookup('cinder::backend::emc_vnx::san_login', undef, undef, undef),
'san_password' => lookup('cinder::backend::emc_vnx::san_password', undef, undef, undef),
'storage_protocol' => lookup('cinder::backend::emc_vnx::storage_protocol', undef, undef, undef),
'storage_vnx_pool_names' => lookup('cinder::backend::emc_vnx::storage_vnx_pool_names', undef, undef, undef),
'default_timeout' => lookup('cinder::backend::emc_vnx::default_timeout', undef, undef, undef),
'max_luns_per_storage_group' => lookup('cinder::backend::emc_vnx::max_luns_per_storage_group', undef, undef, undef),
'initiator_auto_registration' => lookup('cinder::backend::emc_vnx::initiator_auto_registration', undef, undef, undef),
'storage_vnx_auth_type' => lookup('cinder::backend::emc_vnx::storage_vnx_auth_type', undef, undef, undef),
'storage_vnx_security_file_dir' => lookup('cinder::backend::emc_vnx::storage_vnx_security_file_dir', undef, undef, undef),
'naviseccli_path' => lookup('cinder::backend::emc_vnx::naviseccli_path', undef, undef, undef),
})})
create_resources('cinder::backend::emc_vnx', { $backend => delete_undef_values({
'backend_availability_zone' => $backend_config['CinderDellEMCVNXAvailabilityZone'],
'san_ip' => $backend_config['CinderDellEMCVNXSanIp'],
'san_login' => $backend_config['CinderDellEMCVNXSanLogin'],
'san_password' => $backend_config['CinderDellEMCVNXSanPassword'],
'storage_protocol' => $backend_config['CinderDellEMCVNXStorageProtocol'],
'storage_vnx_pool_names' => $backend_config['CinderDellEMCVNXStoragePoolNames'],
'default_timeout' => $backend_config['CinderDellEMCVNXDefaultTimeout'],
'max_luns_per_storage_group' => $backend_config['CinderDellEMCVNXMaxLunsPerStorageGroup'],
'initiator_auto_registration' => $backend_config['CinderDellEMCVNXInitiatorAutoRegistration'],
'storage_vnx_auth_type' => $backend_config['CinderDellEMCVNXAuthType'],
'storage_vnx_security_file_dir' => $backend_config['CinderDellEMCVNXStorageSecurityFileDir'],
'naviseccli_path' => $backend_config['CinderDellEMCVNXNaviseccliPath'],
})})
}
}
}

View File

@ -41,6 +41,23 @@ describe 'tripleo::profile::base::cinder::volume::dellemc_vnx' do
# TODO(aschultz): check hiera parameters
is_expected.to contain_cinder__backend__emc_vnx('tripleo_dellemc_vnx')
end
context 'with multiple backends' do
let(:params) { {
:backend_name => ['tripleo_dellemc_vnx_1', 'tripleo_dellemc_vnx_2'],
:multi_config => { 'tripleo_dellemc_vnx_2' => { 'CinderDellEMCVNXStorageProtocol' => 'FC' }},
:step => 4,
} }
it 'should configure each backend' do
is_expected.to contain_cinder__backend__emc_vnx('tripleo_dellemc_vnx_1')
is_expected.to contain_cinder_config('tripleo_dellemc_vnx_1/volume_driver')
.with_value('cinder.volume.drivers.dell_emc.vnx.driver.VNXDriver')
is_expected.to contain_cinder_config('tripleo_dellemc_vnx_1/storage_protocol')
.with_value('iscsi')
is_expected.to contain_cinder__backend__emc_vnx('tripleo_dellemc_vnx_2')
is_expected.to contain_cinder_config('tripleo_dellemc_vnx_2/storage_protocol')
.with_value('FC')
end
end
end
end

View File

@ -233,6 +233,34 @@ describe 'tripleo::profile::base::cinder::volume' do
end
end
context 'with only vnx' do
before :each do
params.merge!({
:cinder_enable_dellemc_vnx_backend => true,
:cinder_enable_iscsi_backend => false,
})
end
it 'should configure only vnx' do
is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_vnx')
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_vnx']
)
end
context 'with multiple vnx backends' do
# Step 5's hiera specifies multiple vnx backend names
let(:params) { { :step => 5 } }
it 'should enable each backend' do
is_expected.to contain_class('cinder::backends').with(
:enabled_backends => ['tripleo_dellemc_vnx_1', 'tripleo_dellemc_vnx_2']
)
end
end
end
context 'with only dellsc' do
before :each do
params.merge!({

View File

@ -66,6 +66,7 @@ cinder::backend::dellsc_iscsi::san_password: 'password'
cinder::backend::dellsc_iscsi::dell_sc_ssn: '64720'
cinder::backend::emc_vnx::san_ip: '127.0.0.2'
cinder::backend::emc_vnx::san_password: 'password'
cinder::backend::emc_vnx::storage_vnx_pool_names: 'emc-storage-pool'
cinder::backend::netapp::netapp_login: 'netapp'
cinder::backend::netapp::netapp_password: 'password'
cinder::backend::netapp::netapp_server_hostname: '127.0.0.2'

View File

@ -6,4 +6,3 @@ tripleo::profile::base::cinder::volume::iscsi::cinder_iscsi_address: '127.0.0.1'
tripleo::profile::base::cinder::volume::nfs::cinder_nfs_servers:
- '127.0.0.1'
cinder::backend::dellsc_iscsi::iscsi_ip_address: '127.0.0.1'
cinder::backend::emc_vnx::storage_vnx_pool_names: 'emc-storage-pool'

View File

@ -25,6 +25,9 @@ cinder::backend::dellemc_sc::volume_backend_name:
cinder::backend::dellemc_unity::volume_backend_name:
- 'tripleo_dellemc_unity_1'
- 'tripleo_dellemc_unity_2'
cinder::backend::emc_vnx::volume_backend_name:
- 'tripleo_dellemc_vnx_1'
- 'tripleo_dellemc_vnx_2'
cinder::backend::dellemc_xtremio::volume_backend_name:
- 'tripleo_dellemc_xtremio_1'
- 'tripleo_dellemc_xtremio_2'