From d9bdd746dca1efbce08436727d4d564e341e7565 Mon Sep 17 00:00:00 2001 From: rajinir Date: Fri, 24 Apr 2020 11:46:11 -0500 Subject: [PATCH] Support for Dell EMC XtremIO Volume Config Added support for XtremIO volume config options. Supports both iSCSI and FC drivers. Supports deploying multiple instances of the cinder::backend::dellemc_xtremio backend (e.g. one iscsi + one fc, multiple iscsi, etc.). Change-Id: I5a02b90530057f616fb84de5b04d04865693ce2f --- manifests/profile/base/cinder/volume.pp | 14 ++++ .../base/cinder/volume/dellemc_xtremio.pp | 71 ++++++++++++++++++ .../xtremio-driver-f428e372280c44e6.yaml | 5 ++ ...tripleo_profile_base_cinder_volume_spec.rb | 33 ++++++++- ...ripleo_profile_base_cinder_xtremio_spec.rb | 72 +++++++++++++++++++ spec/fixtures/hieradata/step5.yaml | 3 + 6 files changed, 197 insertions(+), 1 deletion(-) create mode 100644 manifests/profile/base/cinder/volume/dellemc_xtremio.pp create mode 100644 releasenotes/notes/xtremio-driver-f428e372280c44e6.yaml create mode 100644 spec/classes/tripleo_profile_base_cinder_xtremio_spec.rb diff --git a/manifests/profile/base/cinder/volume.pp b/manifests/profile/base/cinder/volume.pp index 1417e7811..d0457da7c 100644 --- a/manifests/profile/base/cinder/volume.pp +++ b/manifests/profile/base/cinder/volume.pp @@ -46,6 +46,10 @@ # (Optional) Whether to enable the vnx backend # Defaults to false # +# [*cinder_enable_dellemc_xtremio_backend*] +# (Optional) Whether to enable the xtremio backend +# Defaults to false +# # [*cinder_enable_dellemc_xtremio_iscsi_backend*] # (Optional) Whether to enable the extremio iscsi backend # Defaults to false @@ -127,6 +131,7 @@ class tripleo::profile::base::cinder::volume ( $cinder_enable_dellemc_powermax_backend = false, $cinder_enable_dellemc_vmax_iscsi_backend = false, $cinder_enable_dellemc_vnx_backend = false, + $cinder_enable_dellemc_xtremio_backend = false, $cinder_enable_dellemc_xtremio_iscsi_backend = false, $cinder_enable_hpelefthand_backend = false, $cinder_enable_iscsi_backend = true, @@ -232,6 +237,14 @@ class tripleo::profile::base::cinder::volume ( $cinder_dellemc_vnx_backend_name = undef } + if $cinder_enable_dellemc_xtremio_backend { + include tripleo::profile::base::cinder::volume::dellemc_xtremio + $cinder_dellemc_xtremio_backend_name = hiera('cinder::backend::dellemc_xtremio::volume_backend_name', + 'tripleo_dellemc_xtremio') + } else { + $cinder_dellemc_xtremio_backend_name = undef + } + if $cinder_enable_dellemc_xtremio_iscsi_backend { include tripleo::profile::base::cinder::volume::dellemc_xtremio_iscsi $cinder_dellemc_xtreamio_iscsi_backend_name = hiera('cinder::backend::dellemc_extremio_iscsi::volume_backend_name', @@ -326,6 +339,7 @@ class tripleo::profile::base::cinder::volume ( $cinder_dellemc_powermax_backend_name, $cinder_dellemc_vmax_iscsi_backend_name, $cinder_dellemc_vnx_backend_name, + $cinder_dellemc_xtremio_backend_name, $cinder_dellemc_xtremio_iscsi_backend_name, $cinder_hpelefthand_backend_name, $cinder_netapp_backend_name, diff --git a/manifests/profile/base/cinder/volume/dellemc_xtremio.pp b/manifests/profile/base/cinder/volume/dellemc_xtremio.pp new file mode 100644 index 000000000..2479d546d --- /dev/null +++ b/manifests/profile/base/cinder/volume/dellemc_xtremio.pp @@ -0,0 +1,71 @@ +# Copyright (c) 2020 Dell Inc, or its subsidiaries. +# +# 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. +# +# == Class: tripleo::profile::base::cinder::volume::dellemc_xtremio +# +# Cinder Volume dellemc_xtremio profile for tripleo +# +# === Parameters +# +# [*backend_name*] +# (Optional) Name given to the Cinder backend stanza +# Defaults to 'tripleo_dellemc_xtremio' +# +# [*multi_config*] +# (Optional) A config hash when multiple backends are used. +# Defaults to hiera('cinder::backend::dellemc_xtremio::volume_multi_config', {}) +# +# [*step*] +# (Optional) The current step in deployment. See tripleo-heat-templates +# for more details. +# Defaults to hiera('step') +# +class tripleo::profile::base::cinder::volume::dellemc_xtremio ( + $backend_name = hiera('cinder::backend::dellemc_xtremio::volume_backend_name', ['tripleo_dellemc_xtremio']), + $multi_config = hiera('cinder::backend::dellemc_xtremio::volume_multi_config', {}), + $step = Integer(hiera('step')), +) { + include tripleo::profile::base::cinder::volume + + if $step >= 4 { + + $backend_defaults = { + 'CinderXtremioAvailabilityZone' => hiera('cinder::backend::dellemc_xtremio::backend_availability_zone', undef), + 'CinderXtremioSanIp' => hiera('cinder::backend::dellemc_xtremio::san_ip', undef), + 'CinderXtremioSanLogin' => hiera('cinder::backend::dellemc_xtremio::san_login', undef), + 'CinderXtremioSanPassword' => hiera('cinder::backend::dellemc_xtremio::san password', undef), + 'CinderXtremioStorageProtocol' => hiera('cinder::backend::dellemc_xtremio::xtremio_storage_protocol', undef), + 'CinderXtremioClusterName' => hiera('cinder::backend::dellemc_xtremio::xtremio_cluster_name', undef), + 'CinderXtremioArrayBusyRetryCount' => hiera('cinder::backend::dellemc_xtremio::xtremio_array_busy_retry_count', undef), + 'CinderXtremioArrayBusyRetryInterval'=> hiera('cinder::backend::dellemc_xtremio::xtremio_array_busy_retry_interval', undef), + 'CinderXtremioVolumesPerGlanceCache' => hiera('cinder::backend::dellemc_xtremio::xtremio_volumes_per_glance_cache', undef), + } + + any2array($backend_name).each |String $backend| { + $backend_config = merge($backend_defaults, pick($multi_config[$backend], {})) + + cinder::backend::dellemc_xtremio { $backend : + backend_availability_zone => $backend_config['CinderXtremioAvailabilityZone'], + san_ip => $backend_config['CinderXtremioSanIp'], + san_login => $backend_config['CinderXtremioSanLogin'], + san_password => $backend_config['CinderXtremioSanPassword'], + xtremio_storage_protocol => $backend_config['CinderXtremioStorageProtocol'], + xtremio_cluster_name => $backend_config['CinderXtremioSSN'], + xtremio_array_busy_retry_count => $backend_config['CinderXtremioArrayBusyRetryCount'], + xtremio_array_busy_retry_interval => $backend_config['CinderXtremioArrayBusyRetryInterval'], + xtremio_volumes_per_glance_cache => $backend_config['CinderXtremioVolumesPerGlanceCache'], + } + } + } +} diff --git a/releasenotes/notes/xtremio-driver-f428e372280c44e6.yaml b/releasenotes/notes/xtremio-driver-f428e372280c44e6.yaml new file mode 100644 index 000000000..66b9ee0fe --- /dev/null +++ b/releasenotes/notes/xtremio-driver-f428e372280c44e6.yaml @@ -0,0 +1,5 @@ +--- +features: + - Add Dell EMC XtremIO backend Cinder driver options. + Supports both iSCSI and FC volume drivers and + multiple backends as well diff --git a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb index 6b39815ae..220379925 100644 --- a/spec/classes/tripleo_profile_base_cinder_volume_spec.rb +++ b/spec/classes/tripleo_profile_base_cinder_volume_spec.rb @@ -92,6 +92,34 @@ describe 'tripleo::profile::base::cinder::volume' do end end + context 'with only xtremio' do + before :each do + params.merge!({ + :cinder_enable_dellemc_xtremio_backend => true, + :cinder_enable_iscsi_backend => false, + }) + end + it 'should configure only xtremio' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_xtremio') + is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::iscsi') + is_expected.to contain_class('tripleo::profile::base::cinder::volume') + is_expected.to contain_class('tripleo::profile::base::cinder') + is_expected.to contain_class('cinder::volume') + is_expected.to contain_class('cinder::backends').with( + :enabled_backends => ['tripleo_dellemc_xtremio'] + ) + end + context 'with multiple xtremio backends' do + # Step 5's hiera specifies two xtremio backend names + let(:params) { { :step => 5 } } + it 'should enable each backend' do + is_expected.to contain_class('cinder::backends').with( + :enabled_backends => ['tripleo_dellemc_xtremio_1', 'tripleo_dellemc_xtremio_2'] + ) + end + end + end + context 'with only powermax' do before :each do params.merge!({ @@ -269,6 +297,7 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::iscsi') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::pure') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_sc') + is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellemc_xtremio') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::dellsc') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::netapp') is_expected.to_not contain_class('tripleo::profile::base::cinder::volume::veritas_hyperscale') @@ -292,6 +321,7 @@ describe 'tripleo::profile::base::cinder::volume' do :cinder_enable_pure_backend => true, :cinder_enable_dellemc_sc_backend => true, :cinder_enable_dellsc_backend => true, + :cinder_enable_dellemc_xtremio_backend => true, :cinder_enable_netapp_backend => true, :cinder_enable_vrts_hs_backend => true, }) @@ -300,6 +330,7 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to contain_class('tripleo::profile::base::cinder::volume::iscsi') is_expected.to contain_class('tripleo::profile::base::cinder::volume::pure') is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_sc') + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_xtremio') is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellsc') is_expected.to contain_class('tripleo::profile::base::cinder::volume::netapp') is_expected.to contain_class('tripleo::profile::base::cinder::volume::veritas_hyperscale') @@ -309,7 +340,7 @@ describe 'tripleo::profile::base::cinder::volume' do is_expected.to contain_class('tripleo::profile::base::cinder') is_expected.to contain_class('cinder::volume') is_expected.to contain_class('cinder::backends').with( - :enabled_backends => ['tripleo_iscsi', 'tripleo_ceph', 'tripleo_pure', 'tripleo_dellsc', 'tripleo_dellemc_sc', + :enabled_backends => ['tripleo_iscsi', 'tripleo_ceph', 'tripleo_pure', 'tripleo_dellsc', 'tripleo_dellemc_sc', 'tripleo_dellemc_xtremio', 'tripleo_netapp','tripleo_nfs','Veritas_HyperScale'] ) end diff --git a/spec/classes/tripleo_profile_base_cinder_xtremio_spec.rb b/spec/classes/tripleo_profile_base_cinder_xtremio_spec.rb new file mode 100644 index 000000000..887ce1914 --- /dev/null +++ b/spec/classes/tripleo_profile_base_cinder_xtremio_spec.rb @@ -0,0 +1,72 @@ +# Copyright (c) 2020 Dell Inc, or its subsidiaries +# +# 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. +# + +require 'spec_helper' + +describe 'tripleo::profile::base::cinder::volume::dellemc_xtremio' do + shared_examples_for 'tripleo::profile::base::cinder::volume::dellemc_xtremio' do + before :each do + facts.merge!({ :step => params[:step] }) + end + + context 'with step less than 4' do + let(:params) { { :step => 3 } } + + it 'should do nothing' do + is_expected.to contain_class('tripleo::profile::base::cinder::volume::dellemc_xtremio') + is_expected.to contain_class('tripleo::profile::base::cinder::volume') + is_expected.to contain_class('tripleo::profile::base::cinder') + is_expected.to_not contain_cinder__backend__dellemc_xtremio('tripleo_dellemc_xtremio') + end + end + + context 'with step 4' do + let(:params) { { + :step => 4, + } } + + it 'should trigger complete configuration' do + is_expected.to contain_cinder__backend__dellemc_xtremio('tripleo_dellemc_xtremio') + end + + context 'with multiple backends' do + let(:params) { { + :backend_name => ['tripleo_dellemc_xtremio_1', 'tripleo_dellemc_xtremio_2'], + :multi_config => { 'tripleo_dellemc_xtremio_2' => { 'CinderXtremioStorageProtocol' => 'FC' }}, + :step => 4, + } } + + it 'should configure each backend' do + is_expected.to contain_cinder__backend__dellemc_xtremio('tripleo_dellemc_xtremio_1') + is_expected.to contain_cinder_config('tripleo_dellemc_xtremio_1/volume_driver') + .with_value('cinder.volume.drivers.dell_emc.xtremio.XtremIOISCSIDriver') + is_expected.to contain_cinder__backend__dellemc_xtremio('tripleo_dellemc_xtremio_2') + is_expected.to contain_cinder_config('tripleo_dellemc_xtremio_2/volume_driver') + .with_value('cinder.volume.drivers.dell_emc.xtremio.XtremIOFCDriver') + end + end + end + end + + on_supported_os.each do |os, facts| + context "on #{os}" do + let(:facts) do + facts.merge({ :hostname => 'node.example.com' }) + end + + it_behaves_like 'tripleo::profile::base::cinder::volume::dellemc_xtremio' + end + end +end diff --git a/spec/fixtures/hieradata/step5.yaml b/spec/fixtures/hieradata/step5.yaml index bc1b6e1ae..b04af19d9 100644 --- a/spec/fixtures/hieradata/step5.yaml +++ b/spec/fixtures/hieradata/step5.yaml @@ -12,3 +12,6 @@ cinder::backend::dellemc_powermax::volume_backend_name: cinder::backend::dellemc_sc::volume_backend_name: - 'tripleo_dellemc_sc_1' - 'tripleo_dellemc_sc_2' +cinder::backend::dellemc_xtremio::volume_backend_name: + - 'tripleo_dellemc_xtremio_1' + - 'tripleo_dellemc_xtremio_2'