Add multi backend support

Add missing dependencies on compute node
Add capacity to deploy cinder role on a non controller node

Change-Id: Ibc5954f4309dd9198752d5cec701a6187c4f8a6d
This commit is contained in:
sbartel 2015-06-09 09:27:53 +02:00
parent a08978e176
commit c0cd3c7458
23 changed files with 539 additions and 52 deletions

View File

@ -319,6 +319,14 @@ None.
Release Notes
-------------
**1.2.0**
* add multi backend support
* add missing dependencies on compute node
* add capacity to deploy cinder role on a non controller node
**1.1.0**
* add 7 mode storage familly support

View File

@ -0,0 +1,2 @@
$fuel_settings = parseyaml(file('/etc/astute.yaml'))
class {'plugin_cinder_netapp::cinder': }

View File

@ -0,0 +1,2 @@
$fuel_settings = parseyaml(file('/etc/astute.yaml'))
class {'plugin_cinder_netapp::compute': }

View File

@ -1,2 +1,2 @@
$fuel_settings = parseyaml($astute_settings_yaml)
class {'plugin_cinder_netapp': }
class {'plugin_cinder_netapp::controller': }

View File

@ -0,0 +1,27 @@
# this can be used to insert into cinder_iscsi section lvm configuration parameters
#
# [iscsi_ip_address] The IP address that the iSCSI daemon is listening on
# [iscsi_helper] iSCSI target user-land tool to use
# [volume_group] Name for the VG that will contain exported volumes)
#
# === Examples
#
# class { 'plugin_cinder_netapp::backend::iscsi':
# $iscsi_ip_address = '127.0.0.1',
# $iscsi_helper,
# $volume_group = 'cinder' ,
# }
#
class plugin_cinder_netapp::backend::iscsi(
$volume_group = 'cinder'
)
{
$iscsi_ip_address = $::internal_address
$iscsi_helper = $cinder::params::iscsi_helper
cinder_config {
"cinder_isci/volume_backend_name": value => 'cinder_isci';
"cinder_isci/iscsi_ip_address": value => $iscsi_ip_address;
"cinder_isci/iscsi_helper": value => $iscsi_helper;
"cinder_isci/volume_group": value => $volume_group;
}
}

View File

