Drop use of openstack OCF resources
The OpenStack OCF resource definitions for Ceilometer have proven to be quite brittle, and we can achieve much the same end by just using the lsb module to track ceilometer-agent-central directly. Drop all use of ocf:openstack and delete res_ceilometer_polling which is a) broken for Pike and b) complete misnamed. Configure 'lsb:ceilometer-agent-central' for all deployments irrespective of release. Change-Id: I7b02065cf245ae480c04d5db235866e879c14002 Closes-Bug: 1718830
This commit is contained in:
parent
124c91e1b3
commit
7165445849
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
bin
|
||||
.coverage
|
||||
.testrepository
|
||||
.stestr
|
||||
.tox
|
||||
tags
|
||||
*.sw[nop]
|
||||
|
@ -4,10 +4,6 @@ Files: *
|
||||
Copyright: Copyright 2011, Canonical Ltd., All Rights Reserved.
|
||||
License: Apache-2.0
|
||||
|
||||
Files: ocf/openstack/ceilometer-agent-central
|
||||
Copyright: Emilien Macchi
|
||||
License: Apache-2.0
|
||||
|
||||
License: Apache-2.0
|
||||
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
|
||||
|
@ -29,7 +29,6 @@ from charmhelpers.core.hookenv import (
|
||||
relation_get,
|
||||
relation_set,
|
||||
relation_ids,
|
||||
related_units,
|
||||
config,
|
||||
Hooks, UnregisteredHookError,
|
||||
log,
|
||||
@ -45,11 +44,9 @@ from charmhelpers.core.host import (
|
||||
from charmhelpers.contrib.openstack.context import ADDRESS_TYPES
|
||||
from charmhelpers.contrib.openstack.utils import (
|
||||
configure_installation_source,
|
||||
os_release,
|
||||
openstack_upgrade_available,
|
||||
pausable_restart_on_change as restart_on_change,
|
||||
is_unit_paused_set,
|
||||
CompareOpenStackReleases,
|
||||
)
|
||||
from charmhelpers.contrib.openstack.ha.utils import (
|
||||
update_dns_ha_resource_params,
|
||||
@ -99,10 +96,6 @@ from charmhelpers.contrib.hardening.harden import harden
|
||||
hooks = Hooks()
|
||||
CONFIGS = register_configs()
|
||||
|
||||
LEGACY_RES_KEY = 'res_ceilometer_agent_central'
|
||||
LEGACY_OCF_FILE = "/usr/lib/ocf/resource.d/openstack/ceilometer-agent-central"
|
||||
NEW_RES_KEY = 'res_ceilometer_polling'
|
||||
|
||||
|
||||
@hooks.hook('install.real')
|
||||
@harden()
|
||||
@ -209,9 +202,6 @@ def config_changed():
|
||||
for rid in relation_ids('identity-service'):
|
||||
keystone_joined(relid=rid)
|
||||
|
||||
# Install OCF resource file locally
|
||||
install_ceilometer_ocf()
|
||||
|
||||
# Define the new ocf resource and use the key delete_resources to delete
|
||||
# legacy resource for >= Liberty since the ceilometer-agent-central moved
|
||||
# to ceilometer-polling in liberty (see LP: #1606787).
|
||||
@ -237,31 +227,9 @@ def upgrade_charm():
|
||||
cluster_joined(relation_id=rid)
|
||||
|
||||
|
||||
def install_ceilometer_ocf():
|
||||
# TODO Move away from using the OCF resource for openstack service
|
||||
# management.
|
||||
dest_file = LEGACY_OCF_FILE
|
||||
src_file = 'ocf/openstack/ceilometer-agent-central'
|
||||
|
||||
if CompareOpenStackReleases(os_release('ceilometer-common')) >= 'liberty':
|
||||
dest_file = "/usr/lib/ocf/resource.d/openstack/ceilometer-polling"
|
||||
src_file = 'ocf/openstack/ceilometer-polling'
|
||||
# delete ocf file due to package no longer exists after upgrade
|
||||
if os.path.isfile(LEGACY_OCF_FILE):
|
||||
os.remove(LEGACY_OCF_FILE)
|
||||
|
||||
if not os.path.isdir(os.path.dirname(dest_file)):
|
||||
os.makedirs(os.path.dirname(dest_file))
|
||||
if not os.path.exists(dest_file):
|
||||
shutil.copy(src_file, dest_file)
|
||||
os.chmod(dest_file, 0o755)
|
||||
|
||||
|
||||
@hooks.hook('cluster-relation-joined')
|
||||
@restart_on_change(restart_map(), stopstart=True)
|
||||
def cluster_joined(relation_id=None):
|
||||
install_ceilometer_ocf()
|
||||
|
||||
# If this node is the elected leader then share our secret with other nodes
|
||||
if is_elected_leader('grp_ceilometer_vips'):
|
||||
peer_store('shared_secret', get_shared_secret())
|
||||
@ -299,33 +267,18 @@ def cluster_changed():
|
||||
def ha_joined(relation_id=None):
|
||||
cluster_config = get_hacluster_config()
|
||||
delete_resources = []
|
||||
delete_resources.append('res_ceilometer_polling')
|
||||
|
||||
RES_KEY = LEGACY_RES_KEY
|
||||
if CompareOpenStackReleases(os_release('ceilometer-common')) >= 'liberty':
|
||||
RES_KEY = NEW_RES_KEY
|
||||
delete_resources.append(LEGACY_RES_KEY)
|
||||
|
||||
ocf_name = RES_KEY.replace('res_', '').replace('_', '-')
|
||||
resources = {
|
||||
'res_ceilometer_haproxy': 'lsb:haproxy',
|
||||
RES_KEY: ('ocf:openstack:{}'.format(ocf_name))
|
||||
'res_ceilometer_agent_central': 'lsb:ceilometer-agent-central',
|
||||
}
|
||||
|
||||
resource_params = {
|
||||
'res_ceilometer_haproxy': 'op monitor interval="5s"',
|
||||
RES_KEY: 'op monitor interval="30s"'
|
||||
'res_ceilometer_agent_central': 'op monitor interval="30s"'
|
||||
}
|
||||
|
||||
amqp_ssl_port = None
|
||||
for rel_id in relation_ids('amqp'):
|
||||
for unit in related_units(rel_id):
|
||||
amqp_ssl_port = relation_get('ssl_port', unit, rel_id)
|
||||
|
||||
if amqp_ssl_port:
|
||||
params = ('params amqp_server_port="%s" op monitor interval="30s"' %
|
||||
(amqp_ssl_port))
|
||||
resource_params[RES_KEY] = params
|
||||
|
||||
if config('dns-ha'):
|
||||
update_dns_ha_resource_params(relation_id=relation_id,
|
||||
resources=resources,
|
||||
|
@ -1,347 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# OpenStack Ceilometer Central Agent Service (ceilometer-agent-central)
|
||||
#
|
||||
# Description: Manages an OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) process as an HA resource
|
||||
#
|
||||
# Authors: Emilien Macchi
|
||||
# Mainly inspired by the Nova Scheduler resource agent written by Sebastien Han
|
||||
#
|
||||
# Support: openstack@lists.launchpad.net
|
||||
# License: Apache Software License (ASL) 2.0
|
||||
#
|
||||
#
|
||||
# See usage() function below for more details ...
|
||||
#
|
||||
# OCF instance parameters:
|
||||
# OCF_RESKEY_binary
|
||||
# OCF_RESKEY_config
|
||||
# OCF_RESKEY_user
|
||||
# OCF_RESKEY_pid
|
||||
# OCF_RESKEY_monitor_binary
|
||||
# OCF_RESKEY_amqp_server_port
|
||||
# OCF_RESKEY_additional_parameters
|
||||
#######################################################################
|
||||
# Initialization:
|
||||
|
||||
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||
|
||||
#######################################################################
|
||||
|
||||
# Fill in some defaults if no values are specified
|
||||
|
||||
OCF_RESKEY_binary_default="ceilometer-agent-central"
|
||||
OCF_RESKEY_config_default="/etc/ceilometer/ceilometer.conf"
|
||||
OCF_RESKEY_user_default="ceilometer"
|
||||
OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
|
||||
OCF_RESKEY_amqp_server_port_default="5672"
|
||||
|
||||
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
|
||||
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
|
||||
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
|
||||
: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
|
||||
: ${OCF_RESKEY_amqp_server_port=${OCF_RESKEY_amqp_server_port_default}}
|
||||
|
||||
#######################################################################
|
||||
|
||||
usage() {
|
||||
cat <<UEND
|
||||
usage: $0 (start|stop|validate-all|meta-data|status|monitor)
|
||||
|
||||
$0 manages an OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) process as an HA resource
|
||||
|
||||
The 'start' operation starts the scheduler service.
|
||||
The 'stop' operation stops the scheduler service.
|
||||
The 'validate-all' operation reports whether the parameters are valid
|
||||
The 'meta-data' operation reports this RA's meta-data information
|
||||
The 'status' operation reports whether the scheduler service is running
|
||||
The 'monitor' operation reports whether the scheduler service seems to be working
|
||||
|
||||
UEND
|
||||
}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||
<resource-agent name="ceilometer-agent-central">
|
||||
<version>1.0</version>
|
||||
|
||||
<longdesc lang="en">
|
||||
Resource agent for the OpenStack Ceilometer Central Agent Service (ceilometer-agent-central)
|
||||
May manage a ceilometer-agent-central instance or a clone set that
|
||||
creates a distributed ceilometer-agent-central cluster.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Manages the OpenStack Ceilometer Central Agent Service (ceilometer-agent-central)</shortdesc>
|
||||
<parameters>
|
||||
|
||||
<parameter name="binary" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack Ceilometer Central Agent server binary (ceilometer-agent-central)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Central Agent server binary (ceilometer-agent-central)</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_binary_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="config" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) configuration file
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Central Agent (ceilometer-agent-central registry) config file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_config_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="user" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
User running OpenStack Ceilometer Central Agent Service (ceilometer-agent-central)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) user</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_user_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="pid" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The pid file to use for this OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) instance
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Central Agent Service (ceilometer-agent-central) pid file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_pid_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="amqp_server_port" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The listening port number of the AMQP server. Use for monitoring purposes
|
||||
</longdesc>
|
||||
<shortdesc lang="en">AMQP listening port</shortdesc>
|
||||
<content type="integer" default="${OCF_RESKEY_amqp_server_port_default}" />
|
||||
</parameter>
|
||||
|
||||
|
||||
<parameter name="additional_parameters" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Additional parameters to pass on to the OpenStack Ceilometer Central Agent Service (ceilometer-agent-central)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Additional parameters for ceilometer-agent-central</shortdesc>
|
||||
<content type="string" />
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
|
||||
<actions>
|
||||
<action name="start" timeout="20" />
|
||||
<action name="stop" timeout="20" />
|
||||
<action name="status" timeout="20" />
|
||||
<action name="monitor" timeout="30" interval="20" />
|
||||
<action name="validate-all" timeout="5" />
|
||||
<action name="meta-data" timeout="5" />
|
||||
</actions>
|
||||
</resource-agent>
|
||||
END
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Functions invoked by resource manager actions
|
||||
|
||||
ceilometer_agent_central_check_port() {
|
||||
# This function has been taken from the squid RA and improved a bit
|
||||
# The length of the integer must be 4
|
||||
# Examples of valid port: "1080", "0080"
|
||||
# Examples of invalid port: "1080bad", "0", "0000", ""
|
||||
|
||||
local int
|
||||
local cnt
|
||||
|
||||
int="$1"
|
||||
cnt=${#int}
|
||||
echo $int |egrep -qx '[0-9]+(:[0-9]+)?(,[0-9]+(:[0-9]+)?)*'
|
||||
|
||||
if [ $? -ne 0 ] || [ $cnt -ne 4 ]; then
|
||||
ocf_log err "Invalid port number: $1"
|
||||
exit $OCF_ERR_CONFIGURED
|
||||
fi
|
||||
}
|
||||
|
||||
ceilometer_agent_central_validate() {
|
||||
local rc
|
||||
|
||||
check_binary $OCF_RESKEY_binary
|
||||
check_binary netstat
|
||||
ceilometer_agent_central_check_port $OCF_RESKEY_amqp_server_port
|
||||
|
||||
# A config file on shared storage that is not available
|
||||
# during probes is OK.
|
||||
if [ ! -f $OCF_RESKEY_config ]; then
|
||||
if ! ocf_is_probe; then
|
||||
ocf_log err "Config $OCF_RESKEY_config doesn't exist"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
ocf_log_warn "Config $OCF_RESKEY_config not available during a probe"
|
||||
fi
|
||||
|
||||
getent passwd $OCF_RESKEY_user >/dev/null 2>&1
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "User $OCF_RESKEY_user doesn't exist"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
ceilometer_agent_central_status() {
|
||||
local pid
|
||||
local rc
|
||||
|
||||
if [ ! -f $OCF_RESKEY_pid ]; then
|
||||
ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) is not running"
|
||||
return $OCF_NOT_RUNNING
|
||||
else
|
||||
pid=`cat $OCF_RESKEY_pid`
|
||||
fi
|
||||
|
||||
ocf_run -warn kill -s 0 $pid
|
||||
rc=$?
|
||||
if [ $rc -eq 0 ]; then
|
||||
return $OCF_SUCCESS
|
||||
else
|
||||
ocf_log info "Old PID file found, but OpenStack Ceilometer Central Agent (ceilometer-agent-central) is not running"
|
||||
return $OCF_NOT_RUNNING
|
||||
fi
|
||||
}
|
||||
|
||||
ceilometer_agent_central_monitor() {
|
||||
local rc
|
||||
local pid
|
||||
local scheduler_amqp_check
|
||||
|
||||
ceilometer_agent_central_status
|
||||
rc=$?
|
||||
|
||||
# If status returned anything but success, return that immediately
|
||||
if [ $rc -ne $OCF_SUCCESS ]; then
|
||||
return $rc
|
||||
fi
|
||||
|
||||
# Check the connections according to the PID.
|
||||
# We are sure to hit the scheduler process and not other Cinder process with the same connection behavior (for example cinder-api)
|
||||
pid=`cat $OCF_RESKEY_pid`
|
||||
scheduler_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "Central Agent is not connected to the AMQP server : $rc"
|
||||
return $OCF_NOT_RUNNING
|
||||
fi
|
||||
|
||||
ocf_log debug "OpenStack Ceilometer Central Agent (ceilometer-agent-central) monitor succeeded"
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
ceilometer_agent_central_start() {
|
||||
local rc
|
||||
|
||||
service ceilometer-agent-central stop >> /dev/null 2>&1
|
||||
|
||||
ceilometer_agent_central_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_SUCCESS ]; then
|
||||
ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) already running"
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# run the actual ceilometer-agent-central daemon. Don't use ocf_run as we're sending the tool's output
|
||||
# straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
|
||||
su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
|
||||
$OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
|
||||
|
||||
# Spin waiting for the server to come up.
|
||||
while true; do
|
||||
ceilometer_agent_central_monitor
|
||||
rc=$?
|
||||
[ $rc -eq $OCF_SUCCESS ] && break
|
||||
if [ $rc -ne $OCF_NOT_RUNNING ]; then
|
||||
ocf_log err "OpenStack Ceilometer Central Agent (ceilometer-agent-central) start failed"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) started"
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
ceilometer_agent_central_stop() {
|
||||
local rc
|
||||
local pid
|
||||
|
||||
ceilometer_agent_central_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_NOT_RUNNING ]; then
|
||||
ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) already stopped"
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# Try SIGTERM
|
||||
pid=`cat $OCF_RESKEY_pid`
|
||||
ocf_run kill -s TERM $pid
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "OpenStack Ceilometer Central Agent (ceilometer-agent-central) couldn't be stopped"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
# stop waiting
|
||||
shutdown_timeout=15
|
||||
if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
|
||||
shutdown_timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000)-5))
|
||||
fi
|
||||
count=0
|
||||
while [ $count -lt $shutdown_timeout ]; do
|
||||
ceilometer_agent_central_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_NOT_RUNNING ]; then
|
||||
break
|
||||
fi
|
||||
count=`expr $count + 1`
|
||||
sleep 1
|
||||
ocf_log debug "OpenStack Ceilometer Central Agent (ceilometer-agent-central) still hasn't stopped yet. Waiting ..."
|
||||
done
|
||||
|
||||
ceilometer_agent_central_status
|
||||
rc=$?
|
||||
if [ $rc -ne $OCF_NOT_RUNNING ]; then
|
||||
# SIGTERM didn't help either, try SIGKILL
|
||||
ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) failed to stop after ${shutdown_timeout}s \
|
||||
using SIGTERM. Trying SIGKILL ..."
|
||||
ocf_run kill -s KILL $pid
|
||||
fi
|
||||
|
||||
ocf_log info "OpenStack Ceilometer Central Agent (ceilometer-agent-central) stopped"
|
||||
|
||||
rm -f $OCF_RESKEY_pid
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
|
||||
case "$1" in
|
||||
meta-data) meta_data
|
||||
exit $OCF_SUCCESS;;
|
||||
usage|help) usage
|
||||
exit $OCF_SUCCESS;;
|
||||
esac
|
||||
|
||||
# Anything except meta-data and help must pass validation
|
||||
ceilometer_agent_central_validate || exit $?
|
||||
|
||||
# What kind of method was invoked?
|
||||
case "$1" in
|
||||
start) ceilometer_agent_central_start;;
|
||||
stop) ceilometer_agent_central_stop;;
|
||||
status) ceilometer_agent_central_status;;
|
||||
monitor) ceilometer_agent_central_monitor;;
|
||||
validate-all) ;;
|
||||
*) usage
|
||||
exit $OCF_ERR_UNIMPLEMENTED;;
|
||||
esac
|
@ -1,348 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
# OpenStack Ceilometer Polling Agent Service (ceilometer-polling)
|
||||
#
|
||||
# Description: Manages an OpenStack Ceilometer Polling Agent Service (ceilometer-polling) process as an HA resource
|
||||
#
|
||||
# Authors: Emilien Macchi
|
||||
# Mainly inspired by the Nova Scheduler resource agent written by Sebastien Han
|
||||
#
|
||||
# Support: openstack@lists.launchpad.net
|
||||
# License: Apache Software License (ASL) 2.0
|
||||
#
|
||||
#
|
||||
# See usage() function below for more details ...
|
||||
#
|
||||
# OCF instance parameters:
|
||||
# OCF_RESKEY_binary
|
||||
# OCF_RESKEY_config
|
||||
# OCF_RESKEY_user
|
||||
# OCF_RESKEY_pid
|
||||
# OCF_RESKEY_monitor_binary
|
||||
# OCF_RESKEY_amqp_server_port
|
||||
# OCF_RESKEY_additional_parameters
|
||||
#######################################################################
|
||||
# Initialization:
|
||||
|
||||
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||
|
||||
#######################################################################
|
||||
|
||||
# Fill in some defaults if no values are specified
|
||||
|
||||
OCF_RESKEY_binary_default="ceilometer-polling"
|
||||
OCF_RESKEY_additional_parameters=" --polling-namespaces central"
|
||||
OCF_RESKEY_config_default="/etc/ceilometer/ceilometer.conf"
|
||||
OCF_RESKEY_user_default="ceilometer"
|
||||
OCF_RESKEY_pid_default="$HA_RSCTMP/$OCF_RESOURCE_INSTANCE.pid"
|
||||
OCF_RESKEY_amqp_server_port_default="5672"
|
||||
|
||||
: ${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}
|
||||
: ${OCF_RESKEY_config=${OCF_RESKEY_config_default}}
|
||||
: ${OCF_RESKEY_user=${OCF_RESKEY_user_default}}
|
||||
: ${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}
|
||||
: ${OCF_RESKEY_amqp_server_port=${OCF_RESKEY_amqp_server_port_default}}
|
||||
|
||||
#######################################################################
|
||||
|
||||
usage() {
|
||||
cat <<UEND
|
||||
usage: $0 (start|stop|validate-all|meta-data|status|monitor)
|
||||
|
||||
$0 manages an OpenStack Ceilometer Polling Agent Service (ceilometer-polling) process as an HA resource
|
||||
|
||||
The 'start' operation starts the scheduler service.
|
||||
The 'stop' operation stops the scheduler service.
|
||||
The 'validate-all' operation reports whether the parameters are valid
|
||||
The 'meta-data' operation reports this RA's meta-data information
|
||||
The 'status' operation reports whether the scheduler service is running
|
||||
The 'monitor' operation reports whether the scheduler service seems to be working
|
||||
|
||||
UEND
|
||||
}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||
<resource-agent name="ceilometer-polling">
|
||||
<version>1.0</version>
|
||||
|
||||
<longdesc lang="en">
|
||||
Resource agent for the OpenStack Ceilometer Polling Agent Service (ceilometer-polling)
|
||||
May manage a ceilometer-polling instance or a clone set that
|
||||
creates a distributed ceilometer-polling cluster.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Manages the OpenStack Ceilometer Polling Agent Service (ceilometer-polling)</shortdesc>
|
||||
<parameters>
|
||||
|
||||
<parameter name="binary" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack Ceilometer Polling Agent server binary (ceilometer-polling)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Polling Agent server binary (ceilometer-polling)</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_binary_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="config" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Location of the OpenStack Ceilometer Polling Agent Service (ceilometer-polling) configuration file
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Polling Agent (ceilometer-polling registry) config file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_config_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="user" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
User running OpenStack Ceilometer Polling Agent Service (ceilometer-polling)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Polling Agent Service (ceilometer-polling) user</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_user_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="pid" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The pid file to use for this OpenStack Ceilometer Polling Agent Service (ceilometer-polling) instance
|
||||
</longdesc>
|
||||
<shortdesc lang="en">OpenStack Ceilometer Polling Agent Service (ceilometer-polling) pid file</shortdesc>
|
||||
<content type="string" default="${OCF_RESKEY_pid_default}" />
|
||||
</parameter>
|
||||
|
||||
<parameter name="amqp_server_port" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
The listening port number of the AMQP server. Use for monitoring purposes
|
||||
</longdesc>
|
||||
<shortdesc lang="en">AMQP listening port</shortdesc>
|
||||
<content type="integer" default="${OCF_RESKEY_amqp_server_port_default}" />
|
||||
</parameter>
|
||||
|
||||
|
||||
<parameter name="additional_parameters" unique="0" required="0">
|
||||
<longdesc lang="en">
|
||||
Additional parameters to pass on to the OpenStack Ceilometer Polling Agent Service (ceilometer-polling)
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Additional parameters for ceilometer-polling</shortdesc>
|
||||
<content type="string" />
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
|
||||
<actions>
|
||||
<action name="start" timeout="20" />
|
||||
<action name="stop" timeout="20" />
|
||||
<action name="status" timeout="20" />
|
||||
<action name="monitor" timeout="30" interval="20" />
|
||||
<action name="validate-all" timeout="5" />
|
||||
<action name="meta-data" timeout="5" />
|
||||
</actions>
|
||||
</resource-agent>
|
||||
END
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
# Functions invoked by resource manager actions
|
||||
|
||||
ceilometer_polling_check_port() {
|
||||
# This function has been taken from the squid RA and improved a bit
|
||||
# The length of the integer must be 4
|
||||
# Examples of valid port: "1080", "0080"
|
||||
# Examples of invalid port: "1080bad", "0", "0000", ""
|
||||
|
||||
local int
|
||||
local cnt
|
||||
|
||||
int="$1"
|
||||
cnt=${#int}
|
||||
echo $int |egrep -qx '[0-9]+(:[0-9]+)?(,[0-9]+(:[0-9]+)?)*'
|
||||
|
||||
if [ $? -ne 0 ] || [ $cnt -ne 4 ]; then
|
||||
ocf_log err "Invalid port number: $1"
|
||||
exit $OCF_ERR_CONFIGURED
|
||||
fi
|
||||
}
|
||||
|
||||
ceilometer_polling_validate() {
|
||||
local rc
|
||||
|
||||
check_binary $OCF_RESKEY_binary
|
||||
check_binary netstat
|
||||
ceilometer_polling_check_port $OCF_RESKEY_amqp_server_port
|
||||
|
||||
# A config file on shared storage that is not available
|
||||
# during probes is OK.
|
||||
if [ ! -f $OCF_RESKEY_config ]; then
|
||||
if ! ocf_is_probe; then
|
||||
ocf_log err "Config $OCF_RESKEY_config doesn't exist"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
ocf_log_warn "Config $OCF_RESKEY_config not available during a probe"
|
||||
fi
|
||||
|
||||
getent passwd $OCF_RESKEY_user >/dev/null 2>&1
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "User $OCF_RESKEY_user doesn't exist"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
ceilometer_polling_status() {
|
||||
local pid
|
||||
local rc
|
||||
|
||||
if [ ! -f $OCF_RESKEY_pid ]; then
|
||||
ocf_log info "OpenStack Ceilometer Polling Agent (ceilometer-polling) is not running"
|
||||
return $OCF_NOT_RUNNING
|
||||
else
|
||||
pid=`cat $OCF_RESKEY_pid`
|
||||
fi
|
||||
|
||||
ocf_run -warn kill -s 0 $pid
|
||||
rc=$?
|
||||
if [ $rc -eq 0 ]; then
|
||||
return $OCF_SUCCESS
|
||||
else
|
||||
ocf_log info "Old PID file found, but OpenStack Ceilometer Polling Agent (ceilometer-polling) is not running"
|
||||
return $OCF_NOT_RUNNING
|
||||
fi
|
||||
}
|
||||
|
||||
ceilometer_polling_monitor() {
|
||||
local rc
|
||||
local pid
|
||||
local scheduler_amqp_check
|
||||
|
||||
ceilometer_polling_status
|
||||
rc=$?
|
||||
|
||||
# If status returned anything but success, return that immediately
|
||||
if [ $rc -ne $OCF_SUCCESS ]; then
|
||||
return $rc
|
||||
fi
|
||||
|
||||
# Check the connections according to the PID.
|
||||
# We are sure to hit the scheduler process and not other Cinder process with the same connection behavior (for example cinder-api)
|
||||
pid=`cat $OCF_RESKEY_pid`
|
||||
scheduler_amqp_check=`netstat -punt | grep -s "$OCF_RESKEY_amqp_server_port" | grep -s "$pid" | grep -qs "ESTABLISHED"`
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "Central Agent is not connected to the AMQP server : $rc"
|
||||
return $OCF_NOT_RUNNING
|
||||
fi
|
||||
|
||||
ocf_log debug "OpenStack Ceilometer Polling Agent (ceilometer-polling) monitor succeeded"
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
ceilometer_polling_start() {
|
||||
local rc
|
||||
|
||||
service ceilometer-agent-central stop >> /dev/null 2>&1
|
||||
|
||||
ceilometer_polling_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_SUCCESS ]; then
|
||||
ocf_log info "OpenStack Ceilometer Polling Agent (ceilometer-polling) already running"
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# run the actual ceilometer-polling daemon. Don't use ocf_run as we're sending the tool's output
|
||||
# straight to /dev/null anyway and using ocf_run would break stdout-redirection here.
|
||||
su ${OCF_RESKEY_user} -s /bin/sh -c "${OCF_RESKEY_binary} --config-file=$OCF_RESKEY_config \
|
||||
$OCF_RESKEY_additional_parameters"' >> /dev/null 2>&1 & echo $!' > $OCF_RESKEY_pid
|
||||
|
||||
# Spin waiting for the server to come up.
|
||||
while true; do
|
||||
ceilometer_polling_monitor
|
||||
rc=$?
|
||||
[ $rc -eq $OCF_SUCCESS ] && break
|
||||
if [ $rc -ne $OCF_NOT_RUNNING ]; then
|
||||
ocf_log err "OpenStack Ceilometer Polling Agent (ceilometer-polling) start failed"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
ocf_log info "OpenStack Ceilometer Polling Agent (ceilometer-polling) started"
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
ceilometer_polling_stop() {
|
||||
local rc
|
||||
local pid
|
||||
|
||||
ceilometer_polling_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_NOT_RUNNING ]; then
|
||||
ocf_log info "OpenStack Ceilometer Polling Agent (ceilometer-polling) already stopped"
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
|
||||
# Try SIGTERM
|
||||
pid=`cat $OCF_RESKEY_pid`
|
||||
ocf_run kill -s TERM $pid
|
||||
rc=$?
|
||||
if [ $rc -ne 0 ]; then
|
||||
ocf_log err "OpenStack Ceilometer Polling Agent (ceilometer-polling) couldn't be stopped"
|
||||
exit $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
# stop waiting
|
||||
shutdown_timeout=15
|
||||
if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then
|
||||
shutdown_timeout=$((($OCF_RESKEY_CRM_meta_timeout/1000)-5))
|
||||
fi
|
||||
count=0
|
||||
while [ $count -lt $shutdown_timeout ]; do
|
||||
ceilometer_polling_status
|
||||
rc=$?
|
||||
if [ $rc -eq $OCF_NOT_RUNNING ]; then
|
||||
break
|
||||
fi
|
||||
count=`expr $count + 1`
|
||||
sleep 1
|
||||
ocf_log debug "OpenStack Ceilometer Polling Agent (ceilometer-polling) still hasn't stopped yet. Waiting ..."
|
||||
done
|
||||
|
||||
ceilometer_polling_status
|
||||
rc=$?
|
||||
if [ $rc -ne $OCF_NOT_RUNNING ]; then
|
||||
# SIGTERM didn't help either, try SIGKILL
|
||||
ocf_log info "OpenStack Ceilometer Polling Agent (ceilometer-polling) failed to stop after ${shutdown_timeout}s \
|
||||
using SIGTERM. Trying SIGKILL ..."
|
||||
ocf_run kill -s KILL $pid
|
||||
fi
|
||||
|
||||
ocf_log info "OpenStack Ceilometer Polling Agent (ceilometer-polling) stopped"
|
||||
|
||||
rm -f $OCF_RESKEY_pid
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
#######################################################################
|
||||
|
||||
case "$1" in
|
||||
meta-data) meta_data
|
||||
exit $OCF_SUCCESS;;
|
||||
usage|help) usage
|
||||
exit $OCF_SUCCESS;;
|
||||
esac
|
||||
|
||||
# Anything except meta-data and help must pass validation
|
||||
ceilometer_polling_validate || exit $?
|
||||
|
||||
# What kind of method was invoked?
|
||||
case "$1" in
|
||||
start) ceilometer_polling_start;;
|
||||
stop) ceilometer_polling_stop;;
|
||||
status) ceilometer_polling_status;;
|
||||
monitor) ceilometer_polling_monitor;;
|
||||
validate-all) ;;
|
||||
*) usage
|
||||
exit $OCF_ERR_UNIMPLEMENTED;;
|
||||
esac
|
@ -42,7 +42,6 @@ from test_utils import CharmTestCase
|
||||
TO_PATCH = [
|
||||
'relation_get',
|
||||
'relation_set',
|
||||
'related_units',
|
||||
'configure_installation_source',
|
||||
'openstack_upgrade_available',
|
||||
'do_openstack_upgrade',
|
||||
@ -68,7 +67,6 @@ TO_PATCH = [
|
||||
'run_in_apache',
|
||||
'mkdir',
|
||||
'init_is_systemd',
|
||||
'os_release',
|
||||
'get_relation_ip',
|
||||
]
|
||||
|
||||
@ -191,8 +189,7 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
@patch.object(hooks, 'install_event_pipeline_setting')
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'ceilometer_joined')
|
||||
@patch.object(hooks, 'install_ceilometer_ocf')
|
||||
def test_config_changed_no_upgrade(self, ocf,
|
||||
def test_config_changed_no_upgrade(self,
|
||||
joined, mock_config, event_pipe):
|
||||
self.openstack_upgrade_available.return_value = False
|
||||
hooks.hooks.execute(['hooks/config-changed'])
|
||||
@ -203,13 +200,11 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
self.assertTrue(self.CONFIGS.write_all.called)
|
||||
self.assertTrue(joined.called)
|
||||
self.assertTrue(self.reload_systemd.called)
|
||||
self.assertTrue(ocf.called)
|
||||
|
||||
@patch.object(hooks, 'install_event_pipeline_setting')
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'ceilometer_joined')
|
||||
@patch.object(hooks, 'install_ceilometer_ocf')
|
||||
def test_config_changed_upgrade(self, ocf,
|
||||
def test_config_changed_upgrade(self,
|
||||
joined, mock_config, event_pipe):
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
hooks.hooks.execute(['hooks/config-changed'])
|
||||
@ -220,11 +215,9 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
self.assertTrue(self.CONFIGS.write_all.called)
|
||||
self.assertTrue(joined.called)
|
||||
self.assertTrue(self.reload_systemd.called)
|
||||
self.assertTrue(ocf.called)
|
||||
|
||||
@patch.object(hooks, 'install_event_pipeline_setting')
|
||||
@patch.object(hooks, 'install_ceilometer_ocf')
|
||||
def test_config_changed_with_openstack_upgrade_action(self, ocf,
|
||||
def test_config_changed_with_openstack_upgrade_action(self,
|
||||
event_pipe):
|
||||
self.openstack_upgrade_available.return_value = True
|
||||
self.test_config.set('action-managed-upgrade', True)
|
||||
@ -233,7 +226,6 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
|
||||
self.assertFalse(self.do_openstack_upgrade.called)
|
||||
self.assertTrue(event_pipe.called)
|
||||
self.assertTrue(ocf.called)
|
||||
|
||||
@patch.object(hooks, 'canonical_url')
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@ -296,9 +288,8 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
self.service_restart.assert_has_calls([call1, call2], any_order=False)
|
||||
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'install_ceilometer_ocf')
|
||||
@patch.object(hooks, 'is_elected_leader')
|
||||
def test_cluster_joined_not_leader(self, mock_leader, mock_install_ocf,
|
||||
def test_cluster_joined_not_leader(self, mock_leader,
|
||||
mock_config):
|
||||
mock_leader.return_value = False
|
||||
|
||||
@ -308,9 +299,8 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'get_shared_secret')
|
||||
@patch.object(hooks, 'install_ceilometer_ocf')
|
||||
@patch.object(hooks, 'is_elected_leader')
|
||||
def test_cluster_joined_is_leader(self, mock_leader, mock_install_ocf,
|
||||
def test_cluster_joined_is_leader(self, mock_leader,
|
||||
shared_secret, mock_config):
|
||||
mock_leader.return_value = True
|
||||
shared_secret.return_value = 'secret'
|
||||
@ -321,9 +311,8 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
self.assertTrue(self.CONFIGS.write_all.called)
|
||||
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'install_ceilometer_ocf')
|
||||
@patch.object(hooks, 'is_elected_leader')
|
||||
def test_cluster_joined(self, mock_leader, mock_install_ocf, mock_config):
|
||||
def test_cluster_joined(self, mock_leader, mock_config):
|
||||
mock_leader.return_value = False
|
||||
self.get_relation_ip.side_effect = [
|
||||
'10.0.0.100', '10.0.1.100', '10.0.2.100', '10.0.3.100']
|
||||
@ -368,7 +357,6 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
@patch.object(hooks, 'get_netmask_for_address')
|
||||
def test_ha_joined(self, mock_netmask, mock_iface, mock_cluster_config,
|
||||
mock_config):
|
||||
self.os_release.return_value = 'kilo'
|
||||
mock_cluster_config.return_value = {'vip': '10.0.5.100',
|
||||
'ha-bindiface': 'bnd0',
|
||||
'ha-mcastport': 5802}
|
||||
@ -379,8 +367,7 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
|
||||
exp_resources = {
|
||||
'res_ceilometer_haproxy': 'lsb:haproxy',
|
||||
'res_ceilometer_agent_central': ('ocf:openstack:'
|
||||
'ceilometer-agent-central'),
|
||||
'res_ceilometer_agent_central': 'lsb:ceilometer-agent-central',
|
||||
'res_ceilometer_eth0_vip': 'ocf:heartbeat:IPaddr2'
|
||||
}
|
||||
exp_resource_params = {
|
||||
@ -399,58 +386,7 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
corosync_mcastport=5802,
|
||||
resources=exp_resources,
|
||||
resource_params=exp_resource_params,
|
||||
delete_resources=[],
|
||||
clones=exp_clones)
|
||||
self.relation_set.assert_has_calls([call1, call2], any_order=False)
|
||||
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'get_netmask_for_address')
|
||||
@patch.object(hooks, 'get_hacluster_config')
|
||||
@patch.object(hooks, 'get_iface_for_address')
|
||||
@patch.object(hooks, 'relation_ids')
|
||||
@patch.object(hooks, 'related_units')
|
||||
@patch.object(hooks, 'relation_get')
|
||||
def test_ha_joined_ssl(self, mock_rel_get, mock_rel_units, mock_rel_ids,
|
||||
mock_iface, mock_cluster_config, mock_netmask,
|
||||
mock_config):
|
||||
self.os_release.return_value = 'kilo'
|
||||
mock_rel_ids.return_value = 'amqp:0'
|
||||
mock_rel_units.return_value = 'rabbitmq-server/0'
|
||||
mock_rel_get.return_value = '5671'
|
||||
|
||||
mock_iface.return_value = 'eth0'
|
||||
mock_netmask.return_value = '255.255.255.10'
|
||||
mock_cluster_config.return_value = {'vip': '10.0.5.100',
|
||||
'ha-bindiface': 'bnd0',
|
||||
'ha-mcastport': 5802}
|
||||
|
||||
hooks.hooks.execute(['hooks/ha-relation-joined'])
|
||||
self.assertEqual(self.relation_set.call_count, 2)
|
||||
|
||||
exp_resources = {
|
||||
'res_ceilometer_haproxy': 'lsb:haproxy',
|
||||
'res_ceilometer_agent_central': ('ocf:openstack:'
|
||||
'ceilometer-agent-central'),
|
||||
'res_ceilometer_eth0_vip': 'ocf:heartbeat:IPaddr2'
|
||||
}
|
||||
exp_resource_params = {
|
||||
'res_ceilometer_haproxy': 'op monitor interval="5s"',
|
||||
'res_ceilometer_agent_central': ('params amqp_server_port="5671" '
|
||||
'op monitor interval="30s"'),
|
||||
'res_ceilometer_eth0_vip': ('params ip="10.0.5.100" '
|
||||
'cidr_netmask="255.255.255.10" '
|
||||
'nic="eth0"')
|
||||
}
|
||||
exp_clones = {'cl_ceilometer_haproxy': 'res_ceilometer_haproxy'}
|
||||
call1 = call(relation_id=None,
|
||||
groups={'grp_ceilometer_vips': 'res_ceilometer_eth0_vip'})
|
||||
call2 = call(relation_id=None,
|
||||
init_services={'res_ceilometer_haproxy': 'haproxy'},
|
||||
corosync_bindiface='bnd0',
|
||||
corosync_mcastport=5802,
|
||||
resources=exp_resources,
|
||||
resource_params=exp_resource_params,
|
||||
delete_resources=[],
|
||||
delete_resources=['res_ceilometer_polling'],
|
||||
clones=exp_clones)
|
||||
self.relation_set.assert_has_calls([call1, call2], any_order=False)
|
||||
|
||||
@ -464,7 +400,6 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
'ip_address="10.0.0.1"'})
|
||||
|
||||
self.test_config.set('dns-ha', True)
|
||||
self.os_release.return_value = 'kilo'
|
||||
mock_cluster_config.return_value = {
|
||||
'vip': None,
|
||||
'ha-bindiface': 'em0',
|
||||
@ -481,14 +416,14 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
'resources': {'res_ceilometer_public_hostname': 'ocf:maas:dns',
|
||||
'res_ceilometer_haproxy': 'lsb:haproxy',
|
||||
'res_ceilometer_agent_central':
|
||||
'ocf:openstack:ceilometer-agent-central'},
|
||||
'lsb:ceilometer-agent-central'},
|
||||
'resource_params': {
|
||||
'res_ceilometer_public_hostname':
|
||||
'params fqdn="ceilometer.maas" '
|
||||
'ip_address="10.0.0.1"',
|
||||
'res_ceilometer_haproxy': 'op monitor interval="5s"',
|
||||
'res_ceilometer_agent_central': 'op monitor interval="30s"'},
|
||||
'delete_resources': [],
|
||||
'delete_resources': ['res_ceilometer_polling'],
|
||||
'clones': {'cl_ceilometer_haproxy': 'res_ceilometer_haproxy'}
|
||||
}
|
||||
self.update_dns_ha_resource_params.side_effect = _fake_update
|
||||
@ -497,18 +432,6 @@ class CeilometerHooksTest(CharmTestCase):
|
||||
self.assertTrue(self.update_dns_ha_resource_params.called)
|
||||
self.relation_set.assert_called_with(**args)
|
||||
|
||||
self.os_release.return_value = 'liberty'
|
||||
args.get('resources').pop('res_ceilometer_agent_central')
|
||||
args.get('resource_params').pop('res_ceilometer_agent_central')
|
||||
args.get('resources')['res_ceilometer_polling'] = \
|
||||
'ocf:openstack:ceilometer-polling'
|
||||
args.get('resource_params')['res_ceilometer_polling'] = \
|
||||
'op monitor interval="30s"'
|
||||
args['delete_resources'] = ['res_ceilometer_agent_central']
|
||||
self.update_dns_ha_resource_params.side_effect = _fake_update
|
||||
hooks.ha_joined()
|
||||
self.relation_set.assert_called_with(**args)
|
||||
|
||||
@patch('charmhelpers.core.hookenv.config')
|
||||
@patch.object(hooks, 'keystone_joined')
|
||||
def test_ha_changed_not_clustered(self, mock_keystone_joined, mock_config):
|
||||
|
Loading…
Reference in New Issue
Block a user