Add support for Dell EMC Unity backend

This change adds a new define for manila::backend::dellemc_unity,
allowing users to create multiple backend definitions within their puppet
manifests for use with Manila.

Change-Id: I72d5361e20969ad3f4393dd7e93d9c6386681331
Closes-Bug: #1705331
This commit is contained in:
rajinir
2017-07-24 11:38:19 -05:00
parent 76109b8808
commit 2c3e830b73
3 changed files with 176 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
# == define: manila::backend::dellemc_unity
#
# Configures Manila to use the Dell EMC Isilon share driver
# Compatible for multiple backends
#
# === Parameters
#
# [*driver_handles_share_servers*]
# (required) Denotes whether the driver should handle the responsibility of
# managing share servers. This must be set to false if the driver is to
# operate without managing share servers.
# Unity driver requires this option to be as True.
#
# [*emc_nas_login*]
# (required) Administrative user account name used to access the storage
# system.
#
# [*emc_nas_password*]
# (required) Password for the administrative user account specified in the
# emc_nas_login parameter.
#
# [*emc_nas_server*]
# (required) The hostname (or IP address) for the storage system.
#
# [*emc_share_backend*]
# (required) Share backend.
#
# [*share_backend_name*]
# (optional) Name of the backend in manila.conf that
# these settings will reside in
#
# [*unity_server_meta_pool*]
# (optional) The name of the pool to persist the meta-data of NAS server.
# Defaults to None
#
# [*unity_share_data_pools*]
# (optional) Comma separated list specifying the name of the pools to be
# used by this back end. Do not set this option if all storage pools on the
# system can be used. Wild card character is supported
# Defaults to None
#
# [*unity_ethernet_ports*]
# (optional) Comma separated list specifying the ethernet ports of Unity
# system that can be used for share. Do not set this option if all ethernet
# ports can be used. Wild card character is supported. Both the normal ethernet
# port and link aggregation port can be used by Unity share driver.
# Defaults to None
#
# [*package_ensure*]
# (optional) Ensure state for package. Defaults to 'present'.
#
# === Examples
#
# manila::backend::dellemc_unity { 'myBackend':
# driver_handles_share_servers => true,
# emc_nas_login => 'admin',
# emc_nas_password => 'password',
# emc_nas_server => <IP address of Unity Syste,>,
# emc_share_backend => 'unity',
# }
#
define manila::backend::dellemc_unity (
$driver_handles_share_servers,
$emc_nas_login,
$emc_nas_password,
$emc_nas_server,
$emc_share_backend,
$share_backend_name = $name,
$unity_server_meta_pool = undef,
$unity_share_data_pools = undef ,
$unity_ethernet_ports = undef,
$package_ensure = 'present',
) {
include ::manila::deps
validate_string($emc_nas_password)
$unity_share_driver = 'manila.share.drivers.emc.driver.EMCShareDriver'
manila_config {
"${share_backend_name}/share_driver": value => $unity_share_driver;
"${share_backend_name}/driver_handles_share_servers": value => $driver_handles_share_servers;
"${share_backend_name}/emc_nas_login": value => $emc_nas_login;
"${share_backend_name}/emc_nas_password": value => $emc_nas_password, secret => true;
"${share_backend_name}/emc_nas_server": value => $emc_nas_server;
"${share_backend_name}/share_backend_name": value => $share_backend_name;
"${share_backend_name}/emc_share_backend": value => $emc_share_backend;
"${share_backend_name}/unity_server_meta_pool": value => $unity_server_meta_pool;
"${share_backend_name}/unity_share_data_pools": value => $unity_share_data_pools;
"${share_backend_name}/unity_ethernet_ports": value => $unity_ethernet_ports;
}
ensure_resource('package','nfs-utils',{
ensure => $package_ensure,
tag => 'manila-support-package',
})
#Python library storops is required to run Unity driver.
package{'storops':
ensure => $package_ensure,
provider => 'pip',
}
}

View File

@@ -0,0 +1,3 @@
---
features:
- Add support for Dell EMC Unity Driver

View File

@@ -0,0 +1,69 @@
require 'spec_helper'
describe 'manila::backend::dellemc_unity' do
let(:title) {'dellemc_unity'}
let :params do
{
:driver_handles_share_servers => true,
:emc_nas_login => 'admin',
:emc_nas_password => 'password',
:emc_nas_server => '127.0.0.2',
:emc_share_backend => 'unity',
:unity_server_meta_pool => 'pool1',
:unity_share_data_pools => '*',
:unity_ethernet_ports => 'eth1',
}
end
let :default_params do
{
:unity_server_meta_pool => '<SERVICE DEFAULT>',
:unity_share_data_pools => '<SERVICE DEFAULT>',
:unity_ethernet_ports => '<SERVICE DEFAULT>',
}
end
shared_examples_for 'dell emc unity share driver' do
let :params_hash do
default_params.merge(params)
end
it 'configures dell emc unity share driver' do
is_expected.to contain_manila_config("dellemc_unity/share_driver").with_value(
'manila.share.drivers.emc.driver.EMCShareDriver')
params_hash.each_pair do |config,value|
is_expected.to contain_manila_config("dellemc_unity/#{config}").with_value( value )
end
end
it 'marks emc_nas_password as secret' do
is_expected.to contain_manila_config("dellemc_unity/emc_nas_password").with_secret( true )
end
end
context 'with default parameters' do
before do
params = {}
end
it_configures 'dell emc unity share driver'
end
context 'with provided parameters' do
it_configures 'dell emc unity share driver'
end
context 'with share server config' do
before do
params.merge!({
:emc_nas_password => true,
})
end
it { is_expected.to raise_error(Puppet::Error, /true is not a string. It looks to be a TrueClass/) }
end
end