powermax: Support array for powermax_port_groups
The powermax_port_groups option accepts a comma-separated list with bounds. This allows users to use an array value to define the value used for this option. Now the logic adds bounds ([]) in case a string value is given but the value does not contain bounds. Change-Id: I9b747509f7e13b05a1c0e1096733f7beb477033f
This commit is contained in:
parent
e4bac84648
commit
aaadd0ec50
|
@ -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 {
|
||||
|
|
|
@ -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',)
|
||||
|
|
Loading…
Reference in New Issue