diff --git a/SOURCES/bz1029061-virtualdomain-parse-error.patch b/SOURCES/bz1029061-virtualdomain-parse-error.patch new file mode 100644 index 0000000..ce86748 --- /dev/null +++ b/SOURCES/bz1029061-virtualdomain-parse-error.patch @@ -0,0 +1,29 @@ +From bd3b09252eedbeeab2635f82259714975702257e Mon Sep 17 00:00:00 2001 +From: David Vossel +Date: Mon, 20 Jan 2014 10:29:23 -0600 +Subject: [PATCH] High: VirtualDomain: Fixes parsing domain name from xml file. + +If the domain xml is not generated by virsh, it is possible +VirtualDomain will not be able to detect the domain's name +from the xml file. This is a result of the parsing command +not taking into account trailing whitespace characters. +--- + heartbeat/VirtualDomain | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain +index 3ca4f6d..11c8df9 100755 +--- a/heartbeat/VirtualDomain ++++ b/heartbeat/VirtualDomain +@@ -565,7 +565,7 @@ if [ ! -r $OCF_RESKEY_config ]; then + fi + + # Retrieve the domain name from the xml file. +-DOMAIN_NAME=`egrep '.*.*$' ${OCF_RESKEY_config} | sed -e 's/.*\(.*\)<\/name>$/\1/' 2>/dev/null` ++DOMAIN_NAME=`egrep '[[:space:]]*.*[[:space:]]*$' ${OCF_RESKEY_config} | sed -e 's/[[:space:]]*\(.*\)<\/name>[[:space:]]*$/\1/' 2>/dev/null` + if [ -z $DOMAIN_NAME ]; then + ocf_log err "This is unexpected. Cannot determine domain name." + exit $OCF_ERR_GENERIC +-- +1.8.4.2 + diff --git a/SOURCES/bz1033016-nfsserver-missing-etab.patch b/SOURCES/bz1033016-nfsserver-missing-etab.patch new file mode 100644 index 0000000..6f04b56 --- /dev/null +++ b/SOURCES/bz1033016-nfsserver-missing-etab.patch @@ -0,0 +1,15 @@ +diff --git a/heartbeat/nfsserver b/heartbeat/nfsserver +index 2f62df4..bc326e5 100755 +--- a/heartbeat/nfsserver ++++ b/heartbeat/nfsserver +@@ -307,6 +307,10 @@ prepare_directory () + [ -d "$fp/$STATD_DIR/sm.bak" ] || mkdir -p "$fp/$STATD_DIR/sm.bak" + [ -n "`id -u rpcuser`" -a "`id -g rpcuser`" ] && chown -R rpcuser.rpcuser "$fp/$STATD_DIR" + ++ [ -f "$fp/etab" ] || touch "$fp/etab" ++ [ -f "$fp/xtab" ] || touch "$fp/xtab" ++ [ -f "$fp/rmtab" ] || touch "$fp/rmtab" ++ + [ $SELINUX_ENABLED -eq 0 ] && chcon -R "$SELINUX_LABEL" "$fp" + } + diff --git a/SOURCES/bz1060367-vm-monitor-wo-libvirtd.patch b/SOURCES/bz1060367-vm-monitor-wo-libvirtd.patch new file mode 100644 index 0000000..06ad87f --- /dev/null +++ b/SOURCES/bz1060367-vm-monitor-wo-libvirtd.patch @@ -0,0 +1,113 @@ +diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain +index 6f80981..b159c2c 100755 +--- a/heartbeat/VirtualDomain ++++ b/heartbeat/VirtualDomain +@@ -65,10 +65,10 @@ for this virtual domain. + + Hypervisor URI to connect to. See the libvirt documentation for + details on supported URI formats. The default is system dependent. +-Determine your systems default uri by running 'virsh --quiet uri' ++Determine the system's default uri by running 'virsh --quiet uri'. + + Hypervisor URI +- ++ + + + +@@ -202,15 +202,44 @@ update_utilization() { + fi + } + ++# attempt to check domain status outside of libvirt using the emulator process ++pid_status() ++{ ++ local rc=$OCF_ERR_GENERIC ++ local emulator ++ ++ emulator=$(basename $(egrep '[[:space:]]*.*[[:space:]]*$' ${OCF_RESKEY_config} | sed -e 's/[[:space:]]*\(.*\)<\/emulator>[[:space:]]*$/\1/')) ++ ++ case "$emulator" in ++ qemu-kvm|qemu-system-*) ++ ps awx | grep -E "[q]emu-(kvm|system).*-name $DOMAIN_NAME " > /dev/null 2>&1 ++ if [ $? -eq 0 ]; then ++ # domain exists and is running ++ ocf_log debug "Virtual domain $DOMAIN_NAME is currently running." ++ rc=$OCF_SUCCESS ++ else ++ # domain pid does not exist on local machine ++ ocf_log debug "Virtual domain $DOMAIN_NAME is currently not running." ++ rc=$OCF_NOT_RUNNING ++ fi ++ ;; ++ # This can be expanded to check for additional emulators ++ *) ++ ;; ++ esac ++ ++ return $rc ++} ++ + VirtualDomain_Status() { + local try=0 + rc=$OCF_ERR_GENERIC + status="no state" + while [ "$status" = "no state" ]; do + try=$(($try + 1 )) +- status="`virsh $VIRSH_OPTIONS domstate $DOMAIN_NAME 2>&1`" ++ status=$(virsh $VIRSH_OPTIONS domstate $DOMAIN_NAME 2>&1|tr 'A-Z' 'a-z') + case "$status" in +- *"error:"*"Domain not found"*|"shut off") ++ *"error:"*"domain not found"*|"shut off") + # shut off: domain is defined, but not started, will not happen if + # domain is created but not defined + # Domain not found: domain is not defined and thus not started +@@ -226,7 +255,7 @@ VirtualDomain_Status() { + ocf_log debug "Virtual domain $DOMAIN_NAME is currently $status." + rc=$OCF_SUCCESS + ;; +- ""|*"Failed to reconnect to the hypervisor"*|"no state") ++ ""|*"failed to "*"connect to the hypervisor"*|"no state") + # Empty string may be returned when virsh does not + # receive a reply from libvirtd. + # "no state" may occur when the domain is currently +@@ -240,6 +269,14 @@ VirtualDomain_Status() { + # the domain if necessary. + ocf_log error "Virtual domain $DOMAIN_NAME has no state during stop operation, bailing out." + return $OCF_ERR_GENERIC; ++ elif [ "$__OCF_ACTION" = "monitor" ]; then ++ pid_status ++ rc=$? ++ if [ $rc -ne $OCF_ERR_GENERIC ]; then ++ # we've successfully determined the domains status outside of libvirt ++ return $rc ++ fi ++ + else + # During all other actions, we just wait and try + # again, relying on the CRM/LRM to time us out if +@@ -312,11 +349,11 @@ force_stop() + local status=0 + + ocf_log info "Issuing forced shutdown (destroy) request for domain ${DOMAIN_NAME}." +- out=$(virsh $VIRSH_OPTIONS destroy ${DOMAIN_NAME} 2>&1) ++ out=$(virsh $VIRSH_OPTIONS destroy ${DOMAIN_NAME} 2>&1|tr 'A-Z' 'a-z') + ex=$? + echo >&2 "$out" + case $ex$out in +- *"error:"*"domain is not running"*|*"error:"*"Domain not found"*) ++ *"error:"*"domain is not running"*|*"error:"*"domain not found"*) + : ;; # unexpected path to the intended outcome, all is well + [!0]*) + return $OCF_ERR_GENERIC ;; +@@ -544,8 +581,8 @@ case $1 in + ;; + esac + +-OCF_RESKEY_hypervisor_default="$(virsh --quiet uri)" +-: ${OCF_RESKEY_hypervisor=${OCF_RESKEY_hypervisor_default}} ++# Grab the virsh uri default, but only if hypervisor isn't set ++: ${OCF_RESKEY_hypervisor=$(virsh --quiet uri)} + + # Set options to be passed to virsh: + VIRSH_OPTIONS="--connect=${OCF_RESKEY_hypervisor} --quiet" diff --git a/SOURCES/bz1060367-vm-monitor-wo-libvirtd_2.patch b/SOURCES/bz1060367-vm-monitor-wo-libvirtd_2.patch new file mode 100644 index 0000000..e08c784 --- /dev/null +++ b/SOURCES/bz1060367-vm-monitor-wo-libvirtd_2.patch @@ -0,0 +1,178 @@ +diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain +index b159c2c..3a6b6a9 100755 +--- a/heartbeat/VirtualDomain ++++ b/heartbeat/VirtualDomain +@@ -21,11 +21,13 @@ OCF_RESKEY_force_stop_default=0 + OCF_RESKEY_autoset_utilization_cpu_default="true" + OCF_RESKEY_autoset_utilization_hv_memory_default="true" + OCF_RESKEY_migrateport_default=$(( 49152 + $(ocf_maybe_random) % 64 )) ++OCF_RESKEY_CRM_meta_timeout_default=90000 + + : ${OCF_RESKEY_force_stop=${OCF_RESKEY_force_stop_default}} + : ${OCF_RESKEY_autoset_utilization_cpu=${OCF_RESKEY_autoset_utilization_cpu_default}} + : ${OCF_RESKEY_autoset_utilization_hv_memory=${OCF_RESKEY_autoset_utilization_hv_memory_default}} + : ${OCF_RESKEY_migrateport=${OCF_RESKEY_migrateport_default}} ++: ${OCF_RESKEY_CRM_meta_timeout=${OCF_RESKEY_CRM_meta_timeout_default}} + ####################################################################### + + ## I'd very much suggest to make this RA use bash, +@@ -165,8 +167,8 @@ Restore state on start/stop + + + +- +- ++ ++ + + + +@@ -183,9 +185,17 @@ set_util_attr() { + local cval outp + + cval=$(crm_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g $attr 2>/dev/null) ++ if [ $? -ne 0 ] && [ -z "$cval" ]; then ++ crm_resource -Q -r $OCF_RESOURCE_INSTANCE -z -g $attr 2>&1 | grep -e "not connected" > /dev/null 2>&1 ++ if [ $? -eq 0 ]; then ++ ocf_log debug "Unable to set utilization attribute, cib is not available" ++ return ++ fi ++ fi ++ + if [ "$cval" != "$val" ]; then +- outp=`crm_resource -r $OCF_RESOURCE_INSTANCE -z -p $attr -v $val 2>&1` || +- ocf_log warn "crm_resource failed to set utilization attribute $attr: $outp" ++ outp=$(crm_resource -r $OCF_RESOURCE_INSTANCE -z -p $attr -v $val 2>&1) || ++ ocf_log warn "crm_resource failed to set utilization attribute $attr: $outp" + fi + } + +@@ -193,22 +203,49 @@ update_utilization() { + local dom_cpu dom_mem + + if ocf_is_true "$OCF_RESKEY_autoset_utilization_cpu"; then +- dom_cpu=$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} | awk '/CPU\(s\)/{print $2}') ++ dom_cpu=$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} 2>/dev/null | awk '/CPU\(s\)/{print $2}') + test -n "$dom_cpu" && set_util_attr cpu $dom_cpu + fi + if ocf_is_true "$OCF_RESKEY_autoset_utilization_hv_memory"; then +- dom_mem=$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} | awk '/Max memory/{printf("%d", $3/1024)}') ++ dom_mem=$(LANG=C virsh $VIRSH_OPTIONS dominfo ${DOMAIN_NAME} 2>/dev/null | awk '/Max memory/{printf("%d", $3/1024)}') + test -n "$dom_mem" && set_util_attr hv_memory "$dom_mem" + fi + } + ++get_emulator() ++{ ++ local emulator="" ++ ++ emulator=$(virsh $VIRSH_OPTIONS dumpxml $DOMAIN_NAME 2>/dev/null | sed -n -e 's/[[:space:]]*\(.*\)<\/emulator>[[:space:]]*$/\1/p') ++ if [ -z "$emulator" ] && [ -a "$EMULATOR_STATE" ]; then ++ emulator=$(cat $EMULATOR_STATE) ++ fi ++ if [ -z "$emulator" ]; then ++ emulator=$(cat ${OCF_RESKEY_config} | sed -n -e 's/[[:space:]]*\(.*\)<\/emulator>[[:space:]]*$/\1/p') ++ fi ++ ++ if [ -n "$emulator" ]; then ++ basename $emulator ++ else ++ ocf_log error "Unable to determine emulator for $DOMAIN_NAME" ++ fi ++} ++ ++update_emulator_cache() ++{ ++ local emulator ++ ++ emulator=$(get_emulator) ++ if [ -n "$emulator" ]; then ++ echo $emulator > $EMULATOR_STATE ++ fi ++} ++ + # attempt to check domain status outside of libvirt using the emulator process + pid_status() + { + local rc=$OCF_ERR_GENERIC +- local emulator +- +- emulator=$(basename $(egrep '[[:space:]]*.*[[:space:]]*$' ${OCF_RESKEY_config} | sed -e 's/[[:space:]]*\(.*\)<\/emulator>[[:space:]]*$/\1/')) ++ local emulator=$(get_emulator) + + case "$emulator" in + qemu-kvm|qemu-system-*) +@@ -237,13 +274,13 @@ VirtualDomain_Status() { + status="no state" + while [ "$status" = "no state" ]; do + try=$(($try + 1 )) +- status=$(virsh $VIRSH_OPTIONS domstate $DOMAIN_NAME 2>&1|tr 'A-Z' 'a-z') ++ status=$(virsh $VIRSH_OPTIONS domstate $DOMAIN_NAME 2>&1 | tr 'A-Z' 'a-z') + case "$status" in + *"error:"*"domain not found"*|"shut off") + # shut off: domain is defined, but not started, will not happen if + # domain is created but not defined + # Domain not found: domain is not defined and thus not started +- ocf_log debug "Virtual domain $DOMAIN_NAME is currently $status." ++ ocf_log debug "Virtual domain $DOMAIN_NAME is not running: $(echo $status | sed s/error://g)" + rc=$OCF_NOT_RUNNING + ;; + running|paused|idle|blocked|"in shutdown") +@@ -282,12 +319,13 @@ VirtualDomain_Status() { + # again, relying on the CRM/LRM to time us out if + # this takes too long. + ocf_log info "Virtual domain $DOMAIN_NAME currently has no state, retrying." +- sleep 1 + fi ++ sleep 1 + ;; + *) + # any other output is unexpected. + ocf_log error "Virtual domain $DOMAIN_NAME has unknown status \"$status\"!" ++ sleep 1 + ;; + esac + done +@@ -295,7 +333,7 @@ VirtualDomain_Status() { + } + + verify_undefined() { +- for dom in `virsh --connect=${OCF_RESKEY_hypervisor} list --all --name`; do ++ for dom in `virsh --connect=${OCF_RESKEY_hypervisor} list --all --name 2>/dev/null`; do + if [ "$dom" = "$DOMAIN_NAME" ]; then + virsh $VIRSH_OPTIONS undefine $DOMAIN_NAME > /dev/null 2>&1 + return +@@ -340,6 +378,7 @@ VirtualDomain_Start() { + while ! VirtualDomain_Monitor; do + sleep 1 + done ++ + return $OCF_SUCCESS + } + +@@ -530,6 +569,7 @@ VirtualDomain_Monitor() { + done + fi + ++ update_emulator_cache + update_utilization + + return ${rc} +@@ -582,7 +622,7 @@ case $1 in + esac + + # Grab the virsh uri default, but only if hypervisor isn't set +-: ${OCF_RESKEY_hypervisor=$(virsh --quiet uri)} ++: ${OCF_RESKEY_hypervisor=$(virsh --quiet uri 2>/dev/null)} + + # Set options to be passed to virsh: + VIRSH_OPTIONS="--connect=${OCF_RESKEY_hypervisor} --quiet" +@@ -608,6 +648,8 @@ if [ -z $DOMAIN_NAME ]; then + exit $OCF_ERR_GENERIC + fi + ++EMULATOR_STATE="${HA_RSCTMP}/VirtualDomain-${DOMAIN_NAME}-emu.state" ++ + case $1 in + start) + VirtualDomain_Start diff --git a/SOURCES/bz1064512-clvmd-agent.patch b/SOURCES/bz1064512-clvmd-agent.patch new file mode 100644 index 0000000..bc16573 --- /dev/null +++ b/SOURCES/bz1064512-clvmd-agent.patch @@ -0,0 +1,441 @@ +From 61dd0f9ca20b0f252996b6f610b4473ba83ca97a Mon Sep 17 00:00:00 2001 +From: David Vossel +Date: Wed, 12 Feb 2014 12:36:21 -0500 +Subject: [PATCH] High: clvm: Introducing clvmd resource agent + +--- + doc/man/Makefile.am | 1 + + heartbeat/Makefile.am | 1 + + heartbeat/clvm | 396 ++++++++++++++++++++++++++++++++++++++++++++++++++ + 3 files changed, 398 insertions(+) + create mode 100755 heartbeat/clvm + +diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am +index 3bf569a..49b5c58 100644 +--- a/doc/man/Makefile.am ++++ b/doc/man/Makefile.am +@@ -94,6 +94,7 @@ man_MANS = ocf_heartbeat_AoEtarget.7 \ + ocf_heartbeat_anything.7 \ + ocf_heartbeat_apache.7 \ + ocf_heartbeat_asterisk.7 \ ++ ocf_heartbeat_clvm.7 \ + ocf_heartbeat_conntrackd.7 \ + ocf_heartbeat_db2.7 \ + ocf_heartbeat_dhcpd.7 \ +diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am +index bc95f89..2c3056d 100644 +--- a/heartbeat/Makefile.am ++++ b/heartbeat/Makefile.am +@@ -61,6 +61,7 @@ ocf_SCRIPTS = ClusterMon \ + asterisk \ + nginx \ + AudibleAlarm \ ++ clvm \ + conntrackd \ + db2 \ + dhcpd \ +diff --git a/heartbeat/clvm b/heartbeat/clvm +new file mode 100755 +index 0000000..3e7701d +--- /dev/null ++++ b/heartbeat/clvm +@@ -0,0 +1,396 @@ ++#!/bin/bash ++# ++# Copyright (c) 2014 David Vossel ++# 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_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat} ++. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs ++. ${OCF_FUNCTIONS_DIR}/ocf-directories ++ ++####################################################################### ++ ++meta_data() { ++ cat < ++ ++ ++1.0 ++ ++ ++This agent manages the clvmd daemon. ++ ++clvmd ++ ++ ++ ++ ++Start with cmirrord (cluster mirror log daemon). ++ ++activate cmirrord ++ ++ ++ ++ ++ ++Options to clvmd. Refer to clvmd.8 for detailed descriptions. ++ ++Daemon Options ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++END ++} ++ ++####################################################################### ++ ++: ${OCF_RESKEY_daemon_options:="-d0"} ++ ++sbindir=$HA_SBIN_DIR ++if [ -z $sbindir ]; then ++ sbindir=/usr/sbin ++fi ++DAEMON="clvmd" ++CMIRROR="cmirrord" ++DAEMON_PATH="${sbindir}/clvmd" ++CMIRROR_PATH="${sbindir}/cmirrord" ++LOCK_FILE="/var/lock/subsys/$DAEMON" ++LVM_VGCHANGE=${sbindir}/vgchange ++LVM_VGDISPLAY=${sbindir}/vgdisplay ++LVM_VGSCAN=${sbindir}/vgscan ++ ++# Leaving this in for legacy. We do not want to advertize ++# the abilty to set options in the systconfig exists, we want ++# to expand the OCF style options as necessary instead. ++[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster ++[ -f /etc/sysconfig/$DAEMON ] && . /etc/sysconfig/$DAEMON ++ ++CLVMD_TIMEOUT="90" ++if [ -n "$OCF_RESKEY_CRM_meta_timeout" ]; then ++ CLVMD_TIMEOUT=$(($OCF_RESKEY_CRM_meta_timeout/1000)) ++fi ++ ++clvmd_usage() ++{ ++ cat </dev/null | grep -a "${binary}" > /dev/null 2>&1 ++ if [ $? -eq 0 ];then ++ # shortcut without requiring pgrep to search through all procs ++ return $OCF_SUCCESS ++ fi ++ fi ++ ++ pid=$(pgrep ${binary}) ++ case $? in ++ 0) ++ ocf_log info "PID file (pid:${pid} at $pidfile) created for ${binary}." ++ echo "$pid" > $pidfile ++ return $OCF_SUCCESS;; ++ 1) ++ rm -f "$pidfile" > /dev/null 2>&1 ++ ocf_log info "$binary is not running" ++ return $OCF_NOT_RUNNING;; ++ *) ++ rm -f "$pidfile" > /dev/null 2>&1 ++ ocf_log err "Error encountered detecting pid status of $binary" ++ return $OCF_ERR_GENERIC;; ++ esac ++} ++ ++clvmd_status() ++{ ++ local rc ++ local mirror_rc ++ clvmd_validate ++ if [ $? -ne $OCF_SUCCESS ]; then ++ ocf_log error "Unable to monitor, Environment validation failed." ++ return $? ++ fi ++ ++ check_process $DAEMON ++ rc=$? ++ mirror_rc=$rc ++ ++ if ocf_is_true $OCF_RESKEY_with_cmirrord; then ++ check_process $CMIRROR ++ mirror_rc=$? ++ fi ++ ++ # If these ever don't match, return error to force recovery ++ if [ $mirror_rc -ne $rc ]; then ++ return $OCF_ERR_GENERIC ++ fi ++ ++ return $rc ++} ++ ++# NOTE: replace this with vgs, once display filter per attr is implemented. ++clustered_vgs() { ++ ${LVM_VGDISPLAY} 2>/dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}' ++} ++ ++wait_for_process() ++{ ++ local binary=$1 ++ local timeout=$2 ++ local count=0 ++ ++ ocf_log info "Waiting for $binary to exit" ++ usleep 500000 ++ while [ $count -le $timeout ]; do ++ check_process $binary ++ if [ $? -eq $OCF_NOT_RUNNING ]; then ++ ocf_log info "$binary terminated" ++ return $OCF_SUCCESS ++ fi ++ sleep 1 ++ count=$((count+1)) ++ done ++ ++ return $OCF_ERR_GENERIC ++} ++ ++time_left() ++{ ++ local end=$1 ++ local default=$2 ++ local now=$SECONDS ++ local result=0 ++ ++ result=$(( $end - $now )) ++ if [ $result -lt $default ]; then ++ return $default ++ fi ++ return $result ++} ++ ++clvmd_stop() ++{ ++ local LVM_VGS ++ local rc=$OCF_SUCCESS ++ local end=$(( $SECONDS + $CLVMD_TIMEOUT )) ++ ++ clvmd_status ++ if [ $? -eq $OCF_NOT_RUNNING ]; then ++ return $OCF_SUCCESS ++ fi ++ ++ check_process $DAEMON ++ if [ $? -ne $OCF_NOT_RUNNING ]; then ++ LVM_VGS="$(clustered_vgs)" ++ ++ if [ -n "$LVM_VGS" ]; then ++ ocf_log info "Deactivating clustered VG(s):" ++ ocf_run ${LVM_VGCHANGE} -anl $LVM_VGS ++ if [ $? -ne 0 ]; then ++ ocf_log error "Failed to deactivate volume groups, cluster vglist = $LVM_VGS" ++ return $OCF_ERR_GENERIC ++ fi ++ fi ++ ++ ocf_log info "Signaling $DAEMON to exit" ++ killall -TERM $DAEMON ++ if [ $? != 0 ]; then ++ ocf_log error "Failed to signal -TERM to $DAEMON" ++ return $OCF_ERR_GENERIC ++ fi ++ ++ wait_for_process $DAEMON $CLVMD_TIMEOUT ++ rc=$? ++ if [ $rc -ne $OCF_SUCCESS ]; then ++ ocf_log error "$DAEMON failed to exit" ++ return $rc ++ fi ++ ++ rm -f $LOCK_FILE ++ fi ++ ++ check_process $CMIRROR ++ if [ $? -ne $OCF_NOT_RUNNING ] && ocf_is_true $OCF_RESKEY_with_cmirrord; then ++ local timeout ++ ocf_log info "Signaling $CMIRROR to exit" ++ killall -INT $CMIRROR ++ ++ time_left $end 10; timeout=$? ++ wait_for_process $CMIRROR $timeout ++ rc=$? ++ if [ $rc -ne $OCF_SUCCESS ]; then ++ killall -KILL $CMIRROR ++ time_left $end 10; timeout=$? ++ wait_for_process $CMIRROR $(time_left $end 10) ++ rc=$? ++ fi ++ fi ++ ++ return $rc ++} ++ ++start_process() ++{ ++ local binary_path=$1 ++ local opts=$2 ++ ++ check_process "$(basename $binary_path)" ++ if [ $? -ne $OCF_SUCCESS ]; then ++ ocf_log info "Starting $binary_path: " ++ ocf_run $binary_path $opts ++ rc=$? ++ if [ $rc -ne 0 ]; then ++ ocf_log error "Failed to launch $binary_path, exit code $rc" ++ exit $OCF_ERR_GENERIC ++ fi ++ fi ++ ++ return $OCF_SUCCESS ++} ++ ++clvmd_activate_all() ++{ ++ # Activate all volume groups by leaving the ++ # "volume group name" parameter empty ++ ocf_run ${LVM_VGCHANGE} -aay ++ if [ $? -ne 0 ]; then ++ ocf_log info "Failed to activate VG(s):" ++ clvmd_stop ++ return $OCF_ERR_GENERIC ++ fi ++ return $OCF_SUCCESS ++} ++ ++clvmd_start() ++{ ++ local rc=0 ++ local CLVMDOPTS="-T${CLVMD_TIMEOUT} $OCF_RESKEY_daemon_options" ++ ++ clvmd_validate ++ if [ $? -ne $OCF_SUCCESS ]; then ++ ocf_log error "Unable to start, Environment validation failed." ++ return $? ++ fi ++ ++ clvmd_status ++ if [ $? -eq $OCF_SUCCESS ]; then ++ ocf_log debug "$DAEMON already started" ++ clvmd_activate_all ++ return $?; ++ fi ++ ++ # if either of these fail, script will exit OCF_ERR_GENERIC ++ if ocf_is_true $OCF_RESKEY_with_cmirrord; then ++ start_process $CMIRROR_PATH ++ fi ++ start_process $DAEMON_PATH $CLVMDOPTS ++ ++ # Refresh local cache. ++ # ++ # It's possible that new PVs were added to this, or other VGs ++ # while this node was down. So we run vgscan here to avoid ++ # any potential "Missing UUID" messages with subsequent ++ # LVM commands. ++ ++ # The following step would be better and more informative to the user: ++ # 'action "Refreshing VG(s) local cache:" ${LVM_VGSCAN}' ++ # but it could show warnings such as: ++ # 'clvmd not running on node x-y-z Unable to obtain global lock.' ++ # and the action would be shown as FAILED when in reality it didn't. ++ # Ideally vgscan should have a startup mode that would not print ++ # unnecessary warnings. ++ ++ ${LVM_VGSCAN} > /dev/null 2>&1 ++ touch $LOCK_FILE ++ ++ clvmd_activate_all ++ ++ clvmd_status ++ return $? ++} ++ ++case $__OCF_ACTION in ++ meta-data) meta_data ++ exit $OCF_SUCCESS;; ++ ++ start) clvmd_start;; ++ ++ stop) clvmd_stop;; ++ ++ monitor) clvmd_status;; ++ ++ validate-all) clvmd_validate;; ++ ++ usage|help) clvmd_usage;; ++ ++ *) clvmd_usage ++ exit $OCF_ERR_UNIMPLEMENTED;; ++esac ++ ++rc=$? ++ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc" ++exit $rc ++ +-- +1.8.4.2 + diff --git a/SOURCES/bz917681-slapd-heartbeat-updates.patch b/SOURCES/bz917681-slapd-heartbeat-updates.patch new file mode 100644 index 0000000..a0a2bb3 --- /dev/null +++ b/SOURCES/bz917681-slapd-heartbeat-updates.patch @@ -0,0 +1,23 @@ +diff --git a/heartbeat/slapd b/heartbeat/slapd +index 6661984..ffb40e8 100755 +--- a/heartbeat/slapd ++++ b/heartbeat/slapd +@@ -526,10 +526,14 @@ parameters=$OCF_RESKEY_parameters + pid_file=$OCF_RESKEY_pidfile + + if [ -z "$config" ]; then +- if [ -e "/etc/ldap/slapd.d" ]; then +- config="/etc/ldap/slapd.d" +- else +- config="/etc/ldap/slapd.conf" ++ config_dirname="/etc/ldap" ++ if [ -e "/etc/openldap" ]; then ++ config_dirname="/etc/openldap" ++ fi ++ ++ config="$config_dirname/slapd.conf" ++ if [ -e "$config_dirname/slapd.d" ]; then ++ config="$config_dirname/slapd.d" + fi + fi + diff --git a/SOURCES/bz917681-tomcat-heartbeat-updates.patch b/SOURCES/bz917681-tomcat-heartbeat-updates.patch new file mode 100644 index 0000000..7213568 --- /dev/null +++ b/SOURCES/bz917681-tomcat-heartbeat-updates.patch @@ -0,0 +1,470 @@ +diff --git a/heartbeat/tomcat b/heartbeat/tomcat +index 95cc49e..4fafdaa 100755 +--- a/heartbeat/tomcat ++++ b/heartbeat/tomcat +@@ -33,8 +33,8 @@ + # OCF_RESKEY_java_opts - Options to pass to Java JVM for start and stop. Default is none + # OCF_RESKEY_catalina_home - Home directory of Tomcat. Default is none + # OCF_RESKEY_catalina_base - Base directory of Tomcat. Default is OCF_RESKEY_catalina_home +-# OCF_RESKEY_catalina_out - Log file name of Tomcat. Default is OCF_RESKEY_catalina_home/logs/catalina.out +-# OCF_RESKEY_catalina_pid - A PID file name of Tomcat. Default is OCF_RESKEY_catalina_home/logs/catalina.pid ++# OCF_RESKEY_catalina_out - Log file name of Tomcat. Default is OCF_RESKEY_catalina_base/logs/catalina.out ++# OCF_RESKEY_catalina_pid - A PID file name of Tomcat. Default is OCF_RESKEY_catalina_base/logs/catalina.pid + # OCF_RESKEY_tomcat_start_opts - Start options of Tomcat. Default is none. + # OCF_RESKEY_catalina_opts - CATALINA_OPTS environment variable. Default is none. + # OCF_RESKEY_catalina_tmpdir - CATALINA_TMPDIR environment variable. Default is none. +@@ -86,11 +86,14 @@ isalive_tomcat() + # As the server stops, the PID file disappears. To avoid race conditions, + # we will have remembered the PID of a running instance on script entry. + local pid=$rememberedPID +- # If there is a PID file, use that ++ # If there is a PID file, attempt to use that + if [ -f $CATALINA_PID ]; then ++ local tmp + ocf_log debug "Reading pid from $CATALINA_PID" +- # race conditions on PID file being removed by stopping tomcat... +- pid=`head -n 1 $CATALINA_PID` ++ tmp=`head -n 1 $CATALINA_PID` ++ if [ $? -eq 0 ]; then ++ pid=$tmp ++ fi + fi + if [ -n "$pid" ] && [ "$pid" -gt 0 ]; then + # Retry message for restraint +@@ -103,6 +106,22 @@ isalive_tomcat() + } + + ############################################################################ ++# Check rotatelogs process and restart if it is stopped ++monitor_rotatelogs() ++{ ++ pgrep -f "$ROTATELOGS.*$CATALINA_BASE/logs/catalina_%F.log" > /dev/null 2>&1 ++ if [ $? -ne 0 ]; then ++ ocf_log warn "A rotatelogs command for $CATALINA_BASE/logs/catalina_%F.log is not running. Restarting it." ++ start_rotatelogs ++ if [ $? -eq 0 ]; then ++ ocf_log info "Restart rotatelogs process succeeded." ++ else ++ ocf_log warn "Restart rotatelogs process failed." ++ fi ++ fi ++} ++ ++############################################################################ + # Check tomcat process and service availability + monitor_tomcat() + { +@@ -110,32 +129,51 @@ monitor_tomcat() + return $OCF_NOT_RUNNING + isrunning_tomcat || + return $OCF_ERR_GENERIC ++ if ocf_is_true ${CATALINA_ROTATE_LOG}; then ++ # Monitor rotatelogs process and restart it if it is stopped. ++ # And never consider rotatelogs process failure to be a monitor failure ++ # as long as Tomcat process works fine. ++ monitor_rotatelogs ++ fi + return $OCF_SUCCESS + } + + ############################################################################ ++# Startup rotatelogs process ++start_rotatelogs() ++{ ++ # -s is required because tomcat5.5's login shell is /bin/false ++ su - -s /bin/sh $RESOURCE_TOMCAT_USER \ ++ -c "$ROTATELOGS -l \"$CATALINA_BASE/logs/catalina_%F.log\" $CATALINA_ROTATETIME" \ ++ < "$CATALINA_OUT" > /dev/null 2>&1 & ++} ++ ++############################################################################ + # Execute catalina.out log rotation + rotate_catalina_out() + { +- # Look for rotatelogs/rotatelogs2 +- if [ -x /usr/sbin/rotatelogs ]; then +- ROTATELOGS=/usr/sbin/rotatelogs +- elif [ -x /usr/sbin/rotatelogs2 ]; then +- ROTATELOGS=/usr/sbin/rotatelogs2 +- else +- ocf_log warn "rotatelogs command not found." +- return 1 ++ # Check catalina_%F.log is writable or not. ++ CURRENT_ROTATELOG_SUFFIX=`date +"%F"` ++ su - -s /bin/sh $RESOURCE_TOMCAT_USER \ ++ -c "touch \"$CATALINA_BASE/logs/catalina_$CURRENT_ROTATELOG_SUFFIX.log\"" > /dev/null 2>&1 ++ if [ $? -ne 0 ]; then ++ ocf_log err "$CATALINA_BASE/logs/catalina_$CURRENT_ROTATELOG_SUFFIX.log is not writable." ++ return $OCF_ERR_GENERIC + fi + + # Clean up and set permissions on required files +- rm -rf "$CATALINA_HOME"/temp/* "$CATALINA_OUT" ++ rm -rf "$CATALINA_BASE"/temp/* ++ if [ -p "$CATALINA_OUT" ]; then ++ rm -f "$CATALINA_OUT" ++ elif [ -e "$CATALINA_OUT" ]; then ++ DATE=`date +"%F-%H%M%S"` ++ ocf_log warn "$CATALINA_OUT already exists. It is saved as $CATALINA_OUT-$DATE" ++ mv "$CATALINA_OUT" "$CATALINA_OUT-$DATE" ++ fi + mkfifo -m700 "$CATALINA_OUT" + chown --dereference "$RESOURCE_TOMCAT_USER" "$CATALINA_OUT" || true + +- # -s is required because tomcat5.5's login shell is /bin/false +- su - -s /bin/sh $RESOURCE_TOMCAT_USER \ +- -c "$ROTATELOGS -l \"$CATALINA_HOME/logs/catalina_%F.log\" $CATALINA_ROTATETIME" \ +- < "$CATALINA_OUT" > /dev/null 2>&1 & ++ start_rotatelogs + } + + ############################################################################ +@@ -154,16 +192,25 @@ cat<<-END_TOMCAT_COMMAND + export JAVA_ENDORSED_DIRS="${JAVA_ENDORSED_DIRS}" + export LOGGING_CONFIG="${LOGGING_CONFIG}" + export LOGGING_MANAGER="${LOGGING_MANAGER}" +- $CATALINA_HOME/bin/catalina.sh $@ ++ export TOMCAT_CFG=${TOMCAT_CFG} ++ $TOMCAT_START_SCRIPT $@ + END_TOMCAT_COMMAND + } + attemptTomcatCommand() + { +- if [ "$RESOURCE_TOMCAT_USER" = RUNASIS ]; then +- "$CATALINA_HOME/bin/catalina.sh" $@ >> "$TOMCAT_CONSOLE" 2>&1 ++ if [ -n "$REDIRECT_DEFAULT_CONFIG" ]; then ++ export TOMCAT_CFG=$(mktemp ${HA_RSCTMP}/tomcat-tmp-XXXXX.cfg) ++ fi ++ ++ if [ "$RESOURCE_TOMCAT_USER" = root ]; then ++ "$TOMCAT_START_SCRIPT" $@ >> "$TOMCAT_CONSOLE" 2>&1 + else + tomcatCommand $@ | su - -s /bin/sh "$RESOURCE_TOMCAT_USER" >> "$TOMCAT_CONSOLE" 2>&1 + fi ++ ++ if [ -n "$REDIRECT_DEFAULT_CONFIG" ]; then ++ rm -f "$TOMCAT_CFG" ++ fi + } + + ############################################################################ +@@ -175,7 +222,7 @@ start_tomcat() + validate_all_tomcat || exit $? + + monitor_tomcat +- if [ $? = $OCF_SUCCESS ]; then ++ if [ $? -eq $OCF_SUCCESS ]; then + return $OCF_SUCCESS + fi + +@@ -183,12 +230,13 @@ start_tomcat() + rm -f $CATALINA_PID + + #ocf_log debug "catalina.out rotation FLG = ${CATALINA_ROTATE_LOG}" +- if [ ${CATALINA_ROTATE_LOG} = "YES" ]; then ++ if ocf_is_true ${CATALINA_ROTATE_LOG}; then + rotate_catalina_out +- if [ $? = 0 ]; then ++ if [ $? -eq 0 ]; then + ocf_log debug "Rotate catalina.out succeeded." + else +- ocf_log warn "Rotate catalina.out failed. Starting tomcat without catalina.out rotation." ++ ocf_log err "Rotate catalina.out failed. Avoid starting tomcat without catalina.out rotation." ++ return $OCF_ERR_GENERIC + fi + fi + +@@ -199,7 +247,7 @@ start_tomcat() + + while true; do + monitor_tomcat +- if [ $? = $OCF_SUCCESS ]; then ++ if [ $? -eq $OCF_SUCCESS ]; then + break + fi + ocf_log debug "start_tomcat[$TOMCAT_NAME]: retry monitor_tomcat" +@@ -213,7 +261,14 @@ start_tomcat() + # Stop Tomcat + stop_tomcat() + { +- RA_TIMEOUT=$((OCF_RESKEY_CRM_meta_timeout/1000)) ++ local stop_time ++ local RA_TIMEOUT=20 ++ local TOMCAT_STOP_OPTS="" ++ ++ if [ -n $OCF_RESKEY_CRM_meta_timeout ]; then ++ RA_TIMEOUT=$((OCF_RESKEY_CRM_meta_timeout/1000)) ++ fi ++ + STOP_TIMEOUT=$((RA_TIMEOUT-5)) + if [ -n "$MAX_STOP_TIME" ]; then + if [ $MAX_STOP_TIME -gt $RA_TIMEOUT ]; then +@@ -232,17 +287,23 @@ stop_tomcat() + + echo "`date "+%Y/%m/%d %T"`: stop ###########################" >> "$TOMCAT_CONSOLE" + +- attemptTomcatCommand stop $STOP_TIMEOUT -force ++ if [ "$TOMCAT_START_SCRIPT" = "$CATALINA_HOME/bin/catalina.sh" ]; then ++ TOMCAT_STOP_OPTS="$STOP_TIMEOUT --force" ++ fi ++ stop_time=$(date +%s) ++ attemptTomcatCommand stop $TOMCAT_STOP_OPTS + + lapse_sec=0 + while isalive_tomcat; do + sleep 1 +- lapse_sec=`expr $lapse_sec + 1` +- ocf_log debug "stop_tomcat[$TOMCAT_NAME]: stop failed, killing with SIGKILL ($lapse_sec)" +- kill -KILL $rememberedPID ++ lapse_sec=`expr $(date +%s) - $stop_time` ++ if [ $lapse_sec -ge $STOP_TIMEOUT ]; then ++ ocf_log debug "stop_tomcat[$TOMCAT_NAME]: stop failed, killing with SIGKILL ($lapse_sec)" ++ kill -s KILL $rememberedPID > /dev/null 2>&1 ++ fi + done + +- if [ ${CATALINA_ROTATE_LOG} = "YES" ]; then ++ if ocf_is_true ${CATALINA_ROTATE_LOG}; then + rm -f "$CATALINA_PID" "${CATALINA_OUT}" + else + rm -f "$CATALINA_PID" +@@ -305,7 +366,7 @@ and killing Tomcat. DEPRECATED. Does not retry. + The user who starts Tomcat. + + The user who starts Tomcat +- ++ + + + +@@ -345,7 +406,7 @@ Java JVM options used on start and stop. + + + +- ++ + + Home directory of Tomcat. + +@@ -365,7 +426,7 @@ Instance directory of Tomcat + + Log file name of Tomcat + +-Log file name of Tomcat, defaults to catalina_home/logs/catalina.out ++Log file name of Tomcat, defaults to catalina_base/logs/catalina.out + + + +@@ -377,6 +438,14 @@ A PID file name for Tomcat. + + + ++ ++ ++Absolute path to the custom tomcat start script to use. ++ ++Tomcat start script location ++ ++ ++ + + + Tomcat start options. +@@ -406,7 +475,7 @@ Temporary directory of Tomcat + Rotate catalina.out flag. + + Rotate catalina.out flag +- ++ + + + +@@ -458,46 +527,42 @@ END + + validate_all_tomcat() + { ++ local port ++ local rc=$OCF_SUCCESS + ocf_log info "validate_all_tomcat[$TOMCAT_NAME]" + +- misconfigured=0 +- notinstalled=0 +- wrongpermissions=0 +- + check_binary $WGET + ++ if [ -z "${TOMCAT_START_SCRIPT}" ]; then ++ ocf_log err "No default tomcat start script detected. Please specify start script location using the 'tomcat_start_script' option" ++ rc=$OCF_ERR_CONFIGURED ++ fi ++ + if [ -n "$MAX_STOP_TIME" ] && [ "$MAX_STOP_TIME" -lt 0 ]; then + ocf_log err "max_stop_time must be set to a value greater than 0." +- misconfigured=1 ++ rc=$OCF_ERR_CONFIGURED + fi + +- if [[ "$RESOURCE_STATUSURL" =~ :[0-9][0-9]* ]]; then ++ if echo "$RESOURCE_STATUSURL" | grep -q ":[0-9][0-9]*" ; then + port=${RESOURCE_STATUSURL##*:} + port=${port%%/*} + ocf_log debug "Tomcat port is $port" +- ocf_log debug "grep port=\"$port\" $CATALINA_HOME/conf/server.xml" +- if [ "$port" -gt 0 ]; then +- grep "port=\"$port\"" $CATALINA_HOME/conf/server.xml > /dev/null 2>&1 +- if [ $? -ne 0 ]; then +- ocf_log err "Your configured status URL specifies a port ($port), but the server does not have a connector listening to that port in $CATALINA_HOME/conf/server.xml" +- notinstalled=1 +- fi ++ ocf_log debug "grep port=\"$port\" $CATALINA_BASE/conf/server.xml" ++ grep "port=\"$port\"" $CATALINA_BASE/conf/server.xml > /dev/null 2>&1 ++ if [ $? -ne 0 ]; then ++ ocf_log err "Your configured status URL specifies a port ($port), but the server does not have a connector listening to that port in $CATALINA_BASE/conf/server.xml" ++ rc=$OCF_ERR_INSTALLED + fi + fi + +- if [ $misconfigured -gt 0 ]; then +- return $OCF_ERR_CONFIGURED +- fi +- +- if [ $notinstalled -gt 0 ]; then +- return $OCF_ERR_INSTALLED +- fi +- +- if [ $wrongpermissions -gt 0 ]; then +- return $OCF_ERR_PERM ++ if ocf_is_true ${CATALINA_ROTATE_LOG}; then ++ if [ ! -x "$ROTATELOGS" ]; then ++ ocf_log err "rotatelogs command does not exist." ++ rc=$OCF_ERR_INSTALLED ++ fi + fi + +- return $OCF_SUCCESS ++ return $rc + } + + # As we stop tomcat, it removes it's own pid file...we still want to know what it was +@@ -515,18 +580,28 @@ memorize_pid() + COMMAND=$1 + TOMCAT_NAME="${OCF_RESKEY_tomcat_name-tomcat}" + TOMCAT_CONSOLE="${OCF_RESKEY_script_log-/var/log/$TOMCAT_NAME.log}" +-RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-RUNASIS}" ++RESOURCE_TOMCAT_USER="${OCF_RESKEY_tomcat_user-root}" + RESOURCE_STATUSURL="${OCF_RESKEY_statusurl-http://127.0.0.1:8080}" + + JAVA_HOME="${OCF_RESKEY_java_home}" + JAVA_OPTS="${OCF_RESKEY_java_opts}" + CATALINA_HOME="${OCF_RESKEY_catalina_home}" + CATALINA_BASE="${OCF_RESKEY_catalina_base-${OCF_RESKEY_catalina_home}}" +-CATALINA_OUT="${OCF_RESKEY_catalina_out-$CATALINA_HOME/logs/catalina.out}" +-CATALINA_PID="${OCF_RESKEY_catalina_pid-$CATALINA_HOME/logs/catalina.pid}" ++CATALINA_OUT="${OCF_RESKEY_catalina_out-$CATALINA_BASE/logs/catalina.out}" ++ ++CATALINA_PID=$OCF_RESKEY_catalina_pid ++if [ -z "$CATALINA_PID" ]; then ++ mkdir -p "${HA_RSCTMP}/${TOMCAT_NAME}_tomcatstate/" ++ if [ "${RESOURCE_TOMCAT_USER}" != "root" ]; then ++ chown ${RESOURCE_TOMCAT_USER} "${HA_RSCTMP}/${TOMCAT_NAME}_tomcatstate/" ++ fi ++ CATALINA_PID="${HA_RSCTMP}/${TOMCAT_NAME}_tomcatstate/catalina.pid" ++fi ++ + MAX_STOP_TIME="${OCF_RESKEY_max_stop_time}" + + TOMCAT_START_OPTS="${OCF_RESKEY_tomcat_start_opts}" ++TOMCAT_START_SCRIPT="${OCF_RESKEY_tomcat_start_script}" + CATALINA_OPTS="-Dname=$TOMCAT_NAME ${OCF_RESKEY_catalina_opts}" + CATALINA_TMPDIR="${OCF_RESKEY_catalina_tmpdir}" + CATALINA_ROTATE_LOG="${OCF_RESKEY_catalina_rotate_log-NO}" +@@ -545,6 +620,15 @@ case "$COMMAND" in + help|usage) usage; exit $OCF_SUCCESS;; + esac + ++if [ -z "${TOMCAT_START_SCRIPT}" ]; then ++ if [ -e "$CATALINA_HOME/bin/catalina.sh" ]; then ++ TOMCAT_START_SCRIPT="$CATALINA_HOME/bin/catalina.sh" ++ elif [ -e "/usr/sbin/tomcat" ]; then ++ REDIRECT_DEFAULT_CONFIG=1 ++ TOMCAT_START_SCRIPT="/usr/sbin/tomcat" ++ fi ++fi ++ + if [ ! -d "$JAVA_HOME" -o ! -d "$CATALINA_HOME" -o ! -d "$CATALINA_BASE" ]; then + case $COMMAND in + stop) exit $OCF_SUCCESS;; +@@ -569,6 +653,16 @@ if [ ! -x "$JAVA" ]; then + exit $OCF_ERR_INSTALLED + fi + ++ROTATELOGS="" ++if ocf_is_true ${CATALINA_ROTATE_LOG}; then ++ # Look for rotatelogs/rotatelogs2 ++ if [ -x /usr/sbin/rotatelogs ]; then ++ ROTATELOGS=/usr/sbin/rotatelogs ++ elif [ -x /usr/sbin/rotatelogs2 ]; then ++ ROTATELOGS=/usr/sbin/rotatelogs2 ++ fi ++fi ++ + # + # ------------------ + # the main script +diff --git a/tools/ocft/fedora/tomcat b/tools/ocft/fedora/tomcat +index 7b1283e..4226329 100644 +--- a/tools/ocft/fedora/tomcat ++++ b/tools/ocft/fedora/tomcat +@@ -13,11 +13,13 @@ CONFIG + VARIABLE + # Adjust accrding to your configuration + catalina_home=/usr/share/tomcat +- java_home=/usr/lib/jvm/jre-openjdk ++ java_home=/usr/lib/jvm/jre ++ tomcat_user=tomcat + + CASE-BLOCK required_args_tomcat + Env OCF_RESKEY_catalina_home=${catalina_home} + Env OCF_RESKEY_java_home=${java_home} ++ Env OCF_RESKEY_tomcat_user=${tomcat_user} + + CASE-BLOCK args_clear + Unenv OCF_RESKEY_catalina_home +@@ -33,22 +35,22 @@ CASE-BLOCK prepare_tomcat + + # Test CASE + # +-#CASE "normal start tomcat require_args (user:user)" +-# Include prepare_tomcat +-# AgentRun start OCF_SUCCESS +-# AgentRun monitor OCF_SUCCESS +-# AgentRun stop OCF_SUCCESS +-# AgentRun monitor OCF_NOT_RUNNING +-# Include args_clear ++CASE "normal start tomcat require_args (user:user)" ++ Include prepare_tomcat ++ AgentRun start OCF_SUCCESS ++ AgentRun monitor OCF_SUCCESS ++ AgentRun stop OCF_SUCCESS ++ AgentRun monitor OCF_NOT_RUNNING ++ Include args_clear + +-#CASE "normal start tomcat require_args (user:root)" +-# Include prepare_tomcat +-# Unenv OCF_RESKEY_tomcat_user +-# AgentRun start OCF_SUCCESS +-# AgentRun monitor OCF_SUCCESS +-# AgentRun stop OCF_SUCCESS +-# AgentRun monitor OCF_NOT_RUNNING +-# Include args_clear ++CASE "normal start tomcat require_args (user:root)" ++ Include prepare_tomcat ++ Unenv OCF_RESKEY_tomcat_user ++ AgentRun start OCF_SUCCESS ++ AgentRun monitor OCF_SUCCESS ++ AgentRun stop OCF_SUCCESS ++ AgentRun monitor OCF_NOT_RUNNING ++ Include args_clear + + CASE "error start tomcat no catalina_home" + Include prepare_tomcat diff --git a/SPECS/resource-agents.spec b/SPECS/resource-agents.spec index 26638fe..77570bd 100644 --- a/SPECS/resource-agents.spec +++ b/SPECS/resource-agents.spec @@ -32,7 +32,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 3.9.5 -Release: 18%{?dist} +Release: 26%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} @@ -55,6 +55,14 @@ Patch10: bz917681-VirtualDomain-heartbeat-updates_v2.patch Patch11: bz1016140-start-predefined-domains.patch Patch12: bz917681-ipv6-send_ua-fix.patch Patch13: bz917681-ocft_fedora_supported_test_cases.patch +Patch14: bz1033016-nfsserver-missing-etab.patch +Patch15: bz917681-slapd-heartbeat-updates.patch +Patch16: bz917681-tomcat-heartbeat-updates.patch +Patch17: bz1029061-virtualdomain-parse-error.patch +Patch18: bz1064512-clvmd-agent.patch +Patch19: bz1060367-vm-monitor-wo-libvirtd.patch +Patch20: bz1060367-vm-monitor-wo-libvirtd_2.patch + Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} @@ -108,6 +116,8 @@ Requires: /usr/sbin/rpc.nfsd /sbin/rpc.statd /usr/sbin/rpc.mountd %if %{with linuxha} # tools needed for Filesystem resource Requires: psmisc +# Tools needed for clvm resource. +Requires: procps-ng %endif %description @@ -151,6 +161,13 @@ exit 1 %patch11 -p1 %patch12 -p1 -b .bz917681.1 %patch13 -p1 -b .bz917681.1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 %build if [ ! -f configure ]; then @@ -177,6 +194,8 @@ CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}" export CFLAGS +chmod 755 heartbeat/clvm + %configure \ %{conf_opt_fatal} \ --with-pkg-name=%{name} \ @@ -265,7 +284,6 @@ rm -rf %{buildroot} %exclude /usr/lib/ocf/resource.d/heartbeat/AoEtarget %exclude /usr/lib/ocf/resource.d/heartbeat/AudibleAlarm %exclude /usr/lib/ocf/resource.d/heartbeat/ClusterMon -%exclude /usr/lib/ocf/resource.d/heartbeat/Delay %exclude /usr/lib/ocf/resource.d/heartbeat/EvmsSCC %exclude /usr/lib/ocf/resource.d/heartbeat/Evmsd %exclude /usr/lib/ocf/resource.d/heartbeat/ICP @@ -313,7 +331,6 @@ rm -rf %{buildroot} %exclude %{_mandir}/man7/ocf_heartbeat_AoEtarget.7.gz %exclude %{_mandir}/man7/ocf_heartbeat_AudibleAlarm.7.gz %exclude %{_mandir}/man7/ocf_heartbeat_ClusterMon.7.gz -%exclude %{_mandir}/man7/ocf_heartbeat_Delay.7.gz %exclude %{_mandir}/man7/ocf_heartbeat_EvmsSCC.7.gz %exclude %{_mandir}/man7/ocf_heartbeat_Evmsd.7.gz %exclude %{_mandir}/man7/ocf_heartbeat_ICP.7.gz @@ -392,6 +409,52 @@ ccs_update_schema > /dev/null 2>&1 ||: %{_mandir}/man7/*SAP* %changelog +* Tue Mar 18 2014 David Vossel - 3.9.5-26 +- Handle monitor qemu based VirtualDomain resources without + requiring libvirtd even if configuration file does not + contain an 'emulator' value pointing to the emulator binary. + + Resolves: rhbz#1060367 + +* Fri Feb 14 2014 David Vossel - 3.9.5-25 +- Rename clvmd agent to clvm to avoid problems associated + with having a resource-agent named the same exact name + as the binary the agent manages. + + Resolves: rhbz#1064512 + +* Fri Feb 14 2014 David Vossel - 3.9.5-24 +- Addition of the clvmd resource-agent +- Support monitoring qemu based VirtualDomain resources without + requiring libvirtd to be running. + + Resolves: rhbz#1064512 + Resolves: rhbz#1060367 + +* Fri Jan 24 2014 Daniel Mach - 3.9.5-23 +- Mass rebuild 2014-01-24 + +* Mon Jan 20 2014 David Vossel - 3.9.5-22 +- Fixes VirtualDomain config parse error. + + Resolves: rhbz#1029061 + +* Fri Dec 27 2013 Daniel Mach - 3.9.5-21 +- Mass rebuild 2013-12-27 + +* Tue Nov 26 2013 David Vossel - 3.9.5-20 +- tomcat agent updates for pacemaker support +- slapd agent updates for pacemaker support +- Fixes missing etab file required for nfsserver + + Resolves: rhbz#1033016 + Resolves: rhbz#917681 + +* Wed Nov 20 2013 David Vossel - 3.9.5-19 +- Add back the Delay agent. + + Resolves: rhbz#917681 + * Thu Nov 07 2013 David Vossel - 3.9.5-18 - Remove support for (nginx, mysql-proxy, rsyslog). nginx and mysql-proxy are not a supported projects. Rsyslog is not an