Install the OCF script beforehand

This change also removes the previous hack that cleans up the collector
resources at the end of the deployment.

Change-Id: I1ca237181d30802035bf6a0526cdd41f83e39acd
Closes-Bug: #1593137
This commit is contained in:
Simon Pasquier 2016-07-07 18:39:04 +02:00
parent 20be807caf
commit 882584043f
4 changed files with 28 additions and 54 deletions

View File

@ -101,7 +101,7 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-log_collector',
primitive_type => 'ocf-lma_collector',
complex_type => 'clone',
use_handler => false,
ms_metadata => {
@ -133,7 +133,6 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
'timeout' => '30',
},
},
ocf_script_file => 'lma_collector/ocf-lma_collector',
}
if $is_rabbitmq {
@ -165,7 +164,7 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-metric_collector',
primitive_type => 'ocf-lma_collector',
complex_type => 'clone',
use_handler => false,
ms_metadata => {
@ -196,14 +195,13 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
'timeout' => '30',
},
},
ocf_script_file => 'lma_collector/ocf-lma_collector',
}
} else {
pacemaker::service { 'log_collector':
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-log_collector',
primitive_type => 'ocf-lma_collector',
use_handler => false,
complex_type => 'clone',
complex_metadata => {
@ -235,7 +233,6 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
'timeout' => '30',
},
},
ocf_script_file => 'lma_collector/ocf-lma_collector',
require => Lma_collector::Heka['log_collector'],
}
@ -254,7 +251,7 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
ensure => present,
prefix => false,
primitive_class => 'ocf',
primitive_type => 'ocf-metric_collector',
primitive_type => 'ocf-lma_collector',
use_handler => false,
complex_type => 'clone',
complex_metadata => {
@ -285,7 +282,6 @@ if $is_controller or $is_rabbitmq or $is_mysql_server {
'timeout' => '30',
},
},
ocf_script_file => 'lma_collector/ocf-lma_collector',
require => Lma_collector::Heka['metric_collector'],
}
}

View File

@ -1,28 +0,0 @@
# Copyright 2016 Mirantis, Inc.
#
# 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.
notice('fuel-plugin-lma-collector: cleanup_collector.pp')
Exec {
path => '/usr/sbin:/sbin',
logoutput => on_failure,
}
exec { 'cleanup log_collector':
command => 'crm resource cleanup log_collector'
}
exec { 'cleanup metric collector':
command => 'crm resource cleanup metric_collector'
}

View File

@ -29,3 +29,18 @@ case $::osfamily {
# Currently only Debian like distributions need specific configuration.
}
}
$node_profiles = hiera_hash('lma::collector::node_profiles')
if $node_profiles['controller'] or $node_profiles['rabbitmq'] or $node_profiles['mysql'] {
# The OCF script should exist before any node tries to configure the
# collector services with Pacemaker. This is why it is shipped by this
# manifest.
file { 'ocf-lma_collector':
ensure => present,
source => 'puppet:///modules/lma_collector/ocf-lma_collector',
path => '/usr/lib/ocf/resource.d/fuel/ocf-lma_collector',
mode => '0755',
owner => 'root',
group => 'root',
}
}

View File

@ -19,7 +19,7 @@
# We use upload_nodes_info as an anchor to order the post-deployment tasks executed
# by this plugin and the InfluxDB & Elasticsearch plugins. The dependency chain is:
# Other plugins tasks -> upload_nodes_info -> (LMA collector tasks)
requires: [post_deployment_start, upload_nodes_info]
requires: [post_deployment_start, upload_nodes_info, lma-hiera-override]
required_for: [post_deployment_end]
role: '*'
parameters:
@ -32,9 +32,16 @@
- id: lma-base
type: puppet
version: 2.0.0
requires: [lma-hiera-override, lma-configure-apt]
requires: [lma-configure-apt]
required_for: [post_deployment_end]
role: '*'
# lma-configure-apt ships the OCF script so the task should wait for the
# script to be available on all the necessary nodes otherwise Pacemaker may
# fail to start the resource and keep it in failed state forever.
# See https://bugs.launchpad.net/lma-toolchain/+bug/1593137 for details
cross-depends:
- name: lma-configure-apt
role: /.*/
parameters:
puppet_manifest: puppet/manifests/base.pp
puppet_modules: puppet/modules:/etc/puppet/modules
@ -162,19 +169,3 @@
timeout: 600
reexecute_on:
- deploy_changes
# This task must be executed at the very end of the deployment.
- id: lma-cleanup-collectors
type: puppet
version: 2.0.0
requires: [lma-base]
required_for: [post_deployment_end]
role:
- primary-controller
cross-depends:
- name: lma-base
role: [primary-controller, controller]
parameters:
puppet_manifest: puppet/manifests/cleanup_collectors.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 300