Add support for Pure Volume Drivers
This allows for someone to configure Cinder to use the PureISCSIDriver
or PureFCDriver. This can be done either in the default section of the
volume config or as a backend definition.
For example:
class { ‘cinder::volume::pure’:
‘san_ip’ => ‘1.2.3.4’,
‘pure_api_token’ => ‘abcdef123456789,
‘pure_storage_protocol’ => ‘iSCSI’,
}
or
cinder::backend::pure {‘pure-iscsi’,
‘san_ip’ => ‘1.2.3.4’,
‘pure_api_token’ => ‘abcdef123457890’,
‘pure_storage_protocol’ => ‘iSCSI’,
}
Change-Id: If5aebb1f19f666eb158e337f7609e2503f6eb967
This commit is contained in:
62
manifests/backend/pure.pp
Normal file
62
manifests/backend/pure.pp
Normal file
@@ -0,0 +1,62 @@
|
||||
# == Class: cinder::backend::pure
|
||||
#
|
||||
# Configures Cinder volume PureStorage driver.
|
||||
# Parameters are particular to each volume driver.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*san_ip*]
|
||||
# (required) IP address of PureStorage management VIP.
|
||||
#
|
||||
# [*pure_api_token*]
|
||||
# (required) API token for management of PureStorage array.
|
||||
#
|
||||
# [*volume_backend_name*]
|
||||
# (optional) Allows for the volume_backend_name to be separate of $name.
|
||||
# Defaults to: $name
|
||||
#
|
||||
# [*pure_storage_protocol*]
|
||||
# (optional) Must be either 'iSCSI' or 'FC'. This will determine
|
||||
# which Volume Driver will be configured; PureISCSIDriver or PureFCDriver.
|
||||
# Defaults to 'iSCSI'
|
||||
#
|
||||
# [*use_multipath_for_image_xfer*]
|
||||
# (optional) .
|
||||
# Defaults to True
|
||||
#
|
||||
# [*use_chap_auth*]
|
||||
# (optional) Only affects the PureISCSIDriver.
|
||||
# Defaults to False
|
||||
#
|
||||
# [*extra_options*]
|
||||
# (optional) Hash of extra options to pass to the backend stanza.
|
||||
# Defaults to: {}
|
||||
# Example :
|
||||
# { 'pure_backend/param1' => { 'value' => value1 } }
|
||||
#
|
||||
define cinder::backend::pure(
|
||||
$san_ip,
|
||||
$pure_api_token,
|
||||
$volume_backend_name = $name,
|
||||
$pure_storage_protocol = 'iSCSI',
|
||||
$use_chap_auth = false,
|
||||
$use_multipath_for_image_xfer = true,
|
||||
$extra_options = {},
|
||||
) {
|
||||
|
||||
$volume_driver = $pure_storage_protocol ? {
|
||||
'FC' => 'cinder.volume.drivers.pure.PureFCDriver',
|
||||
'iSCSI' => 'cinder.volume.drivers.pure.PureISCSIDriver'
|
||||
}
|
||||
|
||||
cinder_config {
|
||||
"${name}/volume_backend_name": value => $volume_backend_name;
|
||||
"${name}/volume_driver": value => $volume_driver;
|
||||
"${name}/san_ip": value => $san_ip;
|
||||
"${name}/pure_api_token": value => $pure_api_token, secret => true;
|
||||
"${name}/use_chap_auth": value => $use_chap_auth;
|
||||
"${name}/use_multipath_for_image_xfer": value => $use_multipath_for_image_xfer ;
|
||||
}
|
||||
|
||||
create_resources('cinder_config', $extra_options)
|
||||
}
|
||||
56
manifests/volume/pure.pp
Normal file
56
manifests/volume/pure.pp
Normal file
@@ -0,0 +1,56 @@
|
||||
# == Class: cinder::volume::pure
|
||||
#
|
||||
# Configures Cinder volume PureStorage driver.
|
||||
# Parameters are particular to each volume driver.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*san_ip*]
|
||||
# (required) IP address of PureStorage management VIP.
|
||||
#
|
||||
# [*pure_api_token*]
|
||||
# (required) API token for management of PureStorage array.
|
||||
#
|
||||
# [*volume_backend_name*]
|
||||
# (optional) Allows for the volume_backend_name to be separate of $name.
|
||||
# Defaults to: $name
|
||||
#
|
||||
# [*pure_storage_protocol*]
|
||||
# (optional) Must be either 'iSCSI' or 'FC'. This will determine
|
||||
# which Volume Driver will be configured; PureISCSIDriver or PureFCDriver.
|
||||
# Defaults to 'iSCSI'
|
||||
#
|
||||
# [*use_multipath_for_image_xfer*]
|
||||
# (optional) .
|
||||
# Defaults to True
|
||||
#
|
||||
# [*use_chap_auth*]
|
||||
# (optional) Only affects the PureISCSIDriver.
|
||||
# Defaults to False
|
||||
#
|
||||
# [*extra_options*]
|
||||
# (optional) Hash of extra options to pass to the backend stanza.
|
||||
# Defaults to: {}
|
||||
# Example :
|
||||
# { 'pure_backend/param1' => { 'value' => value1 } }
|
||||
#
|
||||
class cinder::volume::pure(
|
||||
$san_ip,
|
||||
$pure_api_token,
|
||||
$use_chap_auth = false,
|
||||
$volume_backend_name = '',
|
||||
$use_multipath_for_image_xfer = true,
|
||||
$pure_storage_protocol = 'iSCSI',
|
||||
$extra_options = {},
|
||||
) {
|
||||
|
||||
cinder::backend::pure { 'DEFAULT':
|
||||
san_ip => $san_ip,
|
||||
pure_api_token => $pure_api_token,
|
||||
pure_storage_protocol => $pure_storage_protocol,
|
||||
use_chap_auth => $use_chap_auth,
|
||||
use_multipath_for_image_xfer => $use_multipath_for_image_xfer,
|
||||
volume_backend_name => $volume_backend_name,
|
||||
extra_options => $extra_options,
|
||||
}
|
||||
}
|
||||
62
spec/classes/cinder_volume_pure_spec.rb
Normal file
62
spec/classes/cinder_volume_pure_spec.rb
Normal file
@@ -0,0 +1,62 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::volume::pure' do
|
||||
|
||||
let :req_params do
|
||||
{
|
||||
:san_ip => '127.0.0.2',
|
||||
:pure_api_token => 'abc123def456ghi789'
|
||||
}
|
||||
end
|
||||
|
||||
describe 'pure volume driver defaults' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'configure pure volume driver' do
|
||||
should contain_cinder__backend__pure('DEFAULT')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pure iscsi volume driver' do
|
||||
let :params do
|
||||
req_params.merge({
|
||||
'pure_storage_protocol' => 'iSCSI',
|
||||
'use_chap_auth' => 'true'
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure pure volume driver' do
|
||||
should contain_cinder__backend__pure('DEFAULT').with({
|
||||
:pure_storage_protocol => 'iSCSI',
|
||||
:use_chap_auth => 'true'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pure fc volume driver' do
|
||||
let :params do
|
||||
req_params.merge({'pure_storage_protocol' => 'FC'})
|
||||
end
|
||||
|
||||
it 'configure pure volume driver' do
|
||||
should contain_cinder__backend__pure('DEFAULT').with({
|
||||
:pure_storage_protocol => 'FC'
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pure volume driver with additional configuration' do
|
||||
let :params do
|
||||
req_params.merge({:extra_options => {'pure_backend/param1' => {'value' => 'value1'}}})
|
||||
end
|
||||
|
||||
it 'configure pure volume with additional configuration' do
|
||||
should contain_cinder__backend__pure('DEFAULT').with({
|
||||
:extra_options => {'pure_backend/param1' => {'value' => 'value1'}}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
70
spec/defines/cinder_backend_pure_spec.rb
Normal file
70
spec/defines/cinder_backend_pure_spec.rb
Normal file
@@ -0,0 +1,70 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'cinder::backend::pure' do
|
||||
let (:title) { 'pure' }
|
||||
|
||||
let :req_params do
|
||||
{
|
||||
:san_ip => '127.0.0.2',
|
||||
:pure_api_token => 'abc123def456ghi789'
|
||||
}
|
||||
end
|
||||
|
||||
describe 'pure volume driver defaults' do
|
||||
let :params do
|
||||
req_params
|
||||
end
|
||||
|
||||
it 'configure pure volume driver' do
|
||||
is_expected.to contain_cinder_config('pure/volume_driver').with_value('cinder.volume.drivers.pure.PureISCSIDriver')
|
||||
is_expected.to contain_cinder_config('pure/san_ip').with_value('127.0.0.2')
|
||||
is_expected.to contain_cinder_config('pure/pure_api_token').with_value('abc123def456ghi789')
|
||||
is_expected.to contain_cinder_config('pure/use_multipath_for_image_xfer').with_value('true')
|
||||
is_expected.to contain_cinder_config('pure/use_chap_auth').with_value('false')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pure iscsi volume driver' do
|
||||
let :params do
|
||||
req_params.merge({
|
||||
'pure_storage_protocol' => 'iSCSI',
|
||||
'use_chap_auth' => 'true'
|
||||
})
|
||||
end
|
||||
|
||||
it 'configure pure volume driver' do
|
||||
is_expected.to contain_cinder_config('pure/volume_driver').with_value('cinder.volume.drivers.pure.PureISCSIDriver')
|
||||
is_expected.to contain_cinder_config('pure/san_ip').with_value('127.0.0.2')
|
||||
is_expected.to contain_cinder_config('pure/pure_api_token').with_value('abc123def456ghi789')
|
||||
is_expected.to contain_cinder_config('pure/use_multipath_for_image_xfer').with_value('true')
|
||||
is_expected.to contain_cinder_config('pure/use_chap_auth').with_value('true')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pure fc volume driver' do
|
||||
let :params do
|
||||
req_params.merge({'pure_storage_protocol' => 'FC'})
|
||||
end
|
||||
|
||||
it 'configure pure volume driver' do
|
||||
is_expected.to contain_cinder_config('pure/volume_driver').with_value('cinder.volume.drivers.pure.PureFCDriver')
|
||||
is_expected.to contain_cinder_config('pure/san_ip').with_value('127.0.0.2')
|
||||
is_expected.to contain_cinder_config('pure/pure_api_token').with_value('abc123def456ghi789')
|
||||
is_expected.to contain_cinder_config('pure/use_multipath_for_image_xfer').with_value('true')
|
||||
is_expected.to contain_cinder_config('pure/use_chap_auth').with_value('false')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'pure volume driver with additional configuration' do
|
||||
let :params do
|
||||
req_params.merge({:extra_options => {'pure_backend/param1' => {'value' => 'value1'}}})
|
||||
end
|
||||
|
||||
it 'configure pure volume with additional configuration' do
|
||||
should contain_cinder__backend__pure('pure').with({
|
||||
:extra_options => {'pure_backend/param1' => {'value' => 'value1'}}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user