Merge "Validate protocols using parameter types"

This commit is contained in:
Zuul 2023-10-18 19:32:49 +00:00 committed by Gerrit Code Review
commit d4112d8a79
11 changed files with 80 additions and 123 deletions

View File

@ -59,24 +59,19 @@ define cinder::backend::dellemc_powermax (
$powermax_array, $powermax_array,
$powermax_srp, $powermax_srp,
$powermax_port_groups, $powermax_port_groups,
$powermax_storage_protocol = 'iSCSI', Enum['iSCSI', 'FC'] $powermax_storage_protocol = 'iSCSI',
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'], $backend_availability_zone = $facts['os_service_default'],
Hash $extra_options = {}, Hash $extra_options = {},
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
) { ) {
include cinder::deps include cinder::deps
include cinder::params include cinder::params
if $powermax_storage_protocol == 'iSCSI' { $volume_driver = $powermax_storage_protocol ? {
$volume_driver = 'cinder.volume.drivers.dell_emc.powermax.iscsi.PowerMaxISCSIDriver' 'FC' => 'cinder.volume.drivers.dell_emc.powermax.fc.PowerMaxFCDriver',
} default => 'cinder.volume.drivers.dell_emc.powermax.iscsi.PowerMaxISCSIDriver',
elsif $powermax_storage_protocol == 'FC' {
$volume_driver = 'cinder.volume.drivers.dell_emc.powermax.fc.PowerMaxFCDriver'
}
else {
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 = join(any2array($powermax_port_groups), ',')

View File

@ -46,25 +46,17 @@ define cinder::backend::dellemc_powerstore (
$san_ip, $san_ip,
$san_login, $san_login,
$san_password, $san_password,
$powerstore_ports = $facts['os_service_default'], $powerstore_ports = $facts['os_service_default'],
$storage_protocol = 'iSCSI', Enum['iSCSI', 'FC'] $storage_protocol = 'iSCSI',
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'], $backend_availability_zone = $facts['os_service_default'],
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
Hash $extra_options = {}, Hash $extra_options = {},
) { ) {
include cinder::deps include cinder::deps
if $storage_protocol == 'iSCSI' { $driver = 'dell_emc.powerstore.driver.PowerStoreDriver'
$driver = 'dell_emc.powerstore.driver.PowerStoreDriver'
}
elsif $storage_protocol == 'FC' {
$driver = 'dell_emc.powerstore.driver.PowerStoreDriver'
}
else {
fail('The cinder::backend::dellemc_powerstore storage_protocol specified is not valid. It should be iSCSI or FC')
}
cinder_config { cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name; "${name}/volume_backend_name": value => $volume_backend_name;

View File

@ -98,35 +98,30 @@ define cinder::backend::dellemc_sc (
$san_login, $san_login,
$san_password, $san_password,
$dell_sc_ssn, $dell_sc_ssn,
$target_ip_address = undef, $target_ip_address = undef,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'], $backend_availability_zone = $facts['os_service_default'],
$dell_sc_api_port = $facts['os_service_default'], $dell_sc_api_port = $facts['os_service_default'],
$dell_sc_server_folder = 'srv', $dell_sc_server_folder = 'srv',
$dell_sc_verify_cert = $facts['os_service_default'], $dell_sc_verify_cert = $facts['os_service_default'],
$dell_sc_volume_folder = 'vol', $dell_sc_volume_folder = 'vol',
$target_port = $facts['os_service_default'], $target_port = $facts['os_service_default'],
$excluded_domain_ips = $facts['os_service_default'], $excluded_domain_ips = $facts['os_service_default'],
$secondary_san_ip = $facts['os_service_default'], $secondary_san_ip = $facts['os_service_default'],
$secondary_san_login = $facts['os_service_default'], $secondary_san_login = $facts['os_service_default'],
$secondary_san_password = $facts['os_service_default'], $secondary_san_password = $facts['os_service_default'],
$secondary_sc_api_port = $facts['os_service_default'], $secondary_sc_api_port = $facts['os_service_default'],
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
$use_multipath_for_image_xfer = true, $use_multipath_for_image_xfer = true,
$sc_storage_protocol = 'iSCSI', Enum['iSCSI', 'FC'] $sc_storage_protocol = 'iSCSI',
Hash $extra_options = {}, Hash $extra_options = {},
) { ) {
include cinder::deps include cinder::deps
if $sc_storage_protocol == 'iSCSI' { $volume_driver = $sc_storage_protocol ? {
$volume_driver = 'cinder.volume.drivers.dell_emc.sc.storagecenter_iscsi.SCISCSIDriver' 'FC' => 'cinder.volume.drivers.dell_emc.sc.storagecenter_fc.SCFCDriver',
} default => 'cinder.volume.drivers.dell_emc.sc.storagecenter_iscsi.SCISCSIDriver',
elsif $sc_storage_protocol == 'FC' {
$volume_driver = 'cinder.volume.drivers.dell_emc.sc.storagecenter_fc.SCFCDriver'
}
else {
fail('The cinder::backend::dellemc_sc sc_storage_protocol specified is not valid. It should be iSCSI or FC')
} }
cinder_config { cinder_config {

View File

@ -67,27 +67,22 @@ define cinder::backend::dellemc_xtremio (
$san_login, $san_login,
$san_password, $san_password,
$xtremio_cluster_name, $xtremio_cluster_name,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'], $backend_availability_zone = $facts['os_service_default'],
$xtremio_array_busy_retry_count = $facts['os_service_default'], $xtremio_array_busy_retry_count = $facts['os_service_default'],
$xtremio_array_busy_retry_interval = $facts['os_service_default'], $xtremio_array_busy_retry_interval = $facts['os_service_default'],
$xtremio_volumes_per_glance_cache = $facts['os_service_default'], $xtremio_volumes_per_glance_cache = $facts['os_service_default'],
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
$xtremio_storage_protocol = 'iSCSI', Enum['iSCSI', 'FC'] $xtremio_storage_protocol = 'iSCSI',
$xtremio_ports = $facts['os_service_default'], $xtremio_ports = $facts['os_service_default'],
Hash $extra_options = {}, Hash $extra_options = {},
) { ) {
include cinder::deps include cinder::deps
if $xtremio_storage_protocol == 'iSCSI' { $driver = $xtremio_storage_protocol ? {
$driver = 'dell_emc.xtremio.XtremIOISCSIDriver' 'FC' => 'dell_emc.xtremio.XtremIOFCDriver',
} default => 'dell_emc.xtremio.XtremIOISCSIDriver',
elsif $xtremio_storage_protocol == 'FC' {
$driver = 'dell_emc.xtremio.XtremIOFCDriver'
}
else {
fail('The cinder::backend::dellemc_xtremio xtremio_storage_protocol specified is not valid. It should be iSCSI or FC')
} }
cinder_config { cinder_config {

View File

@ -70,29 +70,24 @@ define cinder::backend::ibm_svf (
$san_login, $san_login,
$san_password, $san_password,
$storwize_svc_volpool_name, $storwize_svc_volpool_name,
$storwize_svc_allow_tenant_qos = $facts['os_service_default'], $storwize_svc_allow_tenant_qos = $facts['os_service_default'],
$storwize_svc_connection_protocol = 'iSCSI', Enum['iSCSI', 'FC'] $storwize_svc_connection_protocol = 'iSCSI',
$storwize_svc_iscsi_chap_enabled = $facts['os_service_default'], $storwize_svc_iscsi_chap_enabled = $facts['os_service_default'],
$storwize_svc_retain_aux_volume = $facts['os_service_default'], $storwize_svc_retain_aux_volume = $facts['os_service_default'],
$storwize_portset = $facts['os_service_default'], $storwize_portset = $facts['os_service_default'],
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'], $backend_availability_zone = $facts['os_service_default'],
Hash $extra_options = {}, Hash $extra_options = {},
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
) { ) {
include cinder::deps include cinder::deps
# NOTE: Svf was earlier called as storwize/svc driver, so the cinder # NOTE: Svf was earlier called as storwize/svc driver, so the cinder
# configuration parameters were named accordingly. # configuration parameters were named accordingly.
if $storwize_svc_connection_protocol == 'iSCSI' { $volume_driver = $storwize_svc_connection_protocol ? {
$volume_driver = 'cinder.volume.drivers.ibm.storwize_svc.storwize_svc_iscsi.StorwizeSVCISCSIDriver' 'FC' => 'cinder.volume.drivers.ibm.storwize_svc.storwize_svc_fc.StorwizeSVCFCDriver',
} default => 'cinder.volume.drivers.ibm.storwize_svc.storwize_svc_iscsi.StorwizeSVCISCSIDriver',
elsif $storwize_svc_connection_protocol == 'FC' {
$volume_driver = 'cinder.volume.drivers.ibm.storwize_svc.storwize_svc_fc.StorwizeSVCFCDriver'
}
else {
fail('The cinder::backend::ibm_svf storwize_svc_connection_protocol specified is not valid. It should be iSCSI or FC')
} }
cinder_config { cinder_config {

View File

@ -95,34 +95,29 @@
define cinder::backend::pure( define cinder::backend::pure(
$san_ip, $san_ip,
$pure_api_token, $pure_api_token,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $facts['os_service_default'], $backend_availability_zone = $facts['os_service_default'],
$pure_storage_protocol = 'iSCSI', Enum['iSCSI', 'FC', 'NVMe'] $pure_storage_protocol = 'iSCSI',
$use_chap_auth = false, $use_chap_auth = false,
$use_multipath_for_image_xfer = true, $use_multipath_for_image_xfer = true,
Boolean $manage_volume_type = false, Boolean $manage_volume_type = false,
$image_volume_cache_enabled = true, $image_volume_cache_enabled = true,
$pure_host_personality = $facts['os_service_default'], $pure_host_personality = $facts['os_service_default'],
$pure_eradicate_on_delete = $facts['os_service_default'], $pure_eradicate_on_delete = $facts['os_service_default'],
$pure_nvme_transport = $facts['os_service_default'], $pure_nvme_transport = $facts['os_service_default'],
$pure_nvme_cidr = $facts['os_service_default'], $pure_nvme_cidr = $facts['os_service_default'],
$pure_nvme_cidr_list = $facts['os_service_default'], $pure_nvme_cidr_list = $facts['os_service_default'],
$pure_iscsi_cidr = $facts['os_service_default'], $pure_iscsi_cidr = $facts['os_service_default'],
$pure_iscsi_cidr_list = $facts['os_service_default'], $pure_iscsi_cidr_list = $facts['os_service_default'],
Hash $extra_options = {}, Hash $extra_options = {},
) { ) {
include cinder::deps include cinder::deps
$volume_driver = $pure_storage_protocol ? { $volume_driver = $pure_storage_protocol ? {
'FC' => 'cinder.volume.drivers.pure.PureFCDriver', 'FC' => 'cinder.volume.drivers.pure.PureFCDriver',
'iSCSI' => 'cinder.volume.drivers.pure.PureISCSIDriver',
'NVMe' => 'cinder.volume.drivers.pure.PureNVMEDriver', 'NVMe' => 'cinder.volume.drivers.pure.PureNVMEDriver',
default => undef, default => 'cinder.volume.drivers.pure.PureISCSIDriver',
}
if ! $volume_driver {
fail('Invalid pure_storage_protocol. It should be FC, iSCSI or NVMe')
} }
cinder_config { cinder_config {

View File

@ -75,9 +75,7 @@ describe 'cinder::backend::dellemc_powermax' do
end end
it 'should raise an error' do it 'should raise an error' do
is_expected.to compile.and_raise_error( is_expected.to compile.and_raise_error(/Evaluation Error/)
/The cinder::backend::dellemc_powermax powermax_storage_protocol specified is not valid. It should be iSCSI or FC/
)
end end
end end

View File

@ -66,9 +66,7 @@ describe 'cinder::backend::dellemc_powerstore' do
end end
it 'should raise an error' do it 'should raise an error' do
is_expected.to compile.and_raise_error( is_expected.to compile.and_raise_error(/Evaluation Error/)
/The cinder::backend::dellemc_powerstore storage_protocol specified is not valid. It should be iSCSI or FC/
)
end end
end end
end end

View File

@ -84,9 +84,7 @@ describe 'cinder::backend::dellemc_sc' do
end end
it 'should raise an error' do it 'should raise an error' do
is_expected.to compile.and_raise_error( is_expected.to compile.and_raise_error(/Evaluation Error/)
/The cinder::backend::dellemc_sc sc_storage_protocol specified is not valid. It should be iSCSI or FC/
)
end end
end end

View File

@ -69,9 +69,7 @@ describe 'cinder::backend::dellemc_xtremio' do
end end
it 'should raise an error' do it 'should raise an error' do
is_expected.to compile.and_raise_error( is_expected.to compile.and_raise_error(/Evaluation Error/)
/The cinder::backend::dellemc_xtremio xtremio_storage_protocol specified is not valid. It should be iSCSI or FC/
)
end end
end end

View File

@ -51,9 +51,7 @@ describe 'cinder::backend::ibm_svf' do
end end
it 'should raise an error' do it 'should raise an error' do
is_expected.to compile.and_raise_error( is_expected.to compile.and_raise_error(/Evaluation Error/)
/The cinder::backend::ibm_svf storwize_svc_connection_protocol specified is not valid. It should be iSCSI or FC/
)
end end
end end