Merge "powermax: Support array for powermax_port_groups"

This commit is contained in:
Zuul 2023-10-18 17:46:06 +00:00 committed by Gerrit Code Review
commit 5b379942a6
2 changed files with 25 additions and 1 deletions

View File

@ -79,6 +79,12 @@ define cinder::backend::dellemc_powermax (
fail('The cinder::backend::dellemc_powermax powermax_storage_protocol specified is not valid. It should be iSCSI or FC')
}
$_powermax_port_groups = join(any2array($powermax_port_groups), ',')
$powermax_port_groups_real = $_powermax_port_groups ? {
/^\[.*\]$/ => $_powermax_port_groups,
default => "[${_powermax_port_groups}]"
}
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/backend_availability_zone": value => $backend_availability_zone;
@ -88,7 +94,7 @@ define cinder::backend::dellemc_powermax (
"${name}/san_password": value => $san_password, secret => true;
"${name}/powermax_array": value => $powermax_array;
"${name}/powermax_srp": value => $powermax_srp;
"${name}/powermax_port_groups": value => $powermax_port_groups;
"${name}/powermax_port_groups": value => $powermax_port_groups_real;
}
if $manage_volume_type {

View File

@ -39,6 +39,24 @@ describe 'cinder::backend::dellemc_powermax' do
end
end
context 'with powermax_port_groups without bounds' do
before do
params.merge!(:powermax_port_groups => 'OS-ISCSI-PG')
end
it 'should add bounds' do
is_expected.to contain_cinder_config("#{title}/powermax_port_groups").with_value('[OS-ISCSI-PG]')
end
end
context 'with powermax_port_groups set by a list' do
before do
params.merge!(:powermax_port_groups => ['OS-ISCSI-PG1', 'OS-ISCSI-PG2'])
end
it 'should render a comma-separated list with bounds' do
is_expected.to contain_cinder_config("#{title}/powermax_port_groups").with_value('[OS-ISCSI-PG1,OS-ISCSI-PG2]')
end
end
context 'with powermax_storage_protocol set to FC' do
before do
params.merge!(:powermax_storage_protocol => 'FC',)