Deprecate several iscsi_XXX parameters

Cinder removed support for several previously deprecated parameter
names [1], and this patch switches to using the actual name.

Deprecated Name   Parameter Name
----------------  -----------------
iscsi_ip_address  target_ip_address
iscsi_port        target_port
iscsi_helper      target_helper
iscsi_protocol    target_protocol

[1] https://review.openstack.org/595318

Partial-Bug: #1801081
Change-Id: I355298aaa7e48d242ad05b8c931ee9d41339185f
This commit is contained in:
Alan Bishop 2018-10-31 10:47:16 -04:00
parent f0708f4ec5
commit 23d622ba36
9 changed files with 267 additions and 65 deletions

View File

@ -93,7 +93,7 @@ class { 'cinder::volume': }
cinder::backend::iscsi { cinder::backend::iscsi {
'iscsi_example': 'iscsi_example':
iscsi_ip_address => '10.0.0.2', target_ip_address => '10.0.0.2',
} }
``` ```
@ -108,20 +108,20 @@ class { 'cinder':
class { 'cinder::volume': } class { 'cinder::volume': }
cinder::backend::iscsi {'iscsi1': cinder::backend::iscsi {'iscsi1':
iscsi_ip_address => '10.0.0.2', target_ip_address => '10.0.0.2',
} }
cinder::backend::iscsi {'iscsi2': cinder::backend::iscsi {'iscsi2':
iscsi_ip_address => '10.0.0.3', target_ip_address => '10.0.0.3',
} }
cinder::backend::iscsi {'iscsi3': cinder::backend::iscsi {'iscsi3':
iscsi_ip_address => '10.0.0.4', target_ip_address => '10.0.0.4',
volume_backend_name => 'iscsi', volume_backend_name => 'iscsi',
} }
cinder::backend::iscsi {'iscsi4': cinder::backend::iscsi {'iscsi4':
iscsi_ip_address => '10.0.0.5', target_ip_address => '10.0.0.5',
volume_backend_name => 'iscsi', volume_backend_name => 'iscsi',
} }

View File

@ -5,13 +5,17 @@
# #
# === Parameters: # === Parameters:
# #
# [*iscsi_ip_address*]
# (Required) The IP address that the iSCSI daemon is listening on
#
# [*available_devices*] # [*available_devices*]
# (Required) List of all available devices. Real hard disks. # (Required) List of all available devices. Real hard disks.
# Should be a string. # Should be a string.
# #
# [*target_ip_address*]
# (optional) The IP address that the iSCSI daemon is listening on.
# If not set, the iscsi_ip_address must be specified. The target_ip_address
# will be required once the deprecated iscsi_ip_address parameter is
# removed in a future release.
# Defaults to undef.
#
# [*volume_backend_name*] # [*volume_backend_name*]
# (optional) Allows for the volume_backend_name to be separate of $name. # (optional) Allows for the volume_backend_name to be separate of $name.
# Defaults to: $name # Defaults to: $name
@ -34,11 +38,11 @@
# (Optional) Volume configuration file storage directory # (Optional) Volume configuration file storage directory
# Defaults to '/var/lib/cinder/volumes'. # Defaults to '/var/lib/cinder/volumes'.
# #
# [*iscsi_helper*] # [*target_helper*]
# (Optional) iSCSI target user-land tool to use. # (Optional) iSCSI target user-land tool to use.
# Defaults to tgtadm. # Defaults to tgtadm.
# #
# [*iscsi_protocol*] # [*target_protocol*]
# (Optional) Protocol to use as iSCSI driver # (Optional) Protocol to use as iSCSI driver
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
@ -65,23 +69,41 @@
# available_devices => '/dev/sda,/dev/sdb' # available_devices => '/dev/sda,/dev/sdb'
# } # }
# #
# DEPRECATED PARAMETERS
#
# [*iscsi_ip_address*]
# (Optional) The IP address that the iSCSI daemon is listening on
# Defaults to undef.
#
# [*iscsi_helper*]
# (Optional) iSCSI target user-land tool to use.
# Defaults to undef.
#
# [*iscsi_protocol*]
# (Optional) Protocol to use as iSCSI driver
# Defaults to undef.
#
# === Authors # === Authors
# #
# Denis Egorenko <degorenko@mirantis.com> # Denis Egorenko <degorenko@mirantis.com>
# #
define cinder::backend::bdd ( define cinder::backend::bdd (
$iscsi_ip_address,
$available_devices, $available_devices,
$target_ip_address = undef,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $::os_service_default, $backend_availability_zone = $::os_service_default,
$volume_driver = 'cinder.volume.drivers.block_device.BlockDeviceDriver', $volume_driver = 'cinder.volume.drivers.block_device.BlockDeviceDriver',
$volume_group = $::os_service_default, $volume_group = $::os_service_default,
$volumes_dir = '/var/lib/cinder/volumes', $volumes_dir = '/var/lib/cinder/volumes',
$iscsi_helper = 'tgtadm', $target_helper = 'tgtadm',
$iscsi_protocol = $::os_service_default, $target_protocol = $::os_service_default,
$volume_clear = $::os_service_default, $volume_clear = $::os_service_default,
$manage_volume_type = false, $manage_volume_type = false,
$extra_options = {}, $extra_options = {},
# DEPRECATED PARAMETERS
$iscsi_ip_address = undef,
$iscsi_helper = undef,
$iscsi_protocol = undef,
) { ) {
include ::cinder::deps include ::cinder::deps
@ -91,17 +113,39 @@ define cinder::backend::bdd (
warning('Cinder block device driver is deprecated. Please use LVM backend') warning('Cinder block device driver is deprecated. Please use LVM backend')
} }
if $target_ip_address or $iscsi_ip_address {
if $iscsi_ip_address {
warning('The iscsi_ip_address parameter is deprecated, use target_ip_address instead.')
}
$target_ip_address_real = pick($target_ip_address, $iscsi_ip_address)
} else {
fail('A target_ip_address or iscsi_ip_address must be specified.')
}
if $iscsi_helper {
warning('The iscsi_helper parameter is deprecated, use target_helper instead.')
$target_helper_real = $iscsi_helper
} else {
$target_helper_real = $target_helper
}
if $iscsi_protocol {
warning('The iscsi_protocol parameter is deprecated, use target_protocol instead.')
$target_protocol_real = $iscsi_protocol
} else {
$target_protocol_real = $target_protocol
}
cinder_config { cinder_config {
"${name}/available_devices": value => $available_devices; "${name}/available_devices": value => $available_devices;
"${name}/volume_backend_name": value => $volume_backend_name; "${name}/volume_backend_name": value => $volume_backend_name;
"${name}/backend_availability_zone": value => $backend_availability_zone; "${name}/backend_availability_zone": value => $backend_availability_zone;
"${name}/volume_driver": value => $volume_driver; "${name}/volume_driver": value => $volume_driver;
"${name}/iscsi_ip_address": value => $iscsi_ip_address; "${name}/target_ip_address": value => $target_ip_address_real;
"${name}/iscsi_helper": value => $iscsi_helper; "${name}/target_helper": value => $target_helper_real;
"${name}/volume_group": value => $volume_group; "${name}/volume_group": value => $volume_group;
"${name}/volumes_dir": value => $volumes_dir; "${name}/volumes_dir": value => $volumes_dir;
"${name}/iscsi_protocol": value => $iscsi_protocol; "${name}/target_protocol": value => $target_protocol_real;
"${name}/volume_clear": value => $volume_clear; "${name}/volume_clear": value => $volume_clear;
} }
@ -114,7 +158,7 @@ define cinder::backend::bdd (
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
case $iscsi_helper { case $target_helper_real {
'tgtadm': { 'tgtadm': {
ensure_packages('tgt', { ensure_packages('tgt', {
ensure => present, ensure => present,
@ -149,7 +193,7 @@ define cinder::backend::bdd (
} }
default: { default: {
fail("Unsupported iscsi helper: ${iscsi_helper}.") fail("Unsupported target helper: ${target_helper_real}.")
} }
} }

View File

@ -13,12 +13,16 @@
# [*san_password*] # [*san_password*]
# (required) Enterprise Manager user password. # (required) Enterprise Manager user password.
# #
# [*iscsi_ip_address*]
# (required) The Storage Center iSCSI IP address.
#
# [*dell_sc_ssn*] # [*dell_sc_ssn*]
# (required) The Storage Center serial number to use. # (required) The Storage Center serial number to use.
# #
# [*target_ip_address*]
# (optional) The IP address that the iSCSI daemon is listening on.
# If not set, the iscsi_ip_address must be specified. The target_ip_address
# will be required once the deprecated iscsi_ip_address parameter is
# removed in a future release.
# Defaults to undef.
#
# [*volume_backend_name*] # [*volume_backend_name*]
# (optional) The storage backend name. # (optional) The storage backend name.
# Defaults to the name of the backend # Defaults to the name of the backend
@ -45,7 +49,7 @@
# (optional) Name of the volume folder to use on the Storage Center. # (optional) Name of the volume folder to use on the Storage Center.
# Defaults to 'vol' # Defaults to 'vol'
# #
# [*iscsi_port*] # [*target_port*]
# (optional) The ISCSI IP Port of the Storage Center. # (optional) The ISCSI IP Port of the Storage Center.
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
@ -91,19 +95,27 @@
# (optional) Domain IP to be excluded from iSCSI returns of Storage Center. # (optional) Domain IP to be excluded from iSCSI returns of Storage Center.
# Defaults to undef. # Defaults to undef.
# #
# [*iscsi_ip_address*]
# (Optional) The IP address that the iSCSI daemon is listening on
# Defaults to undef.
#
# [*iscsi_port*]
# (Optional) iSCSI target user-land tool to use.
# Defaults to undef.
#
define cinder::backend::dellsc_iscsi ( define cinder::backend::dellsc_iscsi (
$san_ip, $san_ip,
$san_login, $san_login,
$san_password, $san_password,
$iscsi_ip_address,
$dell_sc_ssn, $dell_sc_ssn,
$target_ip_address = undef,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $::os_service_default, $backend_availability_zone = $::os_service_default,
$dell_sc_api_port = $::os_service_default, $dell_sc_api_port = $::os_service_default,
$dell_sc_server_folder = 'srv', $dell_sc_server_folder = 'srv',
$dell_sc_verify_cert = $::os_service_default, $dell_sc_verify_cert = $::os_service_default,
$dell_sc_volume_folder = 'vol', $dell_sc_volume_folder = 'vol',
$iscsi_port = $::os_service_default, $target_port = $::os_service_default,
$excluded_domain_ips = $::os_service_default, $excluded_domain_ips = $::os_service_default,
$secondary_san_ip = $::os_service_default, $secondary_san_ip = $::os_service_default,
$secondary_san_login = $::os_service_default, $secondary_san_login = $::os_service_default,
@ -114,6 +126,8 @@ define cinder::backend::dellsc_iscsi (
$extra_options = {}, $extra_options = {},
# DEPRECATED PARAMETERS # DEPRECATED PARAMETERS
$excluded_domain_ip = undef, $excluded_domain_ip = undef,
$iscsi_ip_address = undef,
$iscsi_port = undef,
) { ) {
include ::cinder::deps include ::cinder::deps
@ -128,6 +142,22 @@ default of \"srv\" and will be changed to the upstream OpenStack default in N-re
default of \"vol\" and will be changed to the upstream OpenStack default in N-release.") default of \"vol\" and will be changed to the upstream OpenStack default in N-release.")
} }
if $target_ip_address or $iscsi_ip_address {
if $iscsi_ip_address {
warning('The iscsi_ip_address parameter is deprecated, use target_ip_address instead.')
}
$target_ip_address_real = pick($target_ip_address, $iscsi_ip_address)
} else {
fail('A target_ip_address or iscsi_ip_address must be specified.')
}
if $iscsi_port {
warning('The iscsi_port parameter is deprecated, use target_port instead.')
$target_port_real = $iscsi_port
} else {
$target_port_real = $target_port
}
$driver = 'dell_emc.sc.storagecenter_iscsi.SCISCSIDriver' $driver = 'dell_emc.sc.storagecenter_iscsi.SCISCSIDriver'
cinder_config { cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name; "${name}/volume_backend_name": value => $volume_backend_name;
@ -136,13 +166,13 @@ default of \"vol\" and will be changed to the upstream OpenStack default in N-re
"${name}/san_ip": value => $san_ip; "${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login; "${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password, secret => true; "${name}/san_password": value => $san_password, secret => true;
"${name}/iscsi_ip_address": value => $iscsi_ip_address; "${name}/target_ip_address": value => $target_ip_address_real;
"${name}/dell_sc_ssn": value => $dell_sc_ssn; "${name}/dell_sc_ssn": value => $dell_sc_ssn;
"${name}/dell_sc_api_port": value => $dell_sc_api_port; "${name}/dell_sc_api_port": value => $dell_sc_api_port;
"${name}/dell_sc_server_folder": value => $dell_sc_server_folder; "${name}/dell_sc_server_folder": value => $dell_sc_server_folder;
"${name}/dell_sc_verify_cert": value => $dell_sc_verify_cert; "${name}/dell_sc_verify_cert": value => $dell_sc_verify_cert;
"${name}/dell_sc_volume_folder": value => $dell_sc_volume_folder; "${name}/dell_sc_volume_folder": value => $dell_sc_volume_folder;
"${name}/iscsi_port": value => $iscsi_port; "${name}/target_port": value => $target_port_real;
"${name}/excluded_domain_ips": value => $excluded_domain_ips; "${name}/excluded_domain_ips": value => $excluded_domain_ips;
"${name}/secondary_san_ip": value => $secondary_san_ip; "${name}/secondary_san_ip": value => $secondary_san_ip;
"${name}/secondary_san_login": value => $secondary_san_login; "${name}/secondary_san_login": value => $secondary_san_login;

View File

@ -3,8 +3,12 @@
# #
# === Parameters: # === Parameters:
# #
# [*iscsi_ip_address*] # [*target_ip_address*]
# (Required) The IP address that the iSCSI daemon is listening on # (optional) The IP address that the iSCSI daemon is listening on.
# If not set, the iscsi_ip_address must be specified. The target_ip_address
# will be required once the deprecated iscsi_ip_address parameter is
# removed in a future release.
# Defaults to undef.
# #
# [*volume_backend_name*] # [*volume_backend_name*]
# (optional) Allows for the volume_backend_name to be separate of $name. # (optional) Allows for the volume_backend_name to be separate of $name.
@ -28,11 +32,11 @@
# (Optional) Volume configuration file storage directory # (Optional) Volume configuration file storage directory
# Defaults to '/var/lib/cinder/volumes'. # Defaults to '/var/lib/cinder/volumes'.
# #
# [*iscsi_helper*] # [*target_helper*]
# (Optional) iSCSI target user-land tool to use. # (Optional) iSCSI target user-land tool to use.
# Defaults to '$::cinder::params::iscsi_helper'. # Defaults to '$::cinder::params::target_helper'.
# #
# [*iscsi_protocol*] # [*target_protocol*]
# (Optional) Protocol to use as iSCSI driver # (Optional) Protocol to use as iSCSI driver
# Defaults to $::os_service_default. # Defaults to $::os_service_default.
# #
@ -48,17 +52,35 @@
# Example : # Example :
# { 'iscsi_backend/param1' => { 'value' => value1 } } # { 'iscsi_backend/param1' => { 'value' => value1 } }
# #
# DEPRECATED PARAMETERS
#
# [*iscsi_ip_address*]
# (Optional) The IP address that the iSCSI daemon is listening on
# Defaults to undef.
#
# [*iscsi_helper*]
# (Optional) iSCSI target user-land tool to use.
# Defaults to undef.
#
# [*iscsi_protocol*]
# (Optional) Protocol to use as iSCSI driver
# Defaults to undef.
#
define cinder::backend::iscsi ( define cinder::backend::iscsi (
$iscsi_ip_address, $target_ip_address = undef,
$volume_backend_name = $name, $volume_backend_name = $name,
$backend_availability_zone = $::os_service_default, $backend_availability_zone = $::os_service_default,
$volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver', $volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver',
$volume_group = $::os_service_default, $volume_group = $::os_service_default,
$volumes_dir = '/var/lib/cinder/volumes', $volumes_dir = '/var/lib/cinder/volumes',
$iscsi_helper = $::cinder::params::iscsi_helper, $target_helper = $::cinder::params::target_helper,
$iscsi_protocol = $::os_service_default, $target_protocol = $::os_service_default,
$manage_volume_type = false, $manage_volume_type = false,
$extra_options = {}, $extra_options = {},
# DEPRECATED PARAMETERS
$iscsi_ip_address = undef,
$iscsi_helper = undef,
$iscsi_protocol = undef,
) { ) {
include ::cinder::deps include ::cinder::deps
@ -73,15 +95,38 @@ define cinder::backend::iscsi (
} }
} }
if $target_ip_address or $iscsi_ip_address {
if $iscsi_ip_address {
warning('The iscsi_ip_address parameter is deprecated, use target_ip_address instead.')
}
$target_ip_address_real = pick($target_ip_address, $iscsi_ip_address)
} else {
fail('A target_ip_address or iscsi_ip_address must be specified.')
}
if $iscsi_helper {
warning('The iscsi_helper parameter is deprecated, use target_helper instead.')
$target_helper_real = $iscsi_helper
} else {
$target_helper_real = $target_helper
}
if $iscsi_protocol {
warning('The iscsi_protocol parameter is deprecated, use target_protocol instead.')
$target_protocol_real = $iscsi_protocol
} else {
$target_protocol_real = $target_protocol
}
cinder_config { cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name; "${name}/volume_backend_name": value => $volume_backend_name;
"${name}/backend_availability_zone": value => $backend_availability_zone; "${name}/backend_availability_zone": value => $backend_availability_zone;
"${name}/volume_driver": value => $volume_driver; "${name}/volume_driver": value => $volume_driver;
"${name}/iscsi_ip_address": value => $iscsi_ip_address; "${name}/target_ip_address": value => $target_ip_address_real;
"${name}/iscsi_helper": value => $iscsi_helper; "${name}/target_helper": value => $target_helper_real;
"${name}/volume_group": value => $volume_group; "${name}/volume_group": value => $volume_group;
"${name}/volumes_dir": value => $volumes_dir; "${name}/volumes_dir": value => $volumes_dir;
"${name}/iscsi_protocol": value => $iscsi_protocol; "${name}/target_protocol": value => $target_protocol_real;
} }
if $manage_volume_type { if $manage_volume_type {
@ -93,7 +138,7 @@ define cinder::backend::iscsi (
create_resources('cinder_config', $extra_options) create_resources('cinder_config', $extra_options)
case $iscsi_helper { case $target_helper_real {
'tgtadm': { 'tgtadm': {
package { 'tgt': package { 'tgt':
ensure => present, ensure => present,
@ -134,7 +179,7 @@ define cinder::backend::iscsi (
} }
default: { default: {
fail("Unsupported iscsi helper: ${iscsi_helper}.") fail("Unsupported target helper: ${target_helper_real}.")
} }
} }

View File

@ -31,7 +31,7 @@ class cinder::params {
$tgt_service_name = 'tgt' $tgt_service_name = 'tgt'
$ceph_init_override = '/etc/init/cinder-volume.override' $ceph_init_override = '/etc/init/cinder-volume.override'
$ceph_common_package_name = 'ceph-common' $ceph_common_package_name = 'ceph-common'
$iscsi_helper = 'tgtadm' $target_helper = 'tgtadm'
$lio_package_name = 'targetcli' $lio_package_name = 'targetcli'
$lock_path = '/var/lock/cinder' $lock_path = '/var/lock/cinder'
$cinder_wsgi_script_path = '/usr/lib/cgi-bin/cinder' $cinder_wsgi_script_path = '/usr/lib/cgi-bin/cinder'
@ -61,13 +61,13 @@ class cinder::params {
case $::operatingsystem { case $::operatingsystem {
'RedHat', 'CentOS', 'Scientific', 'OracleLinux': { 'RedHat', 'CentOS', 'Scientific', 'OracleLinux': {
if (versioncmp($::operatingsystemmajrelease, '7') >= 0) { if (versioncmp($::operatingsystemmajrelease, '7') >= 0) {
$iscsi_helper = 'lioadm' $target_helper = 'lioadm'
} else { } else {
$iscsi_helper = 'tgtadm' $target_helper = 'tgtadm'
} }
} }
default: { default: {
$iscsi_helper = 'lioadm' $target_helper = 'lioadm'
} }
} }

View File

@ -0,0 +1,20 @@
---
upgrade:
- |
The iscsi_ip_address parameter is no longer supported, and has been
replaced by a corresponding target_ip_address parameter. This is due
to cinder's removal of support for the iscsi_ip_address option during
the Stein cycle.
deprecations:
- |
The following parameters are deprecated because support for them was
removed from cinder during the Stein cycle.
* iscsi_ip_address
* iscsi_port
* iscsi_helper
* iscsi_protocol
They are replaced by the following parameters.
* target_ip_address
* target_port
* target_helper
* target_protocol

View File

@ -5,7 +5,7 @@ describe 'cinder::backend::bdd' do
let(:title) { 'hippo' } let(:title) { 'hippo' }
let :params do { let :params do {
:iscsi_ip_address => '127.0.0.2', :target_ip_address => '127.0.0.2',
:available_devices => '/dev/sda', :available_devices => '/dev/sda',
} }
end end
@ -16,11 +16,11 @@ describe 'cinder::backend::bdd' do
should contain_cinder_config('hippo/volume_backend_name').with_value('hippo') should contain_cinder_config('hippo/volume_backend_name').with_value('hippo')
should contain_cinder_config('hippo/volume_driver').with_value('cinder.volume.drivers.block_device.BlockDeviceDriver') should contain_cinder_config('hippo/volume_driver').with_value('cinder.volume.drivers.block_device.BlockDeviceDriver')
should contain_cinder_config('hippo/available_devices').with_value('/dev/sda') should contain_cinder_config('hippo/available_devices').with_value('/dev/sda')
should contain_cinder_config('hippo/iscsi_helper').with_value('tgtadm') should contain_cinder_config('hippo/target_helper').with_value('tgtadm')
should contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/volumes') should contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/volumes')
should contain_cinder_config('hippo/iscsi_ip_address').with_value('127.0.0.2') should contain_cinder_config('hippo/target_ip_address').with_value('127.0.0.2')
should contain_cinder_config('hippo/volume_group').with_value('<SERVICE DEFAULT>') should contain_cinder_config('hippo/volume_group').with_value('<SERVICE DEFAULT>')
should contain_cinder_config('hippo/iscsi_protocol').with_value('<SERVICE DEFAULT>') should contain_cinder_config('hippo/target_protocol').with_value('<SERVICE DEFAULT>')
should contain_cinder_config('hippo/volume_clear').with_value('<SERVICE DEFAULT>') should contain_cinder_config('hippo/volume_clear').with_value('<SERVICE DEFAULT>')
should contain_cinder_config('hippo/backend_availability_zone').with_value('<SERVICE DEFAULT>') should contain_cinder_config('hippo/backend_availability_zone').with_value('<SERVICE DEFAULT>')
end end
@ -29,12 +29,12 @@ describe 'cinder::backend::bdd' do
context 'with optional parameters' do context 'with optional parameters' do
before :each do before :each do
params.merge!({ params.merge!({
:iscsi_ip_address => '10.20.0.2', :target_ip_address => '10.20.0.2',
:available_devices => '/dev/sdb,/dev/sdc', :available_devices => '/dev/sdb,/dev/sdc',
:volumes_dir => '/var/lib/cinder/bdd-volumes', :volumes_dir => '/var/lib/cinder/bdd-volumes',
:volume_clear => 'zero', :volume_clear => 'zero',
:volume_group => 'cinder', :volume_group => 'cinder',
:iscsi_helper => 'lioadm', :target_helper => 'lioadm',
:manage_volume_type => true, :manage_volume_type => true,
:backend_availability_zone => 'my_zone', :backend_availability_zone => 'my_zone',
}) })
@ -43,8 +43,8 @@ describe 'cinder::backend::bdd' do
it 'should configure bdd driver in cinder.conf' do it 'should configure bdd driver in cinder.conf' do
should contain_cinder_config('hippo/available_devices').with_value('/dev/sdb,/dev/sdc') should contain_cinder_config('hippo/available_devices').with_value('/dev/sdb,/dev/sdc')
should contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/bdd-volumes') should contain_cinder_config('hippo/volumes_dir').with_value('/var/lib/cinder/bdd-volumes')
should contain_cinder_config('hippo/iscsi_ip_address').with_value('10.20.0.2') should contain_cinder_config('hippo/target_ip_address').with_value('10.20.0.2')
should contain_cinder_config('hippo/iscsi_helper').with_value('lioadm') should contain_cinder_config('hippo/target_helper').with_value('lioadm')
should contain_cinder_config('hippo/volume_group').with_value('cinder') should contain_cinder_config('hippo/volume_group').with_value('cinder')
should contain_cinder_config('hippo/volume_clear').with_value('zero') should contain_cinder_config('hippo/volume_clear').with_value('zero')
should contain_cinder_config('hippo/backend_availability_zone').with_value('my_zone') should contain_cinder_config('hippo/backend_availability_zone').with_value('my_zone')
@ -65,6 +65,27 @@ describe 'cinder::backend::bdd' do
}) })
end end
end end
context 'with deprecated iscsi_ip_address' do
before do
params.merge!({
:target_ip_address => :undef,
:iscsi_ip_address => '127.0.0.42',
})
end
it 'should configure bdd driver using that address' do
should contain_cinder_config('hippo/target_ip_address').with_value('127.0.0.42')
end
end
context 'with no target_ip_address or iscsi_ip_address' do
before do
params.delete(:target_ip_address)
end
it 'is expected to raise error' do
is_expected.to raise_error(Puppet::Error, /A target_ip_address or iscsi_ip_address must be specified./)
end
end
end end
shared_examples_for 'check needed daemons' do shared_examples_for 'check needed daemons' do
@ -77,7 +98,7 @@ describe 'cinder::backend::bdd' do
context 'lioadm helper' do context 'lioadm helper' do
before do before do
params.merge!({:iscsi_helper => 'lioadm'}) params.merge!({:target_helper => 'lioadm'})
end end
it 'is expected to have target daemon' do it 'is expected to have target daemon' do
is_expected.to contain_package('targetcli').with(:ensure => :present) is_expected.to contain_package('targetcli').with(:ensure => :present)
@ -87,10 +108,10 @@ describe 'cinder::backend::bdd' do
context 'wrong helper' do context 'wrong helper' do
before do before do
params.merge!({:iscsi_helper => 'fake'}) params.merge!({:target_helper => 'fake'})
end end
it 'is expected to raise error' do it 'is expected to raise error' do
is_expected.to raise_error(Puppet::Error, /Unsupported iscsi helper: fake/) is_expected.to raise_error(Puppet::Error, /Unsupported target helper: fake/)
end end
end end
end end

View File

@ -11,7 +11,7 @@ describe 'cinder::backend::dellsc_iscsi' do
:san_ip => '172.23.8.101', :san_ip => '172.23.8.101',
:san_login => 'Admin', :san_login => 'Admin',
:san_password => '12345', :san_password => '12345',
:iscsi_ip_address => '192.168.0.20', :target_ip_address => '192.168.0.20',
:dell_sc_ssn => '64720', :dell_sc_ssn => '64720',
} }
end end
@ -23,7 +23,7 @@ describe 'cinder::backend::dellsc_iscsi' do
:dell_sc_server_folder => 'srv', :dell_sc_server_folder => 'srv',
:dell_sc_verify_cert => '<SERVICE DEFAULT>', :dell_sc_verify_cert => '<SERVICE DEFAULT>',
:dell_sc_volume_folder => 'vol', :dell_sc_volume_folder => 'vol',
:iscsi_port => '<SERVICE DEFAULT>', :target_port => '<SERVICE DEFAULT>',
:excluded_domain_ips => '<SERVICE DEFAULT>', :excluded_domain_ips => '<SERVICE DEFAULT>',
:secondary_san_ip => '<SERVICE DEFAULT>', :secondary_san_ip => '<SERVICE DEFAULT>',
:secondary_san_login => '<SERVICE DEFAULT>', :secondary_san_login => '<SERVICE DEFAULT>',
@ -40,7 +40,7 @@ describe 'cinder::backend::dellsc_iscsi' do
:dell_sc_server_folder => 'other_srv', :dell_sc_server_folder => 'other_srv',
:dell_sc_verify_cert => true, :dell_sc_verify_cert => true,
:dell_sc_volume_folder => 'other_vol', :dell_sc_volume_folder => 'other_vol',
:iscsi_port => 222, :target_port => 222,
:excluded_domain_ip => '127.0.0.2', :excluded_domain_ip => '127.0.0.2',
:secondary_san_ip => '127.0.0.3', :secondary_san_ip => '127.0.0.3',
:secondary_san_login => 'Foo', :secondary_san_login => 'Foo',
@ -102,4 +102,25 @@ describe 'cinder::backend::dellsc_iscsi' do
end end
end end
context 'with deprecated iscsi_ip_address' do
before do
params.merge!({
:target_ip_address => :undef,
:iscsi_ip_address => '127.0.0.42',
})
end
it 'should configure dellsc_iscsi backend using that address' do
should contain_cinder_config('dellsc_iscsi/target_ip_address').with_value('127.0.0.42')
end
end
context 'with no target_ip_address or iscsi_ip_address' do
before do
params.delete(:target_ip_address)
end
it 'is expected to raise error' do
is_expected.to raise_error(Puppet::Error, /A target_ip_address or iscsi_ip_address must be specified./)
end
end
end end

View File

@ -5,8 +5,8 @@ describe 'cinder::backend::iscsi' do
let(:title) {'hippo'} let(:title) {'hippo'}
let :req_params do { let :req_params do {
:iscsi_ip_address => '127.0.0.2', :target_ip_address => '127.0.0.2',
:iscsi_helper => 'tgtadm', :target_helper => 'tgtadm',
} }
end end
@ -22,7 +22,7 @@ describe 'cinder::backend::iscsi' do
end end
let :iser_params do let :iser_params do
{:iscsi_protocol => 'iser'} {:target_protocol => 'iser'}
end end
let :volumes_dir_params do let :volumes_dir_params do
@ -38,15 +38,15 @@ describe 'cinder::backend::iscsi' do
:value => '<SERVICE DEFAULT>') :value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('hippo/volume_driver').with( is_expected.to contain_cinder_config('hippo/volume_driver').with(
:value => 'cinder.volume.drivers.lvm.LVMVolumeDriver') :value => 'cinder.volume.drivers.lvm.LVMVolumeDriver')
is_expected.to contain_cinder_config('hippo/iscsi_ip_address').with( is_expected.to contain_cinder_config('hippo/target_ip_address').with(
:value => '127.0.0.2') :value => '127.0.0.2')
is_expected.to contain_cinder_config('hippo/iscsi_helper').with( is_expected.to contain_cinder_config('hippo/target_helper').with(
:value => 'tgtadm') :value => 'tgtadm')
is_expected.to contain_cinder_config('hippo/volume_group').with( is_expected.to contain_cinder_config('hippo/volume_group').with(
:value => '<SERVICE DEFAULT>') :value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('hippo/volumes_dir').with( is_expected.to contain_cinder_config('hippo/volumes_dir').with(
:value => '/var/lib/cinder/volumes') :value => '/var/lib/cinder/volumes')
is_expected.to contain_cinder_config('hippo/iscsi_protocol').with( is_expected.to contain_cinder_config('hippo/target_protocol').with(
:value => '<SERVICE DEFAULT>') :value => '<SERVICE DEFAULT>')
end end
end end
@ -57,7 +57,7 @@ describe 'cinder::backend::iscsi' do
end end
it 'should configure iscsi driver with iser protocol' do it 'should configure iscsi driver with iser protocol' do
is_expected.to contain_cinder_config('hippo/iscsi_protocol').with( is_expected.to contain_cinder_config('hippo/target_protocol').with(
:value => 'iser') :value => 'iser')
end end
end end
@ -95,6 +95,27 @@ describe 'cinder::backend::iscsi' do
end end
end end
describe 'with deprecated iscsi_ip_address' do
before :each do
params.merge!({
:target_ip_address => :undef,
:iscsi_ip_address => '127.0.0.42',
})
end
it 'should configure iscsi backend using that address' do
should contain_cinder_config('hippo/target_ip_address').with_value('127.0.0.42')
end
end
describe 'with no target_ip_address or iscsi_ip_address' do
before :each do
params.delete(:target_ip_address)
end
it 'is expected to raise error' do
is_expected.to raise_error(Puppet::Error, /A target_ip_address or iscsi_ip_address must be specified./)
end
end
describe 'with RedHat' do describe 'with RedHat' do
let :facts do let :facts do