diff --git a/extra/resources/Makefile.am b/extra/resources/Makefile.am index 5d8a0bd5b3..0f54e89890 100644 --- a/extra/resources/Makefile.am +++ b/extra/resources/Makefile.am @@ -1,30 +1,31 @@ # Makefile.am for OCF RAs # # Author: Andrew Beekhof # Copyright (C) 2008 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 EXTRA_DIST = $(ocf_SCRIPTS) ocfdir = @OCF_RA_DIR@/pacemaker ocf_SCRIPTS = ClusterMon \ Dummy \ Stateful \ SysInfo \ + pingd \ controld diff --git a/extra/resources/controld b/extra/resources/controld index a864c95a5f..bb0c57362d 100644 --- a/extra/resources/controld +++ b/extra/resources/controld @@ -1,180 +1,180 @@ #!/bin/sh # # # Dummy OCF RA. Does nothing but wait a few seconds, can be # configured to fail occassionally. # # Copyright (c) 2004 SUSE LINUX AG, Lars Marowsky-Brée # 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: . ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs ####################################################################### meta_data() { cat < 1.0 This Resource Agent can control the dlm_controld services needed by ocfs2. It assumes that dlm_controld is in your default PATH. In most cases, it should be run as an anonymous clone. DLM Agent for OCFS2 Any additional options to start the dlm_controld service with DLM Options The location where configfs is or should be mounted Location of configfs END } ####################################################################### controld_usage() { cat < /dev/null if [ $? != 0 ]; then mount -t configfs none $OCF_RESKEY_configdir fi if [ ! -e $OCF_RESKEY_configdir/dlm ]; then modprobe dlm if [ ! -e $OCF_RESKEY_configdir/dlm ]; then ocf_log err "$OCF_RESKEY_configdir/dlm not available" return $OCF_NOT_INSTALLED fi fi ${OCF_RESKEY_daemon} $OCF_RESKEY_args sleep 1 controld_monitor } controld_stop() { controld_monitor; rc=$? case $rc in $OCF_NOT_RUNNING) return $OCF_SUCCESS;; esac killall -KILL ${OCF_RESKEY_daemon}; rc=$? case $rc in 0) return $OCF_SUCCESS;; *) return $OCF_ERR_GENERIC;; esac } controld_monitor() { killall -0 ${OCF_RESKEY_daemon}; rc=$? case $rc in 0) return $OCF_SUCCESS;; 1) return $OCF_NOT_RUNNING;; *) return $OCF_ERR_GENERIC;; esac } controld_validate() { check_binary ${OCF_RESKEY_daemon} return $OCF_SUCCESS } -: ${OCF_RESKEY_daemon=dlm_controld} +: ${OCF_RESKEY_daemon=dlm_controld.pcmk} : ${OCF_RESKEY_args=-q 0} : ${OCF_RESKEY_configdir=/sys/kernel/config} case $__OCF_ACTION in meta-data) meta_data exit $OCF_SUCCESS ;; start) controld_validate; controld_start;; stop) controld_stop;; monitor) controld_validate; controld_monitor;; validate-all) controld_validate;; usage|help) controld_usage exit $OCF_SUCCESS ;; *) controld_usage exit $OCF_ERR_UNIMPLEMENTED ;; esac rc=$? ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" exit $rc diff --git a/extra/resources/pingd b/extra/resources/pingd new file mode 100644 index 0000000000..74cfd7804a --- /dev/null +++ b/extra/resources/pingd @@ -0,0 +1,260 @@ +#!/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: + +. ${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 + + + + + + + + + + + + + +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!" + 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 update interval + if ocf_is_decimal "$OCF_RESKEY_update" && [ $OCF_RESKEY_update -gt 0 ]; then + : + else + ocf_log err "Invalid update interval $OCF_RESKEY_update. 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_pidfile:="$HA_RSCTMP/pingd-${OCF_RESOURCE_INSTANCE}"} +: ${OCF_RESKEY_name:="pingd"} +: ${OCF_RESKEY_dampen:="1s"} + +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 + ;; +esac + +exit $?