diff --git a/extra/resources/pingd b/extra/resources/pingd index 20471f7344..3bfacd2389 100644 --- a/extra/resources/pingd +++ b/extra/resources/pingd @@ -1,316 +1,76 @@ #!/bin/sh # # # pingd OCF Resource Agent # Records (in the CIB) the current number of ping nodes a # cluster node can connect to. # # Copyright (c) 2006 Andrew Beekhof # All Rights Reserved. # # 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. # ####################################################################### # Initialization: -if [ "x" != "x$OCF_RESKEY_host_list" ]; then - ocf_log err "It is recommended that you use the ping resource instead" -# ${OCF_ROOT}/resource.d/pacemaker/ping $1 -# exit $? -fi - . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs -####################################################################### - -meta_data() { - cat < - - -1.0 - - -This is a pingd Resource Agent. -It records (in the CIB) the current number of ping nodes a node can connect to. - -pingd resource agent - - - - -PID file -PID file - - - - - - -The user we want to run pingd as - -The user we want to run pingd as - - - - - -The time to wait (dampening) further changes occur - -Dampening interval - - - - - -The name of the instance_attributes set to place the value in. Rarely needs to be specified. - -Set name - - - - - -The name of the attributes to set. This is the name to be used in the constraints. - -Attribute name - - - - - -The section place the value in. Rarely needs to be specified. - -Section name - - - - - -The number by which to multiply the number of connected ping nodes by - -Value multiplier - - - - - -The list of ping nodes to count. Defaults to all configured ping nodes. Rarely needs to be specified. - -Host list - - - - - -How often, in seconds, to check for node liveliness - -ping interval in seconds - - - - - -Number of ping attempts, per host, before declaring it dead - -no. of ping attempts - - - - - -How long, in seconds, to wait before declaring a ping lost - -ping timeout in seconds - - - - - -A catch all for any other options that need to be passed to pingd. - -Extra Options - - - - - - - - - - - - - -END -} - -####################################################################### - -pingd_usage() { - cat </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!" + if [ -z $recurring ]; then + ocf_log err "$upgrade1" + ocf_log err "$upgrade2" + ocf_log err "Automatic conversion to ocf:pacemaker:ping failed: no monitor operation configured" + ocf_log err "Without an explicit monitor operation for '$OCF_RESOURCE_INSTANCE', connectivity changes will not be noticed" + ocf_log err "Preventing startup to ensure the issue is addressed before it matters" exit $OCF_ERR_ARGS fi - fi - -# Pidfile better be an absolute path - case $OCF_RESKEY_pidfile in - /*) ;; - *) ocf_log warn "You should have pidfile($OCF_RESKEY_pidfile) of absolute path!" ;; - esac - -# Check the ping interval - if ocf_is_decimal "$OCF_RESKEY_interval" && [ $OCF_RESKEY_interval -gt 0 ]; then - : - else - ocf_log err "Invalid ping interval $OCF_RESKEY_interval. It should be positive integer!" - exit $OCF_ERR_ARGS - fi - - echo "Validate OK" - return $OCF_SUCCESS -} - -if [ $# -ne 1 ]; then - pingd_usage - exit $OCF_ERR_ARGS -fi - -: ${OCF_RESKEY_options:=""} -: ${OCF_RESKEY_dampen:="5s"} -: ${OCF_RESKEY_interval:="1"} -: ${OCF_RESKEY_name:="pingd"} -: ${OCF_RESKEY_CRM_meta_interval:=0} -: ${OCF_RESKEY_CRM_meta_globally_unique:="true"} - -if [ ${OCF_RESKEY_CRM_meta_globally_unique} = "false" ]; then - : ${OCF_RESKEY_pidfile:="$HA_VARRUN/pingd-${OCF_RESKEY_name}"} -else - : ${OCF_RESKEY_pidfile:="$HA_VARRUN/pingd-${OCF_RESOURCE_INSTANCE}"} -fi - -case $__OCF_ACTION in -meta-data) meta_data - exit $OCF_SUCCESS - ;; -start) pingd_start - ;; -stop) pingd_stop - ;; -monitor) pingd_monitor - ;; -validate-all) pingd_validate - ;; -usage|help) pingd_usage - exit $OCF_SUCCESS - ;; -*) pingd_usage - exit $OCF_ERR_UNIMPLEMENTED - ;; + + if [ $OCF_RESKEY_CRM_meta_interval = 0 ]; then + ocf_log warn "$upgrade1" + ocf_log warn "$upgrade2" + if [ $recurring != $OCF_RESKEY_interval ]; then + ocf_log warn "Your monitor operation happens every $recurring, which means that the $OCF_RESKEY_name attribute will be updated with a different frequency than the previously configured ( $OCF_RESKEY_interval )" + ocf_log warn "Either change the monitor interval to match or, ideally, switch to the ocf:pacemaker:ping agent and avoid all this compatibility nonsense." + fi + fi + ;; esac +${OCF_ROOT}/resource.d/pacemaker/ping $1 exit $? diff --git a/tools/Makefile.am b/tools/Makefile.am index 869c2f02ae..85d1b52396 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,148 +1,148 @@ # # Copyright (C) 2004-2009 Andrew Beekhof # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # MAINTAINERCLEANFILES = Makefile.in INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/libltdl -I$(top_srcdir)/libltdl COMMONLIBS = \ $(top_builddir)/lib/common/libcrmcommon.la \ $(top_builddir)/lib/cib/libcib.la \ $(CURSESLIBS) $(CLUSTERLIBS) headerdir = $(pkgincludedir)/crm header_HEADERS = attrd.h pcmkdir = $(datadir)/$(PACKAGE) pcmk_DATA = report.common report.collector sbin_SCRIPTS = crm_report crm_standby crm_master crm_failcount EXTRA_DIST = $(sbin_SCRIPTS) halibdir = $(CRM_DAEMON_DIR) halib_SCRIPTS = hb2openais.sh -halib_PROGRAMS = attrd pingd +halib_PROGRAMS = attrd halib_PYTHON = crm_primitive.py hb2openais-helper.py sbin_PROGRAMS = crm_simulate crmadmin cibadmin crm_node crm_attribute crm_resource crm_verify \ crm_uuid crm_shadow attrd_updater crm_diff crm_mon iso8601 testdir = $(datadir)/$(PACKAGE)/tests/cli test_SCRIPTS = regression.sh test_DATA = regression.exp cli.supp if BUILD_SERVICELOG sbin_PROGRAMS += notifyServicelogEvent endif if BUILD_OPENIPMI_SERVICELOG sbin_PROGRAMS += ipmiservicelogd endif if BUILD_HELP man8_MANS = $(sbin_PROGRAMS:%=%.8) crm_report.8 endif ## SOURCES noinst_HEADERS = crmadmin_SOURCES = crmadmin.c crmadmin_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la crm_uuid_SOURCES = crm_uuid.c crm_uuid_LDADD = $(top_builddir)/lib/common/libcrmcluster.la cibadmin_SOURCES = cibadmin.c cibadmin_LDADD = $(COMMONLIBS) crm_shadow_SOURCES = cib_shadow.c crm_shadow_LDADD = $(COMMONLIBS) crm_node_SOURCES = ccm_epoche.c crm_node_LDADD = $(COMMONLIBS) $(CLUSTERLIBS) \ $(top_builddir)/lib/common/libcrmcluster.la crm_simulate_SOURCES = crm_inject.c crm_simulate_CFLAGS = -I$(top_srcdir)/pengine crm_simulate_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la \ $(top_builddir)/lib/cib/libcib.la \ $(top_builddir)/lib/transition/libtransitioner.la crm_diff_SOURCES = xml_diff.c crm_diff_LDADD = $(COMMONLIBS) crm_mon_SOURCES = crm_mon.c crm_mon_LDADD = $(COMMONLIBS) $(SNMPLIBS) $(ESMTPLIBS) -llrm \ $(top_builddir)/lib/pengine/libpe_status.la # Arguments could be made that this should live in crm/pengine crm_verify_SOURCES = crm_verify.c crm_verify_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la crm_attribute_SOURCES = crm_attribute.c crm_attribute_LDADD = $(COMMONLIBS) crm_resource_SOURCES = crm_resource.c crm_resource_LDADD = $(COMMONLIBS) \ $(top_builddir)/lib/pengine/libpe_rules.la \ $(top_builddir)/lib/pengine/libpe_status.la \ $(top_builddir)/pengine/libpengine.la iso8601_SOURCES = test.iso8601.c iso8601_LDADD = $(COMMONLIBS) attrd_SOURCES = attrd.c attrd_LDADD = $(COMMONLIBS) $(top_builddir)/lib/common/libcrmcluster.la -pingd_SOURCES = pingd.c -pingd_LDADD = $(COMMONLIBS) +#pingd_SOURCES = pingd.c +#pingd_LDADD = $(COMMONLIBS) attrd_updater_SOURCES = attrd_updater.c attrd_updater_LDADD = $(COMMONLIBS) if BUILD_SERVICELOG notifyServicelogEvent_SOURCES = notifyServicelogEvent.c notifyServicelogEvent_CFLAGS = `pkg-config --cflags servicelog-1` notifyServicelogEvent_LDFLAGS = `pkg-config --libs servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la endif if BUILD_OPENIPMI_SERVICELOG ipmiservicelogd_SOURCES = ipmiservicelogd.c ipmiservicelogd_CFLAGS = `pkg-config --cflags OpenIPMI OpenIPMIposix servicelog-1` ipmiservicelogd_LDFLAGS = `pkg-config --libs OpenIPMI OpenIPMIposix servicelog-1` $(top_builddir)/lib/common/libcrmcommon.la endif %.8: % echo Creating $@ chmod a+x $< help2man --output $@ --no-info --section 8 --name "Part of the Pacemaker cluster resource manager" $(top_builddir)/tools/$< clean-generic: rm -f *.log *.debug *.xml *~ install-exec-local: uninstall-local: .PHONY: install-exec-hook