Add MOS 8.0 support

Change-Id: Ic70ad0a99c41860502e15fe8671e6ca3f11e9f58
This commit is contained in:
Andrey Volochay 2016-03-17 18:38:33 +03:00
parent e29fccef3e
commit 0c8280b2a5
22 changed files with 152 additions and 455 deletions

6
components.yaml Normal file
View File

@ -0,0 +1,6 @@
- name: 'storage:block:backend:netapp'
label: 'Cinder NetApp'
description: 'Cinder with NetApp backend'
compatible:
- name: 'storage:block:backend:ceph'
- name: 'storage:block:backend:lvm'

View File

@ -0,0 +1,4 @@
notice('MODULAR: fuel-plugin-cinder-netapp')
class { '::plugin_cinder_netapp': }

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ class plugin_cinder_netapp::backend::iscsi (
$volume_group = 'cinder',
$iscsi_ip_address = $::internal_address,
$iscsi_helper = $::cinder::params::iscsi_helper,
) {
) inherits cinder::params {
cinder_config {
'cinder_iscsi/volume_backend_name': value => 'cinder_iscsi';

View File

@ -1,65 +1,57 @@
# this can be used to create a netapp volume backend for cinder
#
# [section] name of the section of cinder.conf on which netapp parameters should be inserted
# [backends] name of the other backends in a multibackend config (optional)
#
# === Examples
#
# plugin_cinder_netapp::backend::netapp{ 'netapp':
# backends => Lvm1,
# }
#
define plugin_cinder_netapp::backend::netapp (
$section = $name,
$backends = '',
$backend_name = 'cinder_netapp',
$mutlibackends = false,
$cinder_node = false,
$netapp_backend_name = $name,
$cinder_netapp = $plugin_cinder_netapp::params::cinder_netapp,
$default_backend = undef,
) {
include plugin_cinder_netapp::params
include cinder::client
# Ensure that $ symbole is correctly escaped in netapp password
$netapp_password = regsubst($::fuel_settings['cinder_netapp']['netapp_password'],'\$','$$','G')
$netapp_password = regsubst($cinder_netapp['netapp_password'],'\$','$$','G')
cinder::backend::netapp { $backend_name:
volume_backend_name => $section,
netapp_login => $::fuel_settings['cinder_netapp']['netapp_login'],
cinder::backend::netapp { "$netapp_backend_name":
volume_backend_name => 'cinder_netapp',
netapp_login => $cinder_netapp['netapp_login'],
netapp_password => $netapp_password,
netapp_server_hostname => $::fuel_settings['cinder_netapp']['netapp_server_hostname'],
netapp_server_port => $::fuel_settings['cinder_netapp']['netapp_server_port'],
netapp_transport_type => $::fuel_settings['cinder_netapp']['netapp_transport_type'],
netapp_storage_family => $::fuel_settings['cinder_netapp']['netapp_storage_family'],
netapp_storage_protocol => $::fuel_settings['cinder_netapp']['netapp_storage_protocol'],
netapp_vserver => $::fuel_settings['cinder_netapp']['netapp_vserver'],
netapp_controller_ips => $::fuel_settings['cinder_netapp']['netapp_controller_ips'],
netapp_sa_password => $::fuel_settings['cinder_netapp']['netapp_sa_password'],
netapp_storage_pools => $::fuel_settings['cinder_netapp']['netapp_storage_pools'],
netapp_size_multiplier => $::fuel_settings['cinder_netapp']['netapp_size_multiplier'],
netapp_vfiler => $::fuel_settings['cinder_netapp']['netapp_vfiler'],
netapp_volume_list => $::fuel_settings['cinder_netapp']['netapp_volume_list'],
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'],
netapp_copyoffload_tool_path => $::fuel_settings['cinder_netapp']['netapp_copyoffload_tool_path'],
nfs_mount_options => $::fuel_settings['cinder_netapp']['nfs_mount_options'],
netapp_server_hostname => $cinder_netapp['netapp_server_hostname'],
netapp_server_port => $cinder_netapp['netapp_server_port'],
netapp_transport_type => $cinder_netapp['netapp_transport_type'],
netapp_storage_family => $cinder_netapp['netapp_storage_family'],
netapp_storage_protocol => $cinder_netapp['netapp_storage_protocol'],
netapp_vserver => $cinder_netapp['netapp_vserver'],
netapp_controller_ips => $cinder_netapp['netapp_controller_ips'],
netapp_sa_password => $cinder_netapp['netapp_sa_password'],
netapp_storage_pools => $cinder_netapp['netapp_storage_pools'],
netapp_size_multiplier => $cinder_netapp['netapp_size_multiplier'],
netapp_vfiler => $cinder_netapp['netapp_vfiler'],
netapp_volume_list => $cinder_netapp['netapp_volume_list'],
expiry_thres_minutes => $cinder_netapp['expiry_thres_minutes'],
thres_avl_size_perc_start => $cinder_netapp['thres_avl_size_perc_start'],
thres_avl_size_perc_stop => $cinder_netapp['thres_avl_size_perc_stop'],
netapp_copyoffload_tool_path => $cinder_netapp['netapp_copyoffload_tool_path'],
nfs_mount_options => $cinder_netapp['nfs_mount_options'],
}
$index = $::fuel_settings['cinder_netapp']['nb_share']
cinder_config {
'DEFAULT/host': value => 'str:netapp';
}
if $mutlibackends {
if ($cinder_netapp['mutlibackend']) {
cinder_config {
'DEFAULT/enabled_backends': value => "${backends},${backend_name}";
}
} else {
cinder_config {
'DEFAULT/enabled_backends': value => "${backend_name}";
'DEFAULT/enabled_backends': value => "${default_backend},${netapp_backend_name}";
}
}
if $cinder_node {
plugin_cinder_netapp::backend::share{ "share-${index}":
index => $index
if ($cinder_netapp['netapp_storage_protocol']) == 'nfs' {
package { 'nfs-common':
before => Cinder::Backend::Netapp[$netapp_backend_name],
}
$index = $cinder_netapp['nb_share']
plugin_cinder_netapp::backend::share { "share-$index":
index => $index,
cinder_netapp => $cinder_netapp,
}
}

View File

@ -1,21 +1,11 @@
# this can be used to create recursively in shares for netapp volume backend
# [index] index of the current share
# [shares] shares previously created of the following 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 = '',
$shares = undef,
$cinder_netapp,
) {
$ip = $::fuel_settings['cinder_netapp']['nfs_server_ip']
$share = $::fuel_settings['cinder_netapp']["nfs_server_share${index}"]
$ip = $cinder_netapp['nfs_server_ip']
$share = $cinder_netapp["nfs_server_share${index}"]
$minus1 = inline_template('<%= index.to_i - 1 %>')
if ($minus1 == '0') {
@ -27,8 +17,9 @@ define plugin_cinder_netapp::backend::share (
} else {
# recurse until index 1 is reached
plugin_cinder_netapp::backend::share { "share-${minus1}":
index => $minus1,
shares => "${ip}:${share}\n${shares}",
index => $minus1,
shares => "${ip}:${share}\n${shares}",
cinder_netapp => $cinder_netapp,
}
}
}

View File

@ -1,22 +0,0 @@
# 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 (
$cinder_hash = $::fuel_settings['cinder'],
) {
include plugin_cinder_netapp::params
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

@ -1,82 +0,0 @@
# ==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,
$volume_name = $name,
$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,
) {
# 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

@ -1,67 +0,0 @@
# ==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

@ -1,37 +0,0 @@
# This can be used 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")
}
}
if $::fuel_settings['cinder_netapp']['nfs_mount_options'] {
nova_config {
'DEFAULT/nfs_mount_options': value => $::fuel_settings['cinder_netapp']['nfs_mount_options'];
}
}
}

View File

@ -1,28 +0,0 @@
# The plugin_cinder_netapp class is able to cinder 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 {
include plugin_cinder_netapp::params
cinder_config {
'DEFAULT/host': value => 'str:netapp';
}
$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 => hiera('management_vip', undef),
}
} else {
$section = 'DEFAULT'
plugin_cinder_netapp::backend::netapp{ 'cinder_netapp':
section => $section,
}
}
}

View File

@ -0,0 +1,36 @@
define plugin_cinder_netapp::hiera_override (
$volume_backend_name = $name,
$backend = undef,
) {
$hiera_dir = '/etc/hiera/override'
$plugin_yaml = 'cinder_netapp.yaml'
$plugin_name = 'cinder_netapp'
$backend_name = regsubst($backend, 'cinder_', '', 'G')
$content = inline_template('
storage_hash:
volume_backend_names:
<%= @volume_backend_name %>: false
netapp: cinder_netapp
<% if @backend -%>
<%= @backend_name %>: <%= @backend %>
<% end -%>
')
file { "$hiera_dir":
ensure => directory,
}
file { "${hiera_dir}/${plugin_yaml}":
ensure => file,
content => $content,
require => File[$hiera_dir],
}
file_line {"${plugin_name}_hiera_override":
path => '/etc/hiera.yaml',
line => " - override/${plugin_name}",
after => ' - "override/module/%{calling_module}"',
}
}

View File

@ -0,0 +1,15 @@
class plugin_cinder_netapp (
$cinder_netapp = $plugin_cinder_netapp::params::cinder_netapp,
$volume_backend_name = $plugin_cinder_netapp::params::volume_backend_name,
) inherits plugin_cinder_netapp::params {
if ($cinder_netapp['multibackend']) {
class { 'plugin_cinder_netapp::multibackend': }
} else {
plugin_cinder_netapp::hiera_override { "$volume_backend_name":
} ->
plugin_cinder_netapp::backend::netapp { 'DEFAULT': }
}
}

View File

@ -0,0 +1,14 @@
class plugin_cinder_netapp::multibackend (
$volume_backend_name = $plugin_cinder_netapp::params::volume_backend_name,
$default_backend = $plugin_cinder_netapp::params::default_backend,
$backend_class = $plugin_cinder_netapp::params::backend_class,
) inherits plugin_cinder_netapp::params {
plugin_cinder_netapp::hiera_override { "$volume_backend_name":
backend => $default_backend,
} ->
class { "$backend_class": } ->
plugin_cinder_netapp::backend::netapp { 'cinder_netapp':
default_backend => $default_backend,
}
}

View File

@ -1,16 +0,0 @@
# this can be used to insert into cinder_iscsi section lvm configuration parameters
#
class plugin_cinder_netapp::multibackend_cinder {
include 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

@ -1,59 +0,0 @@
# this can be used to insert into cinder_iscsi section lvm configuration parameters
# and setup multibackend configuration controller
#
# [$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 authentication endpoint
# [$keystone_auth_port] port 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,
$auth_host,
$keystone_tenant = 'services',
$keystone_user = 'cinder',
$keystone_auth_protocol = 'http',
$keystone_auth_port = '35357',
$os_region_name = 'RegionOne',
$os_auth_url = "${keystone_auth_protocol}://${auth_host}:${keystone_auth_port}/v2.0/",
) {
include plugin_cinder_netapp::params
include cinder::params
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

@ -1,38 +1,16 @@
class plugin_cinder_netapp::params {
class plugin_cinder_netapp::params (
) {
include cinder::params
$cinder_netapp = hiera_hash('cinder_netapp', {})
$storage_hash = hiera_hash('storage_hash', {})
$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_iscsi'
$backend_class = 'plugin_cinder_netapp::backend::iscsi'
} elsif ($storage_hash['volumes_ceph']) {
$backends = 'cinder_rbd'
$backend_class = 'plugin_cinder_netapp::backend::rbd'
if ($storage_hash['volume_backend_names']['volumes_lvm']) {
$default_backend = 'cinder_iscsi'
$volume_backend_name = 'volumes_lvm'
$backend_class = 'plugin_cinder_netapp::backend::iscsi'
} elsif ($storage_hash['volume_backend_names']['volumes_ceph']) {
$default_backend = 'cinder_rbd'
$volume_backend_name = 'volumes_ceph'
$backend_class = 'plugin_cinder_netapp::backend::rbd'
}
}

View File

@ -1,30 +1,10 @@
# Deployment tasks
- id: controller-netapp
- id: cinder_netapp
type: puppet
role: [primary-controller, controller]
required_for: [post_deployment_end]
requires: [post_deployment_start]
version: 2.0.0
groups: [primary-controller, controller]
requires: [openstack-cinder, deploy_start]
required_for: [create-cinder-types, deploy_end]
parameters:
puppet_manifest: puppet/manifests/site_controller.pp
puppet_modules: "puppet/modules/:/etc/puppet/modules/"
timeout: 360
- id: compute-netapp
type: puppet
role: [compute]
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/site_compute.pp
puppet_modules: "puppet/modules/:/etc/puppet/modules/"
timeout: 360
- id: cinder-netapp
type: puppet
role: [cinder]
required_for: [post_deployment_end]
requires: [post_deployment_start]
parameters:
puppet_manifest: puppet/manifests/site_cinder.pp
puppet_modules: "puppet/modules/:/etc/puppet/modules/"
puppet_manifest: puppet/manifests/site.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 360

View File

@ -1,4 +1,6 @@
attributes:
metadata:
group: 'storage'
multibackend:
value: false
label: 'Multibackend enabled'

View File

@ -3,30 +3,26 @@ name: cinder_netapp
# Human-readable name for your plugin
title: Cinder and NetApp integration
# Plugin version
version: 3.2.1
version: '4.0.0'
# Description
description: Enable to use NetApp nfs driver as a Cinder backend
description: Enables using NetApp as a Cinder backend
# Required fuel version
fuel_version: ['7.0']
fuel_version: ['8.0']
authors: ['Mirantis Inc','Orange']
authors: ['Mirantis','Orange']
licenses: ['Apache License Version 2.0']
homepage: 'https://github.com/openstack/fuel-plugin-cinder-netapp'
groups: ['storage::cinder']
groups: ['storage::cinder']
is_hotpluggable: false
# The plugin is compatible with releases in the list
releases:
- os: ubuntu
version: 2015.1.0-7.0
mode: ['ha', 'multinode']
version: liberty-8.0
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: centos
version: 2015.1.0-7.0
mode: ['ha', 'multinode']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
# Version of plugin package
package_version: '3.0.0'
package_version: '4.0.0'