From 23d622ba36670c4e937b1e1e06e2edad06442c55 Mon Sep 17 00:00:00 2001 From: Alan Bishop Date: Wed, 31 Oct 2018 10:47:16 -0400 Subject: [PATCH] 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 --- README.md | 10 +-- manifests/backend/bdd.pp | 70 ++++++++++++++---- manifests/backend/dellsc_iscsi.pp | 46 ++++++++++-- manifests/backend/iscsi.pp | 73 +++++++++++++++---- manifests/params.pp | 8 +- ...ate-iscsi-parameters-9b091c7207694e4c.yaml | 20 +++++ spec/defines/cinder_backend_bdd_spec.rb | 43 ++++++++--- .../cinder_backend_dellsc_iscsi_spec.rb | 27 ++++++- spec/defines/cinder_backend_iscsi_spec.rb | 35 +++++++-- 9 files changed, 267 insertions(+), 65 deletions(-) create mode 100644 releasenotes/notes/deprecate-iscsi-parameters-9b091c7207694e4c.yaml diff --git a/README.md b/README.md index d35e5aea..0eccd5c8 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ class { 'cinder::volume': } cinder::backend::iscsi { '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': } cinder::backend::iscsi {'iscsi1': - iscsi_ip_address => '10.0.0.2', + target_ip_address => '10.0.0.2', } cinder::backend::iscsi {'iscsi2': - iscsi_ip_address => '10.0.0.3', + target_ip_address => '10.0.0.3', } cinder::backend::iscsi {'iscsi3': - iscsi_ip_address => '10.0.0.4', + target_ip_address => '10.0.0.4', volume_backend_name => 'iscsi', } cinder::backend::iscsi {'iscsi4': - iscsi_ip_address => '10.0.0.5', + target_ip_address => '10.0.0.5', volume_backend_name => 'iscsi', } diff --git a/manifests/backend/bdd.pp b/manifests/backend/bdd.pp index c29097a2..56785420 100644 --- a/manifests/backend/bdd.pp +++ b/manifests/backend/bdd.pp @@ -5,13 +5,17 @@ # # === Parameters: # -# [*iscsi_ip_address*] -# (Required) The IP address that the iSCSI daemon is listening on -# # [*available_devices*] # (Required) List of all available devices. Real hard disks. # 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*] # (optional) Allows for the volume_backend_name to be separate of $name. # Defaults to: $name @@ -34,11 +38,11 @@ # (Optional) Volume configuration file storage directory # Defaults to '/var/lib/cinder/volumes'. # -# [*iscsi_helper*] +# [*target_helper*] # (Optional) iSCSI target user-land tool to use. # Defaults to tgtadm. # -# [*iscsi_protocol*] +# [*target_protocol*] # (Optional) Protocol to use as iSCSI driver # Defaults to $::os_service_default. # @@ -65,23 +69,41 @@ # 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 # # Denis Egorenko # define cinder::backend::bdd ( - $iscsi_ip_address, $available_devices, + $target_ip_address = undef, $volume_backend_name = $name, $backend_availability_zone = $::os_service_default, $volume_driver = 'cinder.volume.drivers.block_device.BlockDeviceDriver', $volume_group = $::os_service_default, $volumes_dir = '/var/lib/cinder/volumes', - $iscsi_helper = 'tgtadm', - $iscsi_protocol = $::os_service_default, + $target_helper = 'tgtadm', + $target_protocol = $::os_service_default, $volume_clear = $::os_service_default, $manage_volume_type = false, $extra_options = {}, + # DEPRECATED PARAMETERS + $iscsi_ip_address = undef, + $iscsi_helper = undef, + $iscsi_protocol = undef, ) { include ::cinder::deps @@ -91,17 +113,39 @@ define cinder::backend::bdd ( 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 { "${name}/available_devices": value => $available_devices; "${name}/volume_backend_name": value => $volume_backend_name; "${name}/backend_availability_zone": value => $backend_availability_zone; "${name}/volume_driver": value => $volume_driver; - "${name}/iscsi_ip_address": value => $iscsi_ip_address; - "${name}/iscsi_helper": value => $iscsi_helper; + "${name}/target_ip_address": value => $target_ip_address_real; + "${name}/target_helper": value => $target_helper_real; "${name}/volume_group": value => $volume_group; "${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; } @@ -114,7 +158,7 @@ define cinder::backend::bdd ( create_resources('cinder_config', $extra_options) - case $iscsi_helper { + case $target_helper_real { 'tgtadm': { ensure_packages('tgt', { ensure => present, @@ -149,7 +193,7 @@ define cinder::backend::bdd ( } default: { - fail("Unsupported iscsi helper: ${iscsi_helper}.") + fail("Unsupported target helper: ${target_helper_real}.") } } diff --git a/manifests/backend/dellsc_iscsi.pp b/manifests/backend/dellsc_iscsi.pp index f736e1d3..74875e09 100644 --- a/manifests/backend/dellsc_iscsi.pp +++ b/manifests/backend/dellsc_iscsi.pp @@ -13,12 +13,16 @@ # [*san_password*] # (required) Enterprise Manager user password. # -# [*iscsi_ip_address*] -# (required) The Storage Center iSCSI IP address. -# # [*dell_sc_ssn*] # (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*] # (optional) The storage backend name. # Defaults to the name of the backend @@ -45,7 +49,7 @@ # (optional) Name of the volume folder to use on the Storage Center. # Defaults to 'vol' # -# [*iscsi_port*] +# [*target_port*] # (optional) The ISCSI IP Port of the Storage Center. # Defaults to $::os_service_default # @@ -91,19 +95,27 @@ # (optional) Domain IP to be excluded from iSCSI returns of Storage Center. # 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 ( $san_ip, $san_login, $san_password, - $iscsi_ip_address, $dell_sc_ssn, + $target_ip_address = undef, $volume_backend_name = $name, $backend_availability_zone = $::os_service_default, $dell_sc_api_port = $::os_service_default, $dell_sc_server_folder = 'srv', $dell_sc_verify_cert = $::os_service_default, $dell_sc_volume_folder = 'vol', - $iscsi_port = $::os_service_default, + $target_port = $::os_service_default, $excluded_domain_ips = $::os_service_default, $secondary_san_ip = $::os_service_default, $secondary_san_login = $::os_service_default, @@ -114,6 +126,8 @@ define cinder::backend::dellsc_iscsi ( $extra_options = {}, # DEPRECATED PARAMETERS $excluded_domain_ip = undef, + $iscsi_ip_address = undef, + $iscsi_port = undef, ) { 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.") } + 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' cinder_config { "${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_login": value => $san_login; "${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_api_port": value => $dell_sc_api_port; "${name}/dell_sc_server_folder": value => $dell_sc_server_folder; "${name}/dell_sc_verify_cert": value => $dell_sc_verify_cert; "${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}/secondary_san_ip": value => $secondary_san_ip; "${name}/secondary_san_login": value => $secondary_san_login; diff --git a/manifests/backend/iscsi.pp b/manifests/backend/iscsi.pp index 30985990..c044c780 100644 --- a/manifests/backend/iscsi.pp +++ b/manifests/backend/iscsi.pp @@ -3,8 +3,12 @@ # # === Parameters: # -# [*iscsi_ip_address*] -# (Required) The IP address that the iSCSI daemon is listening on +# [*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*] # (optional) Allows for the volume_backend_name to be separate of $name. @@ -28,11 +32,11 @@ # (Optional) Volume configuration file storage directory # Defaults to '/var/lib/cinder/volumes'. # -# [*iscsi_helper*] +# [*target_helper*] # (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 # Defaults to $::os_service_default. # @@ -48,17 +52,35 @@ # Example : # { '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 ( - $iscsi_ip_address, + $target_ip_address = undef, $volume_backend_name = $name, $backend_availability_zone = $::os_service_default, $volume_driver = 'cinder.volume.drivers.lvm.LVMVolumeDriver', $volume_group = $::os_service_default, $volumes_dir = '/var/lib/cinder/volumes', - $iscsi_helper = $::cinder::params::iscsi_helper, - $iscsi_protocol = $::os_service_default, + $target_helper = $::cinder::params::target_helper, + $target_protocol = $::os_service_default, $manage_volume_type = false, $extra_options = {}, + # DEPRECATED PARAMETERS + $iscsi_ip_address = undef, + $iscsi_helper = undef, + $iscsi_protocol = undef, ) { 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 { "${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}/iscsi_ip_address": value => $iscsi_ip_address; - "${name}/iscsi_helper": value => $iscsi_helper; + "${name}/target_ip_address": value => $target_ip_address_real; + "${name}/target_helper": value => $target_helper_real; "${name}/volume_group": value => $volume_group; "${name}/volumes_dir": value => $volumes_dir; - "${name}/iscsi_protocol": value => $iscsi_protocol; + "${name}/target_protocol": value => $target_protocol_real; } if $manage_volume_type { @@ -93,7 +138,7 @@ define cinder::backend::iscsi ( create_resources('cinder_config', $extra_options) - case $iscsi_helper { + case $target_helper_real { 'tgtadm': { package { 'tgt': ensure => present, @@ -134,7 +179,7 @@ define cinder::backend::iscsi ( } default: { - fail("Unsupported iscsi helper: ${iscsi_helper}.") + fail("Unsupported target helper: ${target_helper_real}.") } } diff --git a/manifests/params.pp b/manifests/params.pp index 23988e64..891a2646 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -31,7 +31,7 @@ class cinder::params { $tgt_service_name = 'tgt' $ceph_init_override = '/etc/init/cinder-volume.override' $ceph_common_package_name = 'ceph-common' - $iscsi_helper = 'tgtadm' + $target_helper = 'tgtadm' $lio_package_name = 'targetcli' $lock_path = '/var/lock/cinder' $cinder_wsgi_script_path = '/usr/lib/cgi-bin/cinder' @@ -61,13 +61,13 @@ class cinder::params { case $::operatingsystem { 'RedHat', 'CentOS', 'Scientific', 'OracleLinux': { if (versioncmp($::operatingsystemmajrelease, '7') >= 0) { - $iscsi_helper = 'lioadm' + $target_helper = 'lioadm' } else { - $iscsi_helper = 'tgtadm' + $target_helper = 'tgtadm' } } default: { - $iscsi_helper = 'lioadm' + $target_helper = 'lioadm' } } diff --git a/releasenotes/notes/deprecate-iscsi-parameters-9b091c7207694e4c.yaml b/releasenotes/notes/deprecate-iscsi-parameters-9b091c7207694e4c.yaml new file mode 100644 index 00000000..b5830c5b --- /dev/null +++ b/releasenotes/notes/deprecate-iscsi-parameters-9b091c7207694e4c.yaml @@ -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 diff --git a/spec/defines/cinder_backend_bdd_spec.rb b/spec/defines/cinder_backend_bdd_spec.rb index d4ec8f0c..e218f0d5 100644 --- a/spec/defines/cinder_backend_bdd_spec.rb +++ b/spec/defines/cinder_backend_bdd_spec.rb @@ -5,7 +5,7 @@ describe 'cinder::backend::bdd' do let(:title) { 'hippo' } let :params do { - :iscsi_ip_address => '127.0.0.2', + :target_ip_address => '127.0.0.2', :available_devices => '/dev/sda', } 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_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/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/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('') - should contain_cinder_config('hippo/iscsi_protocol').with_value('') + should contain_cinder_config('hippo/target_protocol').with_value('') should contain_cinder_config('hippo/volume_clear').with_value('') should contain_cinder_config('hippo/backend_availability_zone').with_value('') end @@ -29,12 +29,12 @@ describe 'cinder::backend::bdd' do context 'with optional parameters' do before :each do params.merge!({ - :iscsi_ip_address => '10.20.0.2', + :target_ip_address => '10.20.0.2', :available_devices => '/dev/sdb,/dev/sdc', :volumes_dir => '/var/lib/cinder/bdd-volumes', :volume_clear => 'zero', :volume_group => 'cinder', - :iscsi_helper => 'lioadm', + :target_helper => 'lioadm', :manage_volume_type => true, :backend_availability_zone => 'my_zone', }) @@ -43,8 +43,8 @@ describe 'cinder::backend::bdd' 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/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/iscsi_helper').with_value('lioadm') + should contain_cinder_config('hippo/target_ip_address').with_value('10.20.0.2') + 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_clear').with_value('zero') should contain_cinder_config('hippo/backend_availability_zone').with_value('my_zone') @@ -65,6 +65,27 @@ describe 'cinder::backend::bdd' do }) 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 shared_examples_for 'check needed daemons' do @@ -77,7 +98,7 @@ describe 'cinder::backend::bdd' do context 'lioadm helper' do before do - params.merge!({:iscsi_helper => 'lioadm'}) + params.merge!({:target_helper => 'lioadm'}) end it 'is expected to have target daemon' do is_expected.to contain_package('targetcli').with(:ensure => :present) @@ -87,10 +108,10 @@ describe 'cinder::backend::bdd' do context 'wrong helper' do before do - params.merge!({:iscsi_helper => 'fake'}) + params.merge!({:target_helper => 'fake'}) end 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 diff --git a/spec/defines/cinder_backend_dellsc_iscsi_spec.rb b/spec/defines/cinder_backend_dellsc_iscsi_spec.rb index c9f918d3..9c24d8bf 100644 --- a/spec/defines/cinder_backend_dellsc_iscsi_spec.rb +++ b/spec/defines/cinder_backend_dellsc_iscsi_spec.rb @@ -11,7 +11,7 @@ describe 'cinder::backend::dellsc_iscsi' do :san_ip => '172.23.8.101', :san_login => 'Admin', :san_password => '12345', - :iscsi_ip_address => '192.168.0.20', + :target_ip_address => '192.168.0.20', :dell_sc_ssn => '64720', } end @@ -23,7 +23,7 @@ describe 'cinder::backend::dellsc_iscsi' do :dell_sc_server_folder => 'srv', :dell_sc_verify_cert => '', :dell_sc_volume_folder => 'vol', - :iscsi_port => '', + :target_port => '', :excluded_domain_ips => '', :secondary_san_ip => '', :secondary_san_login => '', @@ -40,7 +40,7 @@ describe 'cinder::backend::dellsc_iscsi' do :dell_sc_server_folder => 'other_srv', :dell_sc_verify_cert => true, :dell_sc_volume_folder => 'other_vol', - :iscsi_port => 222, + :target_port => 222, :excluded_domain_ip => '127.0.0.2', :secondary_san_ip => '127.0.0.3', :secondary_san_login => 'Foo', @@ -102,4 +102,25 @@ describe 'cinder::backend::dellsc_iscsi' do 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 diff --git a/spec/defines/cinder_backend_iscsi_spec.rb b/spec/defines/cinder_backend_iscsi_spec.rb index 7d810246..7e3f71bc 100644 --- a/spec/defines/cinder_backend_iscsi_spec.rb +++ b/spec/defines/cinder_backend_iscsi_spec.rb @@ -5,8 +5,8 @@ describe 'cinder::backend::iscsi' do let(:title) {'hippo'} let :req_params do { - :iscsi_ip_address => '127.0.0.2', - :iscsi_helper => 'tgtadm', + :target_ip_address => '127.0.0.2', + :target_helper => 'tgtadm', } end @@ -22,7 +22,7 @@ describe 'cinder::backend::iscsi' do end let :iser_params do - {:iscsi_protocol => 'iser'} + {:target_protocol => 'iser'} end let :volumes_dir_params do @@ -38,15 +38,15 @@ describe 'cinder::backend::iscsi' do :value => '') is_expected.to contain_cinder_config('hippo/volume_driver').with( :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') - is_expected.to contain_cinder_config('hippo/iscsi_helper').with( + is_expected.to contain_cinder_config('hippo/target_helper').with( :value => 'tgtadm') is_expected.to contain_cinder_config('hippo/volume_group').with( :value => '') is_expected.to contain_cinder_config('hippo/volumes_dir').with( :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 => '') end end @@ -57,7 +57,7 @@ describe 'cinder::backend::iscsi' do end 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') end end @@ -95,6 +95,27 @@ describe 'cinder::backend::iscsi' do 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 let :facts do