diff --git a/manifests/backend/hp3par_iscsi.pp b/manifests/backend/hp3par_iscsi.pp index d93088f9..678c8a50 100644 --- a/manifests/backend/hp3par_iscsi.pp +++ b/manifests/backend/hp3par_iscsi.pp @@ -80,20 +80,22 @@ define cinder::backend::hp3par_iscsi( fail ('hp3par_snapshot_expiration must be greater than hp3par_snapshot_retention') } + warning('The define cinder::backend::hp3par_iscsi is deprecated and will be removed after Newton cycle, pleasse use the new define cinder::backend::hpe3par_iscsi.') + cinder_config { - "${name}/volume_backend_name": value => $volume_backend_name; - "${name}/volume_driver": value => $volume_driver; - "${name}/hp3par_username": value => $hp3par_username; - "${name}/hp3par_password": value => $hp3par_password, secret => true; - "${name}/san_ip": value => $san_ip; - "${name}/san_login": value => $san_login; - "${name}/san_password": value => $san_password, secret => true; - "${name}/hp3par_iscsi_ips": value => $hp3par_iscsi_ips; - "${name}/hp3par_api_url": value => $hp3par_api_url; - "${name}/hp3par_iscsi_chap_enabled": value => $hp3par_iscsi_chap_enabled; - "${name}/hp3par_snap_cpg": value => $hp3par_snap_cpg; - "${name}/hp3par_snapshot_retention": value => $hp3par_snapshot_retention; - "${name}/hp3par_snapshot_expiration": value => $hp3par_snapshot_expiration; + "${name}/volume_backend_name": value => $volume_backend_name; + "${name}/volume_driver": value => $volume_driver; + "${name}/hpe3par_username": value => $hp3par_username; + "${name}/hpe3par_password": value => $hp3par_password, secret => true; + "${name}/san_ip": value => $san_ip; + "${name}/san_login": value => $san_login; + "${name}/san_password": value => $san_password, secret => true; + "${name}/hpe3par_iscsi_ips": value => $hp3par_iscsi_ips; + "${name}/hpe3par_api_url": value => $hp3par_api_url; + "${name}/hpe3par_iscsi_chap_enabled": value => $hp3par_iscsi_chap_enabled; + "${name}/hpe3par_cpg_snap": value => $hp3par_snap_cpg; + "${name}/hpe3par_snapshot_retention": value => $hp3par_snapshot_retention; + "${name}/hpe3par_snapshot_expiration": value => $hp3par_snapshot_expiration; } create_resources('cinder_config', $extra_options) diff --git a/manifests/backend/hpe3par_iscsi.pp b/manifests/backend/hpe3par_iscsi.pp new file mode 100644 index 00000000..3895278b --- /dev/null +++ b/manifests/backend/hpe3par_iscsi.pp @@ -0,0 +1,102 @@ +# Configures Cinder volume HPE 3par ISCSI driver. +# Parameters are particular to each volume driver. +# +# === Parameters +# +# [*hpe3par_api_url*] +# (required) url for api access to 3par - example +# https://10.x.x.x:8080/api/v1 +# +# [*hpe3par_username*] +# (required) Username for hpe3par admin user +# +# [*hpe3par_password*] +# (required) Password for hpe3par_username +# +# [*san_ip*] +# (required) IP address of HPE 3par service processor. +# +# [*san_login*] +# (required) Username for HPE 3par account. +# +# [*san_password*] +# (required) Password for HPE 3par account. +# +# [*hpe3par_iscsi_ips*] +# (required) iscsi IP addresses for the HPE 3par array +# This is a list of IPs with ports in a string, for example: +# '1.2.3.4:3261, 5.6.7.8:3261' +# +# [*volume_backend_name*] +# (optional) Allows for the volume_backend_name to be separate of $name. +# Defaults to: $name +# +# [*volume_driver*] +# (optional) Setup cinder-volume to use HPE 3par volume driver. +# Defaults to 'cinder.volume.drivers.hpe.hpe_3par_fc.HPE3PARFCDriver' +# +# [*hpe3par_iscsi_chap_enabled*] +# (required) setting to false by default +# +# [*hpe3par_iscsi_chap_enabled +# (required) setting to false by default +# +# [*hpe3par_cpg_snap*] +# (optional) set to hpe3par_cfg by default in the cinder driver +# +# [*hpe3par_snapshot_retention*] +# (required) Time in hours for snapshot retention. Must be less +# than hpe3par_snapshot_expiration. +# Defaults to 48. +# +# [*hpe3par_snapshot_expiration*] +# (required) Time in hours until a snapshot expires. Must be more +# than hpe3par_snapshot_retention. +# Defaults to 72. +# +# [*extra_options*] +# (optional) Hash of extra options to pass to the backend stanza +# Defaults to: {} +# Example : +# { 'h3par_iscsi_backend/param1' => { 'value' => value1 } } +# +define cinder::backend::hpe3par_iscsi( + $hpe3par_api_url, + $hpe3par_username, + $hpe3par_password, + $san_ip, + $san_login, + $san_password, + $hpe3par_iscsi_ips, + $volume_backend_name = $name, + $volume_driver = 'cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver', + $hpe3par_iscsi_chap_enabled = false, + $hpe3par_cpg_snap = 'userCPG', + $hpe3par_snapshot_retention = 48, + $hpe3par_snapshot_expiration = 72, + $extra_options = {}, +) { + + if ($hpe3par_snapshot_expiration <= $hpe3par_snapshot_retention) { + fail ('hp3par_snapshot_expiration must be greater than hp3par_snapshot_retention') + } + + cinder_config { + "${name}/volume_backend_name": value => $volume_backend_name; + "${name}/volume_driver": value => $volume_driver; + "${name}/hpe3par_username": value => $hpe3par_username; + "${name}/hpe3par_password": value => $hpe3par_password, secret => true; + "${name}/san_ip": value => $san_ip; + "${name}/san_login": value => $san_login; + "${name}/san_password": value => $san_password, secret => true; + "${name}/hpe3par_iscsi_ips": value => $hpe3par_iscsi_ips; + "${name}/hpe3par_api_url": value => $hpe3par_api_url; + "${name}/hpe3par_iscsi_chap_enabled": value => $hpe3par_iscsi_chap_enabled; + "${name}/hpe3par_snap_cpg": value => $hpe3par_cpg_snap; + "${name}/hpe3par_snapshot_retention": value => $hpe3par_snapshot_retention; + "${name}/hpe3par_snapshot_expiration": value => $hpe3par_snapshot_expiration; + } + + create_resources('cinder_config', $extra_options) + +} diff --git a/manifests/volume/hp3par_iscsi.pp b/manifests/volume/hp3par_iscsi.pp index 069c7b74..78ec600a 100644 --- a/manifests/volume/hp3par_iscsi.pp +++ b/manifests/volume/hp3par_iscsi.pp @@ -1,4 +1,4 @@ -# == Class: cinder::volume::hp3par +# == Deprecated Class: cinder::volume::hp3par # # Configures Cinder volume HP 3par driver. # Parameters are particular to each volume driver. @@ -56,7 +56,7 @@ class cinder::volume::hp3par_iscsi( $san_ip, $san_login, $san_password, - $volume_driver = 'cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver', + $volume_driver = 'cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver', $hp3par_iscsi_chap_enabled = false, $hp3par_snap_cpg = 'OpenstackCPG', $hp3par_snapshot_retention = 48, @@ -64,18 +64,22 @@ class cinder::volume::hp3par_iscsi( $extra_options = {}, ) { - cinder::backend::hp3par_iscsi { 'DEFAULT': - volume_driver => $volume_driver, - hp3par_username => $hp3par_username, - hp3par_password => $hp3par_password, - san_ip => $san_ip, - san_login => $san_login, - san_password => $san_password, - hp3par_iscsi_ips => $hp3par_iscsi_ips, - hp3par_api_url => $hp3par_api_url, - hp3par_snap_cpg => $hp3par_snap_cpg, - hp3par_snapshot_retention => $hp3par_snapshot_retention, - hp3par_snapshot_expiration => $hp3par_snapshot_expiration, - extra_options => $extra_options, + + warning('The class cinder::volume::hp3par_iscsi is deprecated and will be removed after Newton cycle, pleasse use the new class cinder::volume::hpe3par_iscsi.') + + cinder::backend::hpe3par_iscsi { 'DEFAULT': + volume_driver => $volume_driver, + hpe3par_username => $hp3par_username, + hpe3par_password => $hp3par_password, + san_ip => $san_ip, + san_login => $san_login, + san_password => $san_password, + hpe3par_iscsi_ips => $hp3par_iscsi_ips, + hpe3par_api_url => $hp3par_api_url, + hpe3par_cpg_snap => $hp3par_snap_cpg, + hpe3par_snapshot_retention => $hp3par_snapshot_retention, + hpe3par_snapshot_expiration => $hp3par_snapshot_expiration, + extra_options => $extra_options, } + } diff --git a/manifests/volume/hpe3par_iscsi.pp b/manifests/volume/hpe3par_iscsi.pp new file mode 100644 index 00000000..a4804145 --- /dev/null +++ b/manifests/volume/hpe3par_iscsi.pp @@ -0,0 +1,83 @@ +# == Class: cinder::volume::hpe3par +# +# Configures Cinder volume HPE 3par driver. +# Parameters are particular to each volume driver. +# +# === Parameters +# +# [*volume_driver*] +# (optional) Setup cinder-volume to use HPE 3par volume driver. +# Defaults to 'cinder.volume.drivers.hpe.hpe_3par_fc.HPE3PARFCDriver' +# +# [*san_ip*] +# (required) IP address of HPE 3par service processor. +# +# [*san_login*] +# (required) Username for HPE 3par account. +# +# [*san_password*] +# (required) Password for HPE 3par account. +# +# [*hpe3par_api_url*] +# (required) url for api access to 3par - expample +# https://10.x.x.x:8080/api/v1 +# +# [*hpe3par_username*] +# (required) Username for HPE3par admin user +# +# [*hpe3par_password*] +# (required) Password for hpe3par_username +# +# [*hpe3par_iscsi_ips*] +# (required) iscsi ip addresses for the HPE 3par array +# +# [*hpe3par_iscsi_chap_enabled*] +# (required) setting to false by default +# +# [*hpe3par_cpg_snap*] +# (optional) set to hpe3par_cfg by default in the cinder driver +# +# [*hpe3par_snapshot_retention*] +# (required) setting to 48 hours as default expiration - ensures snapshot +# cannot be deleted prior to expiration +# +# [*hpe3par_snapshot_expiration*] +# (required) setting to 72 hours as default (must be larger than retention) +# +# [*extra_options*] +# (optional) Hash of extra options to pass to the backend stanza +# Defaults to: {} +# Example : +# { 'h3par_iscsi_backend/param1' => { 'value' => value1 } } +# +class cinder::volume::hpe3par_iscsi( + $hpe3par_api_url, + $hpe3par_username, + $hpe3par_password, + $hpe3par_iscsi_ips, + $san_ip, + $san_login, + $san_password, + $volume_driver = 'cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver', + $hpe3par_iscsi_chap_enabled = false, + $hpe3par_cpg_snap = 'userCPG', + $hpe3par_snapshot_retention = 48, + $hpe3par_snapshot_expiration = 72, + $extra_options = {}, +) { + + cinder::backend::hpe3par_iscsi { 'DEFAULT': + volume_driver => $volume_driver, + hpe3par_username => $hpe3par_username, + hpe3par_password => $hpe3par_password, + san_ip => $san_ip, + san_login => $san_login, + san_password => $san_password, + hpe3par_iscsi_ips => $hpe3par_iscsi_ips, + hpe3par_api_url => $hpe3par_api_url, + hpe3par_cpg_snap => $hpe3par_cpg_snap, + hpe3par_snapshot_retention => $hpe3par_snapshot_retention, + hpe3par_snapshot_expiration => $hpe3par_snapshot_expiration, + extra_options => $extra_options, + } +} diff --git a/releasenotes/notes/hp3par-deprecations-b3cf23bdc905c6d9.yaml b/releasenotes/notes/hp3par-deprecations-b3cf23bdc905c6d9.yaml new file mode 100644 index 00000000..85f2a074 --- /dev/null +++ b/releasenotes/notes/hp3par-deprecations-b3cf23bdc905c6d9.yaml @@ -0,0 +1,8 @@ +--- +deprecations: + - Deprecate hp3par_iscsi define and class. + - Deprecate all hp3par parameters in define and class +features: + - add hpe3par parameters in h3par_iscsi define and class. + - add hpe3par_iscsi define and class + - add tests for define and class hpe3par_iscsi diff --git a/spec/classes/cinder_volume_hp3par_iscsi_spec.rb b/spec/classes/cinder_volume_hp3par_iscsi_spec.rb index 5ac83d25..581fb05a 100644 --- a/spec/classes/cinder_volume_hp3par_iscsi_spec.rb +++ b/spec/classes/cinder_volume_hp3par_iscsi_spec.rb @@ -7,9 +7,9 @@ describe 'cinder::volume::hp3par_iscsi' do :hp3par_username => '3paradm', :hp3par_password => 'password', :hp3par_iscsi_ips => '172.0.0.3', - :san_ip => '172.0.0.2', - :san_login => '3paradm', - :san_password => 'password', + :san_ip => '172.0.0.2', + :san_login => '3paradm', + :san_password => 'password', } end @@ -19,11 +19,11 @@ describe 'cinder::volume::hp3par_iscsi' do describe 'hp3par_iscsi volume driver' do it 'configure hp3par_iscsi volume driver' do - is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver') - is_expected.to contain_cinder_config('DEFAULT/hp3par_api_url').with_value('https://172.0.0.2:8080/api/v1') - is_expected.to contain_cinder_config('DEFAULT/hp3par_username').with_value('3paradm') - is_expected.to contain_cinder_config('DEFAULT/hp3par_password').with_value('password') - is_expected.to contain_cinder_config('DEFAULT/hp3par_iscsi_ips').with_value('172.0.0.3') + is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_api_url').with_value('https://172.0.0.2:8080/api/v1') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_username').with_value('3paradm') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_password').with_value('password') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_iscsi_ips').with_value('172.0.0.3') is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('172.0.0.2') is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('3paradm') is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password') @@ -32,12 +32,12 @@ describe 'cinder::volume::hp3par_iscsi' do describe 'hp3par_iscsi volume driver with additional configuration' do before :each do - params.merge!({:extra_options => {'hp3par_iscsi_backend/param1' => {'value' => 'value1'}}}) + params.merge!({:extra_options => {'hpe3par_iscsi_backend/param1' => {'value' => 'value1'}}}) end it 'configure hp3par_iscsi volume with additional configuration' do - is_expected.to contain_cinder__backend__hp3par_iscsi('DEFAULT').with({ - :extra_options => {'hp3par_iscsi_backend/param1' => {'value' => 'value1'}} + is_expected.to contain_cinder__backend__hpe3par_iscsi('DEFAULT').with({ + :extra_options => {'hpe3par_iscsi_backend/param1' => {'value' => 'value1'}} }) end end diff --git a/spec/classes/cinder_volume_hpe3par_iscsi_spec.rb b/spec/classes/cinder_volume_hpe3par_iscsi_spec.rb new file mode 100644 index 00000000..38b6a1b1 --- /dev/null +++ b/spec/classes/cinder_volume_hpe3par_iscsi_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +describe 'cinder::volume::hpe3par_iscsi' do + let :req_params do + { + :hpe3par_api_url => 'https://172.0.0.2:8080/api/v1', + :hpe3par_username => '3paradm', + :hpe3par_password => 'password', + :hpe3par_iscsi_ips => '172.0.0.3', + :san_ip => '172.0.0.2', + :san_login => '3paradm', + :san_password => 'password', + } + end + + let :params do + req_params + end + + describe 'hpe3par_iscsi volume driver' do + it 'configure hpe3par_iscsi volume driver' do + is_expected.to contain_cinder_config('DEFAULT/volume_driver').with_value('cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_api_url').with_value('https://172.0.0.2:8080/api/v1') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_username').with_value('3paradm') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_password').with_value('password') + is_expected.to contain_cinder_config('DEFAULT/hpe3par_iscsi_ips').with_value('172.0.0.3') + is_expected.to contain_cinder_config('DEFAULT/san_ip').with_value('172.0.0.2') + is_expected.to contain_cinder_config('DEFAULT/san_login').with_value('3paradm') + is_expected.to contain_cinder_config('DEFAULT/san_password').with_value('password') + end + end + + describe 'hpe3par_iscsi volume driver with additional configuration' do + before :each do + params.merge!({:extra_options => {'hpe3par_iscsi_backend/param1' => {'value' => 'value1'}}}) + end + + it 'configure hpe3par_iscsi volume with additional configuration' do + is_expected.to contain_cinder__backend__hpe3par_iscsi('DEFAULT').with({ + :extra_options => {'hpe3par_iscsi_backend/param1' => {'value' => 'value1'}} + }) + end + end + +end diff --git a/spec/defines/cinder_backend_hp3par_iscsi_spec.rb b/spec/defines/cinder_backend_hp3par_iscsi_spec.rb index 06c68f71..298b1547 100644 --- a/spec/defines/cinder_backend_hp3par_iscsi_spec.rb +++ b/spec/defines/cinder_backend_hp3par_iscsi_spec.rb @@ -9,9 +9,9 @@ describe 'cinder::backend::hp3par_iscsi' do :hp3par_username => '3paradm', :hp3par_password => 'password', :hp3par_iscsi_ips => '172.0.0.3', - :san_ip => '172.0.0.2', - :san_login => '3paradm', - :san_password => 'password', + :san_ip => '172.0.0.2', + :san_login => '3paradm', + :san_password => 'password', } end @@ -22,10 +22,10 @@ describe 'cinder::backend::hp3par_iscsi' do describe 'hp3par_iscsi volume driver' do it 'configure hp3par_iscsi volume driver' do is_expected.to contain_cinder_config('hp3par_iscsi/volume_driver').with_value('cinder.volume.drivers.san.hp.hp_3par_iscsi.HP3PARISCSIDriver') - is_expected.to contain_cinder_config('hp3par_iscsi/hp3par_api_url').with_value('https://172.0.0.2:8080/api/v1') - is_expected.to contain_cinder_config('hp3par_iscsi/hp3par_username').with_value('3paradm') - is_expected.to contain_cinder_config('hp3par_iscsi/hp3par_password').with_value('password') - is_expected.to contain_cinder_config('hp3par_iscsi/hp3par_iscsi_ips').with_value('172.0.0.3') + is_expected.to contain_cinder_config('hp3par_iscsi/hpe3par_api_url').with_value('https://172.0.0.2:8080/api/v1') + is_expected.to contain_cinder_config('hp3par_iscsi/hpe3par_username').with_value('3paradm') + is_expected.to contain_cinder_config('hp3par_iscsi/hpe3par_password').with_value('password') + is_expected.to contain_cinder_config('hp3par_iscsi/hpe3par_iscsi_ips').with_value('172.0.0.3') is_expected.to contain_cinder_config('hp3par_iscsi/san_ip').with_value('172.0.0.2') is_expected.to contain_cinder_config('hp3par_iscsi/san_login').with_value('3paradm') is_expected.to contain_cinder_config('hp3par_iscsi/san_password').with_value('password') @@ -34,11 +34,11 @@ describe 'cinder::backend::hp3par_iscsi' do describe 'hp3par_iscsi backend with additional configuration' do before :each do - params.merge!({:extra_options => {'hp3par_iscsi/param1' => {'value' => 'value1'}}}) + params.merge!({:extra_options => {'hpe3par_iscsi/param1' => {'value' => 'value1'}}}) end it 'configure hp3par_iscsi backend with additional configuration' do - is_expected.to contain_cinder_config('hp3par_iscsi/param1').with({ + is_expected.to contain_cinder_config('hpe3par_iscsi/param1').with({ :value => 'value1', }) end diff --git a/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb b/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb new file mode 100644 index 00000000..0b87065b --- /dev/null +++ b/spec/defines/cinder_backend_hpe3par_iscsi_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +describe 'cinder::backend::hpe3par_iscsi' do + let (:title) { 'hpe3par_iscsi' } + + let :req_params do + { + :hpe3par_api_url => 'https://172.0.0.2:8080/api/v1', + :hpe3par_username => '3paradm', + :hpe3par_password => 'password', + :hpe3par_iscsi_ips => '172.0.0.3', + :san_ip => '172.0.0.2', + :san_login => '3paradm', + :san_password => 'password', + } + end + + let :params do + req_params + end + + describe 'hpe3par_iscsi volume driver' do + it 'configure hpe3par_iscsi volume driver' do + is_expected.to contain_cinder_config('hpe3par_iscsi/volume_driver').with_value('cinder.volume.drivers.hpe.hpe_3par_iscsi.HPE3PARISCSIDriver') + is_expected.to contain_cinder_config('hpe3par_iscsi/hpe3par_api_url').with_value('https://172.0.0.2:8080/api/v1') + is_expected.to contain_cinder_config('hpe3par_iscsi/hpe3par_username').with_value('3paradm') + is_expected.to contain_cinder_config('hpe3par_iscsi/hpe3par_password').with_value('password') + is_expected.to contain_cinder_config('hpe3par_iscsi/hpe3par_iscsi_ips').with_value('172.0.0.3') + is_expected.to contain_cinder_config('hpe3par_iscsi/san_ip').with_value('172.0.0.2') + is_expected.to contain_cinder_config('hpe3par_iscsi/san_login').with_value('3paradm') + is_expected.to contain_cinder_config('hpe3par_iscsi/san_password').with_value('password') + end + end + + describe 'hpe3par_iscsi backend with additional configuration' do + before :each do + params.merge!({:extra_options => {'hpe3par_iscsi/param1' => {'value' => 'value1'}}}) + end + + it 'configure hpe3par_iscsi backend with additional configuration' do + is_expected.to contain_cinder_config('hpe3par_iscsi/param1').with({ + :value => 'value1', + }) + end + end + +end