diff --git a/manifests/volume/backend/eqlx.pp b/manifests/volume/backend/eqlx.pp new file mode 100644 index 00000000..39694708 --- /dev/null +++ b/manifests/volume/backend/eqlx.pp @@ -0,0 +1,100 @@ +# +# Copyright (C) 2014 eNovance SAS +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# Configure Dell EqualLogic backend for Cinder +# +# +# === Parameters +# +# [*san_ip*] +# (required) The IP address of the Dell EqualLogic array. +# +# [*san_login*] +# (required) The account to use for issuing SSH commands. +# +# [*san_password*] +# (required) The password for the specified SSH account. +# +# [*san_thin_provision*] +# (optional) Whether or not to use thin provisioning for volumes. +# Defaults to true +# +# [*volume_backend_name*] +# (optional) The backend name. +# Defaults to the name of the resource +# +# [*eqlx_group_name*] +# (optional) The CLI prompt message without '>'. +# Defaults to 'group-0' +# +# [*eqlx_pool*] +# (optional) The pool in which volumes will be created. +# Defaults to 'default' +# +# [*eqlx_use_chap*] +# (optional) Use CHAP authentification for targets? +# Defaults to false +# +# [*eqlx_chap_login*] +# (optional) An existing CHAP account name. +# Defaults to 'chapadmin' +# +# [*eqlx_chap_password*] +# (optional) The password for the specified CHAP account name. +# Defaults to '12345' +# +# [*eqlx_cli_timeout*] +# (optional) The timeout for the Group Manager cli command execution. +# Defaults to 30 seconds +# +# [*eqlx_cli_max_retries*] +# (optional) The maximum retry count for reconnection. +# Defaults to 5 +# +define cloud::volume::backend::eqlx ( + $san_ip, + $san_login, + $san_password, + $san_thin_provision = true, + $volume_backend_name = $name, + $eqlx_group_name = 'group-0', + $eqlx_pool = 'default', + $eqlx_use_chap = false, + $eqlx_chap_login = 'chapadmin', + $eqlx_chap_password = '12345', + $eqlx_cli_timeout = 30, + $eqlx_cli_max_retries = 5, +) { + + cinder::backend::eqlx { $name: + san_ip => $san_ip, + san_login => $san_login, + san_password => $san_password, + san_thin_provision => $san_thin_provision, + eqlx_group_name => $eqlx_group_name, + eqlx_pool => $eqlx_pool, + eqlx_use_chap => $eqlx_use_chap, + eqlx_chap_login => $eqlx_chap_login, + eqlx_chap_password => $eqlx_chap_password, + eqlx_cli_timeout => $eqlx_cli_timeout, + eqlx_cli_max_retries => $eqlx_cli_max_retries, + } + + @cinder::type { $volume_backend_name: + set_key => 'volume_backend_name', + set_value => $volume_backend_name, + notify => Service['cinder-volume'] + } +} diff --git a/manifests/volume/storage.pp b/manifests/volume/storage.pp index 33b55843..cde3f228 100644 --- a/manifests/volume/storage.pp +++ b/manifests/volume/storage.pp @@ -97,6 +97,14 @@ class cloud::volume::storage( $emc_vnx_backends = { } } + if has_key($cinder_backends, 'eqlx') { + $eqlx_backends = $cinder_backends['eqlx'] + create_resources('cloud::volume::backend::eqlx', $eqlx_backends) + } + else { + $eqlx_backends = { } + } + if has_key($cinder_backends, 'nfs') { $nfs_backends = $cinder_backends['nfs'] create_resources('cloud::volume::backend::nfs', $nfs_backends) @@ -106,7 +114,7 @@ class cloud::volume::storage( } class { 'cinder::backends': - enabled_backends => keys(merge($rbd_backends, $netapp_backends, $iscsi_backends, $emc_vnx_backends, $nfs_backends)) + enabled_backends => keys(merge($rbd_backends, $netapp_backends, $iscsi_backends, $emc_vnx_backends, $eqlx_backends, $nfs_backends)) } # Manage Volume types. diff --git a/spec/classes/cloud_volume_storage_spec.rb b/spec/classes/cloud_volume_storage_spec.rb index 2e77d4c1..b429e4cd 100644 --- a/spec/classes/cloud_volume_storage_spec.rb +++ b/spec/classes/cloud_volume_storage_spec.rb @@ -70,6 +70,14 @@ describe 'cloud::volume::storage' do 'storage_vnx_pool_name' => 'emc-volumes', } }, + 'eqlx' => { + 'dell' => { + 'san_ip' => '10.0.0.1', + 'san_login' => 'admin', + 'san_password' => 'secrete', + 'eqlx_group_name' => 'dell-volumes', + } + }, 'nfs' => { 'freenas' => { 'nfs_servers' => ['10.0.0.1:/myshare'], @@ -185,6 +193,21 @@ describe 'cloud::volume::storage' do end end + context 'with EQLX backend' do + it 'configures EQLX volume driver' do + should contain_cinder_config('dell/volume_backend_name').with_value('dell') + should contain_cinder_config('dell/san_ip').with_value('10.0.0.1') + should contain_cinder_config('dell/san_login').with_value('admin') + should contain_cinder_config('dell/san_password').with_value('secrete') + should contain_cinder_config('dell/eqlx_group_name').with_value('dell-volumes') + should contain_cinder__type('dell').with( + :set_key => 'volume_backend_name', + :set_value => 'dell', + :notify => 'Service[cinder-volume]' + ) + end + end + context 'with NFS backend' do it 'configures NFS volume driver' do is_expected.to contain_cinder_config('freenas/volume_backend_name').with_value('freenas') @@ -256,7 +279,7 @@ describe 'cloud::volume::storage' do context 'with all backends enabled' do it 'configure all cinder backends' do is_expected.to contain_class('cinder::backends').with( - :enabled_backends => ['lowcost', 'premium', 'fast', 'very-fast', 'freenas'] + :enabled_backends => ['lowcost', 'premium', 'fast', 'very-fast', 'dell', 'freenas'] ) end end