Merge "Add support for Dell EMC Unity Cinder backend"

This commit is contained in:
Jenkins 2017-07-26 10:33:54 +00:00 committed by Gerrit Code Review
commit dab970ae3b
3 changed files with 152 additions and 0 deletions

View File

@ -0,0 +1,79 @@
# == define: cinder::backend::dellemc_unity
#
# Configure the Dell EMC Unity Driver for cinder.
#
# === Parameters
#
# [*san_ip*]
# (required) IP address of Unity Unisphere.
#
# [*san_login*]
# (required) Unity Unisphere user name.
#
# [*san_password*]
# (required) Unity Unisphere user password.
#
# [*storage_protocol*]
# (required) The Storage protocol, iSCSI or FC.
#
# [*volume_backend_name*]
# (optional) The storage backend name.
# Defaults to the $name of the backend
#
# [*unity_io_ports*]
# (optional) A comma-separated list of iSCSI or FC ports to be used.
# Each port can be Unix-style glob expressions. The Unity Unisphere API port.
# Defaults to $::os_service_default
#
# [*unity_storage_pool_names*]
# (optional) A comma-separated list of storage pool names to be used.
# Defaults to $::os_service_default
#
# [*extra_options*]
# (optional) Hash of extra options to pass to the backend stanza.
# Defaults to: {}
# Example:
# { 'dellemc_unity_backend/param1' => { 'value' => value1 } }
#
# [*manage_volume_type*]
# (Optional) Whether or not manage Cinder Volume type.
# If set to true, a Cinder Volume type will be created
# with volume_backend_name=$volume_backend_name key/value.
# Defaults to false.
#
define cinder::backend::dellemc_unity (
$san_ip,
$san_login,
$san_password,
$storage_protocol,
$volume_backend_name = $name,
$unity_io_ports = $::os_service_default,
$unity_storage_pool_names = $::os_service_default,
$manage_volume_type = false,
$extra_options = {},
) {
include ::cinder::deps
$driver = 'dell_emc.unity.Driver'
cinder_config {
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => "cinder.volume.drivers.${driver}";
"${name}/san_ip": value => $san_ip;
"${name}/san_login": value => $san_login;
"${name}/san_password": value => $san_password, secret => true;
"${name}/storage_protocol": value => $storage_protocol;
"${name}/unity_io_ports": value => $unity_io_ports;
"${name}/unity_storage_pool_names": value => $unity_storage_pool_names;
}
if $manage_volume_type {
cinder_type { $volume_backend_name:
ensure => present,
properties => ["volume_backend_name=${volume_backend_name}"],
}
}
create_resources('cinder_config', $extra_options)
}

View File

@ -0,0 +1,3 @@
---
features:
- Add Dell EMC Unity backend cinder driver support

View File

@ -0,0 +1,70 @@
require 'spec_helper'
describe 'cinder::backend::dellemc_unity' do
let (:config_group_name) { 'dellemc_unity' }
let (:title) { config_group_name }
let :params do
{
:san_ip => '172.23.8.101',
:san_login => 'Admin',
:san_password => '12345',
:storage_protocol => 'iSCSI',
}
end
let :default_params do
{
:unity_io_ports => '<SERVICE DEFAULT>',
:unity_storage_pool_names => '<SERVICE DEFAULT>',
}
end
let :facts do
OSDefaults.get_facts({})
end
shared_examples_for 'dellemc_unity volume driver' do
let :params_hash do
default_params.merge(params)
end
it 'configures cinder volume driver' do
is_expected.to contain_cinder__backend__dellemc_unity(config_group_name)
is_expected.to contain_cinder_config("#{title}/volume_driver").with_value(
'cinder.volume.drivers.dell_emc.unity.Driver')
params_hash.each_pair do |config,value|
is_expected.to contain_cinder_config("#{config_group_name}/#{config}").with_value( value )
end
end
end
context 'with parameters' do
it_configures 'dellemc_unity volume driver'
end
context 'dellemc_unity backend with additional configuration' do
before do
params.merge!({:extra_options => {'dellemc_unity/param1' => { 'value' => 'value1' }}})
end
it 'configure dellemc_unity backend with additional configuration' do
is_expected.to contain_cinder_config('dellemc_unity/param1').with({
:value => 'value1'
})
end
end
context 'dellemc_unity backend with cinder type' do
before do
params.merge!({:manage_volume_type => true})
end
it 'should create type with properties' do
should contain_cinder_type('dellemc_unity').with(:ensure => :present, :properties => ['volume_backend_name=dellemc_unity'])
end
end
end