Support for Fuel 6.1-8.0

* Rework plugin deployment tasks
  to fetch data from hiera
* Make YAML file path with fencing settings
  customizable in UI
* Instead of deployment_tasks.yaml,
  use tasks.yaml, otherwise there is
  no tasks added for the plugin in nailgun
  for some strange reason

Change-Id: I959ec9f7104629dbf6329d552a670ad4f33ddc7f
Signed-off-by: Bogdan Dobrelya <bdobrelia@mirantis.com>
This commit is contained in:
Bogdan Dobrelya 2015-11-05 13:35:05 +01:00
parent 7ce61a71bb
commit 231addb8bf
9 changed files with 138 additions and 45 deletions

1
.gitignore vendored
View File

@ -4,6 +4,7 @@ deployment_scripts/puppet/modules/pacemaker
deployment_scripts/puppet/modules/stdlib deployment_scripts/puppet/modules/stdlib
.build .build
tmp tmp
*.rpm
*.fp *.fp
# Editors # Editors

View File

@ -47,7 +47,7 @@ Setup
### Installing Fencing plugin ### Installing Fencing plugin
Please refer to the [plugins dev guide](http://docs.mirantis.com/fuel/fuel-6.0/plugin-dev.html#what-is-pluggable-architecture) Please refer to the [plugins dev guide](http://docs.mirantis.com/fuel/fuel-6.1/plugin-dev.html#what-is-pluggable-architecture)
Note that in order to build this plugin the following tools must present: Note that in order to build this plugin the following tools must present:
* rsync * rsync
* wget * wget
@ -125,7 +125,7 @@ Note that in order to build this plugin the following tools must present:
parameters should be specified as FQDN names in case of RedHat OS family and as a parameters should be specified as FQDN names in case of RedHat OS family and as a
short names in case of Debian OS family. That is related to the node naming rules in short names in case of Debian OS family. That is related to the node naming rules in
Pacemaker cluster in different OS types. Pacemaker cluster in different OS types.
* Put created fencing configuration YAML files as ``/etc/pcs_fencing.yaml`` * Put created fencing configuration YAML files as ``/etc/pcs_fencing.yaml``
for corresponding controller nodes. for corresponding controller nodes.
@ -199,6 +199,7 @@ versioning for plugin releases are as follows:
Plugin :: Fuel version Plugin :: Fuel version
6.0.0 -> 6.0 6.0.0 -> 6.0
6.0.1 -> 6.0.1 6.0.1 -> 6.0.1
8.0.0 -> 6.1, 7.0, 8.0
``` ```
Known Issues Known Issues
@ -259,13 +260,21 @@ corosync service. And if corosync service hangs on stop and have to be killed an
restarted - make it fast, otherwise another STONITH action triggered by dead corosync restarted - make it fast, otherwise another STONITH action triggered by dead corosync
process would arrive. process would arrive.
Note, this issue should not be relevant since the Fuel 6.1 release containing
the pacemaker 1.1.12
Release Notes Release Notes
------------- -------------
*** 6.0.0 *** *** 6.0.0 ***
* This is the initial release of this plugin. * This is the initial release of this plugin.
*** 6.0.1 *** *** 6.0.1 ***
* Add support of the Fuel 6.0.1 * Add support of the Fuel 6.0.1
*** 8.0.0 ***
* Add support of the Fuel 6.1, 7.0, 8.0
* Use rpm for the plugin package distribution

View File

@ -0,0 +1,34 @@
notice('MODULAR: ha_fencing/ha_fencing_deploy.pp')
$role = hiera('role', '')
$primary_controller = $role ? {
'primary-controller'=>true, default=>false }
$is_controller = $role ? {
'controller'=>true, default=>false }
if ($is_controller or $primary_controller) {
include stdlib
# Fetch fencing policy and settings
$ha_fencing_hash = hiera_hash('ha_fencing', {})
$fence_policy = $ha_fencing_hash['fence_policy']
$fencing_enabled = $fence_policy ? {
'disabled'=>false, 'reboot'=>true,
'poweroff'=>true, default=>false }
if $fencing_enabled {
$fence_primitives = hiera_hash('fence_primitives', {})
$fence_topology = hiera_hash('fence_topology', {})
$nodes = hiera('nodes', {})
$controllers = concat(
filter_nodes($nodes,'role','primary-controller'),
filter_nodes($nodes,'role','controller'))
class { '::pcs_fencing::fencing_primitives':
fence_primitives => $fence_primitives,
fence_topology => $fence_topology,
nodes => $controllers,
primary_controller => $primary_controller,
}
}
}

View File

@ -0,0 +1,29 @@
notice('MODULAR: ha_fencing/ha_fencing_hiera_override.pp')
$ha_fencing_hash = hiera('ha_fencing', undef)
$hiera_dir = '/etc/hiera/override'
$plugin_name = 'ha_fencing'
$plugin_yaml = "${plugin_name}.yaml"
if $ha_fencing_hash {
$yaml_additional_config = pick(
$ha_fencing_hash['yaml_additional_config'], {})
file {'/etc/hiera/override':
ensure => directory,
} ->
file { "${hiera_dir}/${plugin_yaml}":
ensure => file,
source => $yaml_additional_config,
}
package {'ruby-deep-merge':
ensure => 'installed',
}
file_line {"${plugin_name}_hiera_override":
path => '/etc/hiera.yaml',
line => " - override/${plugin_name}",
after => ' - override/module/%{calling_module}',
}
}

View File

@ -1,27 +0,0 @@
$fuel_settings = parseyaml($astute_settings_yaml)
$primary_controller = $::fuel_settings['role'] ? { 'primary-controller'=>true, default=>false }
$is_controller = $::fuel_settings['role'] ? { 'controller'=>true, default=>false }
if ($is_controller or $primary_controller) {
# Fetch fencing policy and settings
$fence_policy = $::fuel_settings['ha_fencing']['fence_policy']
$fencing_enabled = $fence_policy ? { 'disabled'=>false, 'reboot'=>true, 'poweroff'=>true, default=>false }
if $fencing_enabled {
$fencing_settings = parseyaml($fencing_settings_yaml)
$fence_primitives = $::fencing_settings['fence_primitives']
$fence_topology = $::fencing_settings['fence_topology']
$nodes_hash = $::fuel_settings['nodes']
$controllers = concat(filter_nodes($nodes_hash,'role','primary-controller'), filter_nodes($nodes_hash,'role','controller'))
include stdlib
class { '::pcs_fencing::fencing_primitives':
fence_primitives => $fence_primitives,
fence_topology => $fence_topology,
nodes => $controllers,
primary_controller => $primary_controller,
}
}
}

View File

@ -40,9 +40,11 @@ class pcs_fencing::fencing_primitives (
case $::osfamily { case $::osfamily {
'RedHat': { 'RedHat': {
$names = filter_hash($nodes, 'fqdn') $names = filter_hash($nodes, 'fqdn')
$prov = 'pcs'
} }
'Debian': { 'Debian': {
$names = filter_hash($nodes, 'name') $names = filter_hash($nodes, 'name')
$prov = 'crm'
} }
default: { default: {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian") fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
@ -56,12 +58,19 @@ class pcs_fencing::fencing_primitives (
if $primary_controller { if $primary_controller {
cs_fencetopo { 'fencing_topology': cs_fencetopo { 'fencing_topology':
#TODO(bogdando) make crm/pcs providers
ensure => present, ensure => present,
fence_topology => $fence_topology, fence_topology => $fence_topology,
nodes => $names, nodes => $names,
} }
cs_property { 'stonith-enabled': value => 'true' } cs_property { 'stonith-enabled':
cs_property { 'cluster-recheck-interval': value => '3min' } value => 'true',
provider => $prov,
}
cs_property { 'cluster-recheck-interval':
value => '3min',
provider => $prov,
}
} }
package {'fence-agents':} package {'fence-agents':}

View File

@ -5,3 +5,9 @@ attributes:
description: 'Pick a type of HA fencing policy' description: 'Pick a type of HA fencing policy'
weight: 25 weight: 25
type: "text" type: "text"
yaml_additional_config:
value: '/etc/pcs_fencing.yaml'
label: 'Yaml settings file for fencing configuration'
description: 'Pick a Yaml file for fencing config'
weight: 25
type: "text"

View File

@ -2,33 +2,51 @@
name: ha_fencing name: ha_fencing
title: HA fencing for Pacemaker cluster title: HA fencing for Pacemaker cluster
# Plugin version # Plugin version
version: 6.0.1 version: 8.0.0
# Description # Description
description: Enables STONITH of the failed nodes in Corosync & Pacemaker cluster description: Enables STONITH of the failed nodes in Corosync & Pacemaker cluster
# Required fuel version # Required fuel version
fuel_version: ['6.0', '6.0.1'] fuel_version: ['6.1', '7.0', '8.0']
# Specify license of your plugin
licenses: ['Apache License Version 2.0']
# Specify author or company name
authors: ['Bogdan Dobrelya','Mirantis']
# A link to the plugin's page
homepage: 'https://github.com/openstack/fuel-plugin-ha-fencing'
# Specify a group which your plugin implements, possible options:
# network, storage, storage::cinder, storage::glance, hypervisor
groups: [network]
# The plugin is compatible with releases in the list # The plugin is compatible with releases in the list
releases: releases:
- os: ubuntu - os: ubuntu
version: 2014.2-6.0 version: 2014.2.2-6.1
mode: ['ha'] mode: ['ha']
deployment_scripts_path: deployment_scripts/ deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu repository_path: repositories/ubuntu
- os: centos - os: centos
version: 2014.2-6.0 version: 2014.2.2-6.1
mode: ['ha'] mode: ['ha']
deployment_scripts_path: deployment_scripts/ deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos repository_path: repositories/centos
- os: ubuntu - os: ubuntu
version: 2014.2.2-6.0.1 version: 2015.1.0-7.0
mode: ['ha'] mode: ['ha']
deployment_scripts_path: deployment_scripts/ deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu repository_path: repositories/ubuntu
- os: centos - os: centos
version: 2014.2.2-6.0.1 version: 2015.1.0-7.0
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
- os: ubuntu
version: 2015.1.0-8.0
mode: ['ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: centos
version: 2015.1.0-8.0
mode: ['ha'] mode: ['ha']
deployment_scripts_path: deployment_scripts/ deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos repository_path: repositories/centos
# Version of plugin package # Version of plugin package
package_version: '1.0.0' package_version: '2.0.0'

View File

@ -1,8 +1,22 @@
# Deployment is required for controllers # Deployment tasks
- role: ['controller'] - id: ha-fencing-hiera-override
role: ['primary-controller', 'controller']
stage: post_deployment stage: post_deployment
requires: [post_deployment_start]
required_for: [post_deployment_end]
type: puppet type: puppet
parameters: parameters:
puppet_manifest: puppet/manifests/site.pp puppet_manifest: "ha_fencing_hiera_override.pp"
puppet_modules: puppet/modules puppet_modules: "puppet/modules"
timeout: 720 timeout: 120
- id: ha-fencing-deploy
role: ['primary-controller', 'controller']
stage: post_deployment
requires: [post_deployment_start, ha-fencing-hiera-override]
required_for: [post_deployment_end]
type: puppet
parameters:
puppet_manifest: "ha_fencing_deploy.pp"
puppet_modules: "puppet/modules"
timeout: 600