Browse Source

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>
Bogdan Dobrelya 3 years ago
parent
commit
231addb8bf

+ 1
- 0
.gitignore View File

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

+ 12
- 3
README.md View File

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

+ 34
- 0
deployment_scripts/ha_fencing_deploy.pp View File

@@ -0,0 +1,34 @@
1
+notice('MODULAR: ha_fencing/ha_fencing_deploy.pp')
2
+
3
+$role = hiera('role', '')
4
+$primary_controller = $role ? {
5
+  'primary-controller'=>true, default=>false }
6
+$is_controller      = $role ? {
7
+  'controller'=>true, default=>false }
8
+
9
+if ($is_controller or $primary_controller) {
10
+  include stdlib
11
+  # Fetch fencing policy and settings
12
+  $ha_fencing_hash = hiera_hash('ha_fencing', {})
13
+  $fence_policy = $ha_fencing_hash['fence_policy']
14
+  $fencing_enabled  = $fence_policy ? {
15
+    'disabled'=>false, 'reboot'=>true,
16
+    'poweroff'=>true, default=>false }
17
+
18
+  if $fencing_enabled {
19
+    $fence_primitives = hiera_hash('fence_primitives', {})
20
+    $fence_topology   = hiera_hash('fence_topology', {})
21
+
22
+    $nodes = hiera('nodes', {})
23
+    $controllers = concat(
24
+      filter_nodes($nodes,'role','primary-controller'),
25
+      filter_nodes($nodes,'role','controller'))
26
+
27
+    class { '::pcs_fencing::fencing_primitives':
28
+      fence_primitives   => $fence_primitives,
29
+      fence_topology     => $fence_topology,
30
+      nodes              => $controllers,
31
+      primary_controller => $primary_controller,
32
+    }
33
+  }
34
+}

+ 29
- 0
deployment_scripts/ha_fencing_hiera_override.pp View File

@@ -0,0 +1,29 @@
1
+notice('MODULAR: ha_fencing/ha_fencing_hiera_override.pp')
2
+
3
+$ha_fencing_hash = hiera('ha_fencing', undef)
4
+$hiera_dir = '/etc/hiera/override'
5
+$plugin_name = 'ha_fencing'
6
+$plugin_yaml = "${plugin_name}.yaml"
7
+
8
+if $ha_fencing_hash {
9
+  $yaml_additional_config = pick(
10
+    $ha_fencing_hash['yaml_additional_config'], {})
11
+
12
+  file {'/etc/hiera/override':
13
+    ensure  => directory,
14
+  } ->
15
+  file { "${hiera_dir}/${plugin_yaml}":
16
+    ensure  => file,
17
+    source => $yaml_additional_config,
18
+  }
19
+
20
+  package {'ruby-deep-merge':
21
+    ensure  => 'installed',
22
+  }
23
+
24
+  file_line {"${plugin_name}_hiera_override":
25
+    path  => '/etc/hiera.yaml',
26
+    line  => "  - override/${plugin_name}",
27
+    after => '  - override/module/%{calling_module}',
28
+  }
29
+}

+ 0
- 27
deployment_scripts/puppet/manifests/site.pp View File

@@ -1,27 +0,0 @@
1
-$fuel_settings = parseyaml($astute_settings_yaml)
2
-
3
-$primary_controller = $::fuel_settings['role'] ? { 'primary-controller'=>true, default=>false }
4
-$is_controller      = $::fuel_settings['role'] ? { 'controller'=>true, default=>false }
5
-
6
-if ($is_controller or $primary_controller) {
7
-  # Fetch fencing policy and settings
8
-  $fence_policy = $::fuel_settings['ha_fencing']['fence_policy']
9
-  $fencing_enabled  = $fence_policy ? { 'disabled'=>false, 'reboot'=>true, 'poweroff'=>true, default=>false }
10
-
11
-  if $fencing_enabled {
12
-    $fencing_settings = parseyaml($fencing_settings_yaml)
13
-    $fence_primitives = $::fencing_settings['fence_primitives']
14
-    $fence_topology   = $::fencing_settings['fence_topology']
15
-
16
-    $nodes_hash = $::fuel_settings['nodes']
17
-    $controllers = concat(filter_nodes($nodes_hash,'role','primary-controller'), filter_nodes($nodes_hash,'role','controller'))
18
-
19
-    include stdlib
20
-    class { '::pcs_fencing::fencing_primitives':
21
-      fence_primitives   => $fence_primitives,
22
-      fence_topology     => $fence_topology,
23
-      nodes              => $controllers,
24
-      primary_controller => $primary_controller,
25
-    }
26
-  }
27
-}

+ 11
- 2
deployment_scripts/puppet/modules/pcs_fencing/manifests/fencing_primitives.pp View File

