Cleanup code.
This commit is contained in:
parent
cddb6bca38
commit
ac7f286d77
@ -5,30 +5,12 @@
|
||||
# Starts crm_mon in background which logs cluster status as
|
||||
# html to the specified file.
|
||||
#
|
||||
# Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Brée
|
||||
# All Rights Reserved.
|
||||
# Copyright 2014 Canonical Ltd.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Further, this software is distributed without any warranty that it is
|
||||
# free of the rightful claim of any third person regarding infringement
|
||||
# or the like. Any license provided herein, whether implied or
|
||||
# otherwise, applies only to this software file. Patent licenses, if
|
||||
# any, provided herein do not apply to combinations of this program with
|
||||
# other software, or any other product whatsoever.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
# Authors: Hui Xiang <hui.xiang@canonical.com>
|
||||
#
|
||||
# OCF instance parameters:
|
||||
# OCF_RESKEY_user
|
||||
# OCF_RESKEY_file
|
||||
|
||||
#######################################################################
|
||||
# Initialization:
|
||||
@ -47,18 +29,18 @@ meta_data() {
|
||||
|
||||
<longdesc lang="en">
|
||||
This is a NeutronAgentMon Resource Agent.
|
||||
It outputs current cluster status to the html.
|
||||
It monitors the 'monitor daemon' status.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Runs crm_mon in the background, recording the cluster status to an HTML file</shortdesc>
|
||||
<shortdesc lang="en">Monitor '/usr/local/bin/monitor.py' in the background.</shortdesc>
|
||||
|
||||
<parameters>
|
||||
|
||||
<parameter name="user" unique="0">
|
||||
<parameter name="file" unique="0">
|
||||
<longdesc lang="en">
|
||||
The user we want to run crm_mon as
|
||||
The file we want to run as a daemon.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">The user we want to run crm_mon as</shortdesc>
|
||||
<content type="string" default="root" />
|
||||
<shortdesc lang="en">The file we want to run as a daemon.</shortdesc>
|
||||
<content type="string" default="/usr/local/bin/monitor.py" />
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
@ -126,18 +108,13 @@ NeutronAgentMon_monitor() {
|
||||
|
||||
NeutronAgentMon_validate() {
|
||||
# Existence of the user
|
||||
if [ ! -z $OCF_RESKEY_user ]; then
|
||||
getent passwd "$OCF_RESKEY_user" >/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
: Yes, user exists. We can further check his permission on crm_mon if necessary
|
||||
else
|
||||
ocf_log err "The user $OCF_RESKEY_user does not exist!"
|
||||
exit $OCF_ERR_ARGS
|
||||
fi
|
||||
if [ -f $OCF_RESKEY_file ]; then
|
||||
echo "Validate OK"
|
||||
return $OCF_SUCCESS
|
||||
else
|
||||
ocf_log err "The file $OCF_RESKEY_file does not exist!"
|
||||
exit $OCF_ERR_ARGS
|
||||
fi
|
||||
|
||||
echo "Validate OK"
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
|
@ -1,3 +1,4 @@
|
||||
[DEFAULT]
|
||||
verbose=True
|
||||
debug=True
|
||||
check_interval=15
|
||||
|
@ -214,8 +214,8 @@ class MonitorNeutronAgentsDaemon(Daemon):
|
||||
return False
|
||||
|
||||
if not self.is_same_host(crm_no_1_node):
|
||||
LOG.warnning('Only the first crm node %s could reschedule. '
|
||||
% crm_no_1_node)
|
||||
LOG.warn('Only the first crm node %s could reschedule. '
|
||||
% crm_no_1_node)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
@ -48,8 +48,6 @@ from quantum_utils import (
|
||||
reassign_agent_resources,
|
||||
stop_services,
|
||||
cache_env_data,
|
||||
get_dns_host,
|
||||
get_external_agent_f,
|
||||
update_legacy_ha_files,
|
||||
remove_legacy_ha_files,
|
||||
delete_legacy_resources
|
||||
@ -228,33 +226,15 @@ def stop():
|
||||
def ha_relation_joined():
|
||||
if config('ha-legacy-mode'):
|
||||
cache_env_data()
|
||||
#dns_hosts = get_dns_host()
|
||||
#debug = config('ocf_ping_debug')
|
||||
#external_agent = get_external_agent_f()
|
||||
|
||||
cluster_config = get_hacluster_config(excludes_key=['vip'])
|
||||
resources = {
|
||||
'res_monitor': 'ocf:canonical:NeutronAgentMon',
|
||||
#'res_ClusterMon': 'ocf:pacemaker:ClusterMon',
|
||||
#'res_PingCheck': 'ocf:pacemaker:ping',
|
||||
}
|
||||
resource_params = {
|
||||
'res_monitor': 'op monitor interval="60s"',
|
||||
|
||||
#'res_ClusterMon': 'params user="root" update="30" '
|
||||
# 'extra_options="-E {external_agent}" '
|
||||
# 'op monitor on-fail="restart" interval="10s"'
|
||||
# .format(external_agent=external_agent),
|
||||
#'res_PingCheck': 'params host_list="{host}" dampen="5s" '
|
||||
# 'debug={debug} multiplier="1000" '
|
||||
# 'op monitor on-fail="restart" interval="10s" '
|
||||
# 'timeout="60s" '.format(host=dns_hosts,
|
||||
# debug=debug),
|
||||
}
|
||||
clones = {
|
||||
'cl_monitor': 'res_monitor meta interleave="true"',
|
||||
#'cl_ClusterMon': 'res_ClusterMon meta interleave="true"',
|
||||
#'cl_PingCheck': 'res_PingCheck meta interleave="true"',
|
||||
}
|
||||
|
||||
relation_set(corosync_bindiface=cluster_config['ha-bindiface'],
|
||||
|
@ -660,19 +660,6 @@ def remove_file(des_dir, f):
|
||||
log('Failed to remove file %s.' % f, level=ERROR)
|
||||
|
||||
|
||||
def get_external_agent_f():
|
||||
agent = 'monitor_neutron_ha.sh'
|
||||
exec_dir = '/usr/lib/ocf/resource.d/canonical'
|
||||
return os.path.join(exec_dir, agent)
|
||||
|
||||
|
||||
def init_canonical_ping_file(update=False):
|
||||
f = 'ping'
|
||||
exec_dir = '/usr/lib/ocf/resource.d/canonical'
|
||||
copy_file(LEGACY_HA_TEMPLATE_FILES, exec_dir,
|
||||
f, update=update)
|
||||
|
||||
|
||||
def install_legacy_ha_files(update=False):
|
||||
for f, p in LEGACY_FILES_MAP.iteritems():
|
||||
copy_file(LEGACY_HA_TEMPLATE_FILES, p['path'], f,
|
||||
|
Loading…
x
Reference in New Issue
Block a user