@ -1,51 +1,31 @@
class plugin_cinder_netapp
{
include cinder::params
#TODO: (Dmitry Ukov) improve logic as soon as multibackend is implemented
if $::fuel_settings['cinder_netapp']['multibackend'] {
$section = 'cinder_netapp'
} else {
$section = 'DEFAULT'
}
# this can be used to create a netapp volume backend for cinder
#
# [section] name of the sectoin of cinder.conf on which netapp parameters should be inserted
# [backends] name of the other backends in a multibackend config (optionnal)
#
# === Examples
#
# plugin_cinder_netapp::backend::netapp{ 'netapp':
# backends => Lvm1,
# }
#
define plugin_cinder_netapp::backend::netapp (
$section = $name,
$backends ="",
$mutlibackends = false,
$cinder_node = false
) {
include cinder::client
#Ensure that $ symbole is correctly escaped in netapp password
$netapp_password = regsubst($::fuel_settings['cinder_netapp']['netapp_password'],'\$','$$','G')
case $::osfamily {
'Debian': {
package { 'nfs-common':
before => Cinder::Backend::Netapp['cinder_netapp'],
}
}
'RedHat': {
package { 'nfs-utils': } ->
service {'rpcbind':
ensure => running,
} ->
service {'rpcidmapd':
ensure => running,
} ->
service {'nfs':
ensure => running,
before => Cinder::Backend::Netapp['cinder_netapp'],
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat and Debian")
}
}
file { '/etc/cinder/shares.conf':
content => "${::fuel_settings['cinder_netapp']['nfs_server_ip']}:${::fuel_settings['cinder_netapp']['nfs_server_share']}"
} ->
cinder::backend::netapp { 'cinder_netapp':
$backend_name='cinder_netapp'
cinder::backend::netapp { "${backend_name}":
netapp_login => $::fuel_settings['cinder_netapp']['netapp_login'],
netapp_password => $netapp_password,
netapp_server_hostname => $::fuel_settings['cinder_netapp']['netapp_server_hostname'],
volume_backend_name => $section,
netapp_server_port => $::fuel_settings['cinder_netapp']['netapp_server_port'],
netapp_size_multiplier => $::fuel_settings['cinder_netapp']['netapp_size_multiplier'],
netapp_size_multiplier => $::fuel_settings['cinder_netapp']['netappsize_multiplier'],
netapp_storage_family => $::fuel_settings['cinder_netapp']['netapp_storage_family'],
netapp_storage_protocol => $::fuel_settings['cinder_netapp']['netapp_storage_protocol'],
netapp_transport_type => $::fuel_settings['cinder_netapp']['netapp_transport_type'],
@ -55,13 +35,24 @@ class plugin_cinder_netapp
expiry_thres_minutes => $::fuel_settings['cinder_netapp']['expiry_thres_minutes'],
thres_avl_size_perc_start => $::fuel_settings['cinder_netapp']['thres_avl_size_perc_start'],
thres_avl_size_perc_stop => $::fuel_settings['cinder_netapp']['thres_avl_size_perc_stop'],
nfs_shares_config => '/etc/cinder/shares.conf',
nfs_shares_config => "/etc/cinder/shares.conf",
netapp_copyoffload_tool_path => $::fuel_settings['cinder_netapp']['netapp_copyoffload_tool_path'],
#netapp_controller_ips => '',
#netapp_sa_password => '',
#netapp_storage_pools => '',
#netapp_webservice_path => '/devmgr/v2',
} ~>
service { $::cinder::params::volume_service:
}
$index = $::fuel_settings['cinder_netapp']['nb_share']
if $mutlibackends{
cinder_config {
"DEFAULT/enabled_backends": value => "${backends},${backend_name}";
}
}
if $cinder_node{
plugin_cinder_netapp::backend::share{ "share-${index}":
index => $index
}
}
}

View File

@ -0,0 +1,48 @@
# this can be used to inssert into cinder_rbd section rbd configuration parameters
#
# [rbd_pool] The RADOS pool where rbd volumes are stored
# [rbd_user] The RADOS client name for accessing rbd volumes
# [rbd_ceph_conf] Path to the ceph configuration file
# [rbd_flatten_volume_from_snapshot] Flatten volumes created from snapshots to remove dependency
# [rbd_secret_uuid] The libvirt uuid of the secret for the rbd_user volumes
# [volume_tmp_dir] Directory where temporary image files are stored when the
# volume driver does not write them directly to the volum)
# [rbd_max_clone_depth] Maximum number of nested volume clones that are taken before
# a flatten occurs. Set to 0 to disable cloning.
# [glance_api_version] Version of the glance API to use
#
# === Examples
#
# class { 'plugin_cinder_netapp::backend::rbdi':
# $rbd_pool = 'volumes',
# $rbd_user = 'volumes',
# $rbd_ceph_conf = '/etc/ceph/ceph.conf',
# $rbd_flatten_volume_from_snapshot = false,
# $rbd_secret_uuid = 'a5d0dd94-57c4-ae55-ffe0-7e3732a24455',
# $volume_tmp_dir = false,
# $rbd_max_clone_depth = '5',
# $glance_api_version = undef,
# }
#
class plugin_cinder_netapp::backend::rbd(
$rbd_pool = 'volumes',
$rbd_user = 'volumes',
$rbd_ceph_conf = '/etc/ceph/ceph.conf',
$rbd_flatten_volume_from_snapshot = false,
$rbd_secret_uuid = 'a5d0dd94-57c4-ae55-ffe0-7e3732a24455',
$volume_tmp_dir = false,
$rbd_max_clone_depth = '5',
$glance_api_version = undef,
){
cinder_config {
"cinder_rbd/volume_backend_name": value => 'cinder_rbd';
"cinder_rbd/volume_driver": value => 'cinder.volume.drivers.rbd.RBDDriver';
"cinder_rbd/rbd_ceph_conf": value => $rbd_ceph_conf;
"cinder_rbd/rbd_user": value => $rbd_user;
"cinder_rbd/rbd_pool": value => $rbd_pool;
"cinder_rbd/rbd_max_clone_depth": value => $rbd_max_clone_depth;
"cinder_rbd{name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot;
"cinder_rbd/host": value => "rbd:${rbd_pool}";
}
}

View File

@ -0,0 +1,33 @@
# this can be used to create recurively n shares for tnetapp volume backend
# [index] index of the current share
# [shares] shares previsouly create onf the followinf format <ip>:<share1>\n><ip>:<share2>\n....
#
# === Examples
#
# plugin_cinder_netapp::backend::share{ 'share1':
# index => 1,
# shares => 192.168.0.3:/vol1\n
# }
#
define plugin_cinder_netapp::backend::share (
$index,
$shares = ""
) {
$ip=$::fuel_settings['cinder_netapp']['nfs_server_ip']
$share=$::fuel_settings['cinder_netapp']["nfs_server_share${index}"]
$minus1 = inline_template('<%= index.to_i - 1 %>')
if ("${minus1}" == '0') {
# last share is reached, write information into shares.conf
file { '/etc/cinder/shares.conf':
content => "${ip}:${share}\n${shares}"
} ~>
service { $::cinder::params::volume_service:
}
} else{
# recurse until index 1 is reached
plugin_cinder_netapp::backend::share { "share-${minus1}":
index => $minus1,
shares => "${ip}:${share}\n${shares}",
}
}
}

View File

@ -0,0 +1,18 @@
# The plugin_cinder_netapp class is able to inder to use netapp as a storage backend
# (7Mode and cluster mode storage familly). If the multibackend option is checked
# cinder will used the netapp backend and the ceph or lvm (according to intial configuration)
# as multibackend storage
#
class plugin_cinder_netapp::cinder
inherits plugin_cinder_netapp::params {
$cinder_hash = $::fuel_settings['cinder']
if $::fuel_settings['cinder_netapp']['multibackend'] {
class { 'plugin_cinder_netapp::multibackend_cinder':}
} else {
$section = 'DEFAULT'
plugin_cinder_netapp::backend::netapp{ "cinder_netapp":
section => $section,
cinder_node => true
}
}
}

View File

@ -0,0 +1,82 @@
# ==Define: plugin_cinder_netapp::cinder::type
#
# #TODO to remove when https://bugs.launchpad.net/fuel/+bug/1461485 will be fix
# Creates cinder type and assigns backends.
#
# === Parameters
#
# [*os_password*]
# (required) The keystone tenant:username password.
#
# [*set_key*]
# (optional) Must be used with set_value. Accepts a single string be used
# as the key in type_set
#
# [*set_value*]
# (optional) Accepts list of strings or singular string. A list of values
# passed to type_set
#
# [*os_tenant_name*]
# (optional) The keystone tenant name. Defaults to 'admin'.
#
# [*os_username*]
# (optional) The keystone user name. Defaults to 'admin.
#
# [*os_auth_url*]
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*os_region_name*]
# (optional) The keystone region name. Default is unset.
#
# Author: Andrew Woodward <awoodward@mirantis.com>
define plugin_cinder_netapp::cinder::type (
$os_password,
$set_key = undef,
$set_value = undef,
$os_tenant_name = 'admin',
$os_username = 'admin',
$os_auth_url = 'http://127.0.0.1:5000/v2.0/',
$os_region_name = undef,
) {
$volume_name = $name
# TODO: (xarses) This should be moved to a ruby provider so that among other
# reasons, the credential discovery magic can occur like in neutron.
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
]
if $os_region_name {
$region_env = ["OS_REGION_NAME=${os_region_name}"]
}
else {
$region_env = []
}
exec {"cinder type-create ${volume_name}":
command => "cinder type-create ${volume_name}",
unless => "cinder type-list | grep -qP '\\b${volume_name}\\b'",
environment => concat($cinder_env, $region_env),
require => Package['python-cinderclient'],
path => ['/usr/bin', '/bin'],
}
if ($set_value and $set_key) {
Exec["cinder type-create ${volume_name}"] ->
plugin_cinder_netapp::cinder::type_set { $set_value:
type => $volume_name,
key => $set_key,
os_password => $os_password,
os_tenant_name => $os_tenant_name,
os_username => $os_username,
os_auth_url => $os_auth_url,
os_region_name => $os_region_name,
}
}
}

View File

@ -0,0 +1,66 @@
# ==Define: plugin_cinder_netapp::cinder::type_set
#
# #TODO to remove when https://bugs.launchpad.net/fuel/+bug/1461485 will be fix
# Assigns keys after the volume type is set.
#
# === Parameters
#
# [*os_password*]
# (required) The keystone tenant:username password.
#
# [*type*]
# (required) Accepts single name of type to set.
#
# [*key*]
# (required) the key name that we are setting the value for.
#
# [*os_tenant_name*]
# (optional) The keystone tenant name. Defaults to 'admin'.
#
# [*os_username*]
# (optional) The keystone user name. Defaults to 'admin.
#
# [*os_auth_url*]
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'.
#
# [*os_region_name*]
# (optional) The keystone region name. Default is unset.
#
# Author: Andrew Woodward <awoodward@mirantis.com>
define plugin_cinder_netapp::cinder::type_set (
$type,
$key,
$os_password,
$os_tenant_name = 'admin',
$os_username = 'admin',
$os_auth_url = 'http://127.0.0.1:5000/v2.0/',
$os_region_name = undef,
) {
# TODO: (xarses) This should be moved to a ruby provider so that among other
# reasons, the credential discovery magic can occur like in neutron.
$cinder_env = [
"OS_TENANT_NAME=${os_tenant_name}",
"OS_USERNAME=${os_username}",
"OS_PASSWORD=${os_password}",
"OS_AUTH_URL=${os_auth_url}",
]
if $os_region_name {
$region_env = ["OS_REGION_NAME=${os_region_name}"]
}
else {
$region_env = []
}
exec {"cinder type-key ${type} set ${key}=${name}":
path => ['/usr/bin', '/bin'],
command => "cinder type-key ${type} set ${key}=${name}",
unless => "cinder extra-specs-list | grep -Eq '\\b${type}\\b.*\\b${key}\\b.*\\b${name}\\b'",
environment => concat($cinder_env, $region_env),
require => Package['python-cinderclient']
}
}

View File

@ -0,0 +1,29 @@
# This can be used to to install on compute required depedencies to use netapp volume
#
class plugin_cinder_netapp::compute
{
include cinder::params
$cinder_hash = $::fuel_settings['cinder']
case $::osfamily {
'Debian': {
package { 'nfs-common':
}
}
'RedHat': {
package { 'nfs-utils': } ->
service {'rpcbind':
ensure => running,
} ->
service {'rpcidmapd':
ensure => running,
} ->
service {'nfs':
ensure => running,
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat and Debian")
}
}
}

View File

@ -0,0 +1,20 @@
# The plugin_cinder_netapp class is able to inder to use netapp as a storage backend
# (7Mode and cluster mode storage familly). If the multibackend option is checked
# cinder will used the netapp backend and the ceph or lvm (according to intial configuration)
# as multibackend storage
#
class plugin_cinder_netapp::controller
inherits plugin_cinder_netapp::params {
$cinder_hash = $::fuel_settings['cinder']
if $::fuel_settings['cinder_netapp']['multibackend'] {
class { 'plugin_cinder_netapp::multibackend_controller':
cinder_user_password => $cinder_hash[user_password],
auth_host => $::fuel_settings['management_vip']
}
} else {
$section = 'DEFAULT'
plugin_cinder_netapp::backend::netapp{ "cinder_netapp":
section => $section
}
}
}

View File

@ -0,0 +1,14 @@
# this can be used to insert into cinder_iscsi section lvm configuration parameters
#
class plugin_cinder_netapp::multibackend_cinder
inherits plugin_cinder_netapp::params {
include cinder::params
class { $plugin_cinder_netapp::params::backend_class :} ->
plugin_cinder_netapp::backend::netapp{ "cinder_netapp":
backends => $plugin_cinder_netapp::params::backends,
mutlibackends => true,
cinder_node => true
}
}

View File

@ -0,0 +1,54 @@
# this can be used to insert into cinder_iscsi section lvm configuration parameters
# and setup multibaclend configuration conttroller
#
# [$cinder_user_password] password of the cinder user
# [$keystone_tenant] tenant services
# [$keystone_user] name of the cinder user
# [$keystone_auth_protocol] auth protocol for keystone
# [$auth_host] ip/hostname for kauthentication endpoint
# [$keystone_auth_port] nport for keystone
#
# === Examples
#
# class { 'plugin_cinder_netapp::backend::iscsi':
# $cinder_user_password = 'password',
# $keystone_tenant = 'services',
# $keystone_user = 'cinder',
# $keystone_auth_protocol = 'http',
# $auth_host = '127.0.0.1',
# $keystone_auth_port = '35357', ,
# }
#
class plugin_cinder_netapp::multibackend_controller(
$cinder_user_password,
$keystone_tenant = 'services',
$keystone_user = 'cinder',
$keystone_auth_protocol = 'http',
$auth_host,
$keystone_auth_port = '35357',
$os_region_name = 'RegionOne',
)inherits plugin_cinder_netapp::params {
include cinder::params
$os_auth_url = "${keystone_auth_protocol}://${auth_host}:${keystone_auth_port}/v2.0/"
Plugin_cinder_netapp::Cinder::Type {
os_password => $cinder_user_password,
os_tenant_name => $keystone_tenant,
os_username => $keystone_user,
os_auth_url => $os_auth_url,
os_region_name => $os_region_name
}
#TODO use type from cinder module when bug 1461485 is fix
class { $plugin_cinder_netapp::params::backend_class :} ->
plugin_cinder_netapp::backend::netapp{ "cinder_netapp":
backends => $plugin_cinder_netapp::params::backends,
mutlibackends => true
}->
plugin_cinder_netapp::cinder::type {'netapp':
set_key => 'volume_backend_name',
set_value => 'cinder_netapp'
}->
plugin_cinder_netapp::cinder::type {"${plugin_cinder_netapp::params::backends}":
set_key => 'volume_backend_name',
set_value => "${plugin_cinder_netapp::params::backends}",
}
}

View File

@ -0,0 +1,37 @@
class plugin_cinder_netapp::params
{
include cinder::params
$cinder_hash = $::fuel_settings['cinder']
$storage_hash = $::fuel_settings['storage']
case $::osfamily {
'Debian': {
package { 'nfs-common':
before => Cinder::Backend::Netapp['cinder_netapp'],
}
}
'RedHat': {
package { 'nfs-utils': } ->
service {'rpcbind':
ensure => running,
} ->
service {'rpcidmapd':
ensure => running,
} ->
service {'nfs':
ensure => running,
before => Cinder::Backend::Netapp['cinder_netapp'],
}
}
default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat and Debian")
}
}
if ($storage_hash['volumes_lvm']) {
$backends = 'cinder_isci'
$backend_class = 'plugin_cinder_netapp::backend::iscsi'
} elsif ($storage_hash['volumes_ceph']) {
$backends = 'cinder_rbd'
$backend_class = 'plugin_cinder_netapp::backend::rbd'
}
}

View File

@ -2,9 +2,10 @@ attributes:
multibackend:
value: false
label: 'Multibackend enabled'
description: 'NetApp driver will be used as a Cinder Multibackend feature (not implemented)'
description: 'NetApp driver will be used as a Cinder Multibackend feature'
weight: 35
type: "checkbox"
netapp_storage_family:
value: "ontap_cluster"
values:
@ -41,12 +42,55 @@ attributes:
description: 'The hostname (or IP address) for NFS server started on NetApp apliance'
weight: 65
type: "text"
nfs_server_share:
nb_share:
type: "select"
weight: 72
value: "1"
label: "Number of Netapp NFS share"
description: ""
values:
- data: "1"
label: "1"
- data: "2"
label: "2"
- data: "3"
label: "3"
- data: "4"
label: "4"
nfs_server_share1:
value: ''
label: 'NetApp NFS share'
description: 'The NFS share path (e.g. /vol2)'
weight: 75
type: "text"
nfs_server_share2:
value: ''
label: 'NetApp NFS share 2'
description: 'The NFS share path (e.g. /vol2)'
weight: 75
type: "text"
restrictions:
- condition: "settings:cinder_netapp.nb_share.value != '2' and settings:cinder_netapp.nb_share.value != '3' and settings:cinder_netapp.nb_share.value != '4' "
action: "hide"
nfs_server_share3:
value: ''
label: 'NetApp NFS share 3'
description: 'The NFS share path (e.g. /vol2)'
weight: 75
type: "text"
restrictions:
- condition: "settings:cinder_netapp.nb_share.value != '3' and settings:cinder_netapp.nb_share.value != '4' "
action: "hide"
nfs_server_share4:
value: ''
label: 'NetApp NFS share 4'
description: 'The NFS share path (e.g. /vol2)'
weight: 75
type: "text"
restrictions:
- condition: "settings:cinder_netapp.nb_share.value != '4' "
action: "hide"
netapp_transport_type:
value: "http"
values:
@ -155,5 +199,3 @@ attributes:
restrictions:
- condition: "settings:cinder_netapp.netapp_storage_protocol.value != 'iscsi' or settings:cinder_netapp.netapp_storage_family.value != 'ontap_7mode'"
action: "hide"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 128 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 99 KiB

After

Width:  |  Height:  |  Size: 139 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

@ -3,7 +3,7 @@ name: cinder_netapp
# Human-readable name for your plugin
title: Cinder and NetApp integration
# Plugin version
version: 1.1.0
version: 1.2.0
# Description
description: Enable to use NetApp nfs driver as a Cinder backend
# Required fuel version

View File

@ -2,6 +2,20 @@
stage: post_deployment
type: puppet
parameters:
puppet_manifest: site.pp
puppet_modules: "puppet/:/etc/puppet/modules/"
puppet_manifest: puppet/manifests/site_controller.pp
puppet_modules: "puppet/modules/:/etc/puppet/modules/"
timeout: 360
- role: ['compute']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site_compute.pp
puppet_modules: "puppet/modules/:/etc/puppet/modules/"
timeout: 360
- role: ['cinder']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site_cinder.pp
puppet_modules: "puppet/modules/:/etc/puppet/modules/"
timeout: 360