@@ -40,9 +40,11 @@ class pcs_fencing::fencing_primitives (
40 40
   case $::osfamily {
41 41
     'RedHat': {
42 42
       $names = filter_hash($nodes, 'fqdn')
43
+      $prov  = 'pcs'
43 44
     }
44 45
     'Debian': {
45 46
       $names = filter_hash($nodes, 'name')
47
+      $prov  = 'crm'
46 48
     }
47 49
     default: {
48 50
       fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} only support osfamily RedHat and Debian")
@@ -56,12 +58,19 @@ class pcs_fencing::fencing_primitives (
56 58
 
57 59
   if $primary_controller {
58 60
     cs_fencetopo { 'fencing_topology':
61
+      #TODO(bogdando) make crm/pcs providers
59 62
       ensure         => present,
60 63
       fence_topology => $fence_topology,
61 64
       nodes          => $names,
62 65
     }
63
-    cs_property { 'stonith-enabled': value  => 'true' }
64
-    cs_property { 'cluster-recheck-interval':  value  => '3min' }
66
+    cs_property { 'stonith-enabled':
67
+      value    => 'true',
68
+      provider => $prov,
69
+    }
70
+    cs_property { 'cluster-recheck-interval':
71
+      value    => '3min',
72
+      provider => $prov,
73
+    }
65 74
   }
66 75
 
67 76
   package {'fence-agents':}

+ 6
- 0
environment_config.yaml View File

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

+ 26
- 8
metadata.yaml View File

@@ -2,33 +2,51 @@
2 2
 name: ha_fencing
3 3
 title: HA fencing for Pacemaker cluster
4 4
 # Plugin version
5
-version: 6.0.1
5
+version: 8.0.0
6 6
 # Description
7 7
 description: Enables STONITH of the failed nodes in Corosync & Pacemaker cluster
8 8
 # Required fuel version
9
-fuel_version: ['6.0', '6.0.1']
10
-
9
+fuel_version: ['6.1', '7.0', '8.0']
10
+# Specify license of your plugin
11
+licenses: ['Apache License Version 2.0']
12
+# Specify author or company name
13
+authors: ['Bogdan Dobrelya','Mirantis']
14
+# A link to the plugin's page
15
+homepage: 'https://github.com/openstack/fuel-plugin-ha-fencing'
16
+# Specify a group which your plugin implements, possible options:
17
+# network, storage, storage::cinder, storage::glance, hypervisor
18
+groups: [network]
11 19
 # The plugin is compatible with releases in the list
12 20
 releases:
13 21
   - os: ubuntu
14
-    version: 2014.2-6.0
22
+    version: 2014.2.2-6.1
15 23
     mode: ['ha']
16 24
     deployment_scripts_path: deployment_scripts/
17 25
     repository_path: repositories/ubuntu
18 26
   - os: centos
19
-    version: 2014.2-6.0
27
+    version: 2014.2.2-6.1
20 28
     mode: ['ha']
21 29
     deployment_scripts_path: deployment_scripts/
22 30
     repository_path: repositories/centos
23 31
   - os: ubuntu
24
-    version: 2014.2.2-6.0.1
32
+    version: 2015.1.0-7.0
25 33
     mode: ['ha']
26 34
     deployment_scripts_path: deployment_scripts/
27 35
     repository_path: repositories/ubuntu
28 36
   - os: centos
29
-    version: 2014.2.2-6.0.1
37
+    version: 2015.1.0-7.0
38
+    mode: ['ha']
39
+    deployment_scripts_path: deployment_scripts/
40
+    repository_path: repositories/centos
41
+  - os: ubuntu
42
+    version: 2015.1.0-8.0
43
+    mode: ['ha']
44
+    deployment_scripts_path: deployment_scripts/
45
+    repository_path: repositories/ubuntu
46
+  - os: centos
47
+    version: 2015.1.0-8.0
30 48
     mode: ['ha']
31 49
     deployment_scripts_path: deployment_scripts/
32 50
     repository_path: repositories/centos
33 51
 # Version of plugin package
34
-package_version: '1.0.0'
52
+package_version: '2.0.0'

+ 19
- 5
tasks.yaml View File

@@ -1,8 +1,22 @@
1
-# Deployment is required for controllers
2
-- role: ['controller']
1
+# Deployment tasks
2
+- id: ha-fencing-hiera-override
3
+  role: ['primary-controller', 'controller']
3 4
   stage: post_deployment
5
+  requires: [post_deployment_start]
6
+  required_for: [post_deployment_end]
4 7
   type: puppet
5 8
   parameters:
6
-    puppet_manifest: puppet/manifests/site.pp
7
-    puppet_modules: puppet/modules
8
-    timeout: 720
9
+    puppet_manifest: "ha_fencing_hiera_override.pp"
10
+    puppet_modules: "puppet/modules"
11
+    timeout: 120
12
+
13
+- id: ha-fencing-deploy
14
+  role: ['primary-controller', 'controller']
15
+  stage: post_deployment
16
+  requires: [post_deployment_start, ha-fencing-hiera-override]
17
+  required_for: [post_deployment_end]
18
+  type: puppet
19
+  parameters:
20
+    puppet_manifest: "ha_fencing_deploy.pp"
21
+    puppet_modules: "puppet/modules"
22
+    timeout: 600

Loading…
Cancel
Save