Permalink
Browse files

High: set the HA_RSCTMP directory to /var/run/resource-agents (lf#2378)

The HA_RSCTMP directory should be cleaned up on reboots. This is
automatically done for directories under /var/run. Heartbeat used
to cleanup this directory on every start, but that is wrong in
case resources are in the unmanaged mode. Corosync/Openais never
cleaned up this directory.

Several resource agents used to create their own subdirectories.
That's not an option anymore because only first level
subdirectories of /var/run are cleaned.

IPv6addr is modified to use the new temporary directory.

There is now agent_config.h which may be included by other
packages.

The temporary directory is created with permissions 1755. In case
a resource agents wants to manage a file there but runs as
non-root, the permissions will have to change to 1777.
  • Loading branch information...
1 parent 99a62f2 commit e591c950c8f22873d28bb75bc20436b168040535 @kskmori kskmori committed May 6, 2010
View
@@ -19,7 +19,10 @@
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure DRF/config-h.in \
DRF/stamp-h.in libtool.m4 ltdl.m4 libltdl.tar
-SUBDIRS = heartbeat tools ldirectord doc
+SUBDIRS = include heartbeat tools ldirectord doc
+
+install-exec-local:
+ $(INSTALL) -d -m 1755 $(DESTDIR)$(HA_RSCTMPDIR)
dist-clean-local:
rm -f autoconf automake autoheader $(TARFILE)
View
@@ -129,6 +129,11 @@ AC_ARG_WITH(ocf-root,
[ --with-ocf-root=DIR directory for OCF scripts [${OCF_ROOT_DIR}]],
[ if test x"$withval" = xprefix; then OCF_ROOT_DIR=${prefix}; else
OCF_ROOT_DIR="$withval"; fi ])
+HA_RSCTMPDIR=${localstatedir}/run/resource-agents
+AC_ARG_WITH(rsctmpdir,
+ [ --with-rsctmpdir=DIR directory for resource agents state files [${HA_RSCTMPDIR}]],
+ [ if test x"$withval" = xprefix; then HA_RSCTMPDIR=${prefix}; else
+ HA_RSCTMPDIR="$withval"; fi ])
AC_ARG_ENABLE([libnet],
[ --enable-libnet Use libnet for ARP based funcationality, [default=try]],
@@ -314,6 +319,11 @@ AC_DEFINE_UNQUOTED(HA_VARRUNDIR,"$GLUE_STATE_DIR", Where Heartbeat keeps state f
HA_VARRUNDIR="$GLUE_STATE_DIR"
AC_SUBST(HA_VARRUNDIR)
+# Expand $prefix
+eval HA_RSCTMPDIR="`eval echo ${HA_RSCTMPDIR}`"
+AC_DEFINE_UNQUOTED(HA_RSCTMPDIR,"$HA_RSCTMPDIR", Where Resouce agents keep state files)
+AC_SUBST(HA_RSCTMPDIR)
+
dnl Eventually move out of the heartbeat dir tree and create symlinks when needed
HA_VARLIBHBDIR=${localstatedir}/lib/heartbeat
AC_DEFINE_UNQUOTED(HA_VARLIBHBDIR,"$HA_VARLIBHBDIR", Whatever this used to mean)
@@ -744,6 +754,7 @@ AC_SUBST(MAKE)
dnl The Makefiles and shell scripts we output
AC_CONFIG_FILES(Makefile \
+include/Makefile \
heartbeat/Makefile \
heartbeat/.ocf-binaries \
heartbeat/.ocf-directories \
@@ -792,6 +803,7 @@ AC_MSG_RESULT([ Arch-independent files = ${datadir}])
AC_MSG_RESULT([ Documentation = ${docdir}])
AC_MSG_RESULT([ State information = ${localstatedir}])
AC_MSG_RESULT([ System configuration = ${sysconfdir}])
+AC_MSG_RESULT([ RA state files = ${HA_RSCTMPDIR}])
AC_MSG_RESULT([ AIS Plugins = ${LCRSODIR}])
AC_MSG_RESULT([])
AC_MSG_RESULT([ CFLAGS = ${CFLAGS}])
@@ -8,7 +8,8 @@ exec_prefix=@exec_prefix@
: ${HA_CONFDIR=$HA_DIR/conf}
: ${HA_CF:=$HA_DIR/ha.cf}
: ${HA_VARLIB:=@localstatedir@/lib/heartbeat}
-: ${HA_RSCTMP:=@HA_VARRUNDIR@/heartbeat/rsctmp}
+: ${HA_RSCTMP:=@HA_RSCTMPDIR@}
+: ${HA_RSCTMP_OLD:=@HA_VARRUNDIR@/heartbeat/rsctmp}
: ${HA_FIFO:=@localstatedir@/lib/heartbeat/fifo}
: ${HA_BIN:=@libdir@/heartbeat}
: ${HA_SBIN_DIR:=@sbindir@}
View
@@ -34,8 +34,8 @@
SENDARP=$HA_BIN/send_arp
FINDIF=$HA_BIN/findif
-VLDIR=$HA_RSCTMP/IPaddr
-SENDARPPIDDIR=$HA_RSCTMP/send_arp
+VLDIR=$HA_RSCTMP
+SENDARPPIDDIR=$HA_RSCTMP
SENDARPPIDFILE="$SENDARPPIDDIR/send_arp-$OCF_RESKEY_ip"
USAGE="usage: $0 {start|stop|status|monitor|validate-all|meta-data}";
@@ -423,7 +423,7 @@ find_free_interface() {
return $OCF_ERR_GENERIC;
fi
- NICBASE="$VLDIR/$NIC"
+ NICBASE="$VLDIR/IPaddr-$NIC"
touch "$NICBASE"
case "$SYSTYPE" in
@@ -594,7 +594,7 @@ ip_stop() {
fi
# remove lock file...
- rm -f "$VLDIR/$NIC"
+ rm -f "$VLDIR/IPaddr-$NIC"
if [ $rc != 0 ]; then
ocf_log warn "IP Address $OCF_RESKEY_ip NOT released: rc=$rc"
@@ -759,15 +759,6 @@ ip_validate_all() {
check_binary $ROUTE
check_binary $PING
- if
- [ -d "$VLDIR/" ] || mkdir -p "$VLDIR/"
- then
- : Directory $VLDIR now exists
- else
- ocf_log err "Could not create \"$VLDIR/\"."
- return $OCF_ERR_GENERIC
- fi
-
if is_positive_integer $OCF_RESKEY_ARP_INTERVAL_MS
then
ocf_log err "Invalid parameter value: ARP_INTERVAL_MS [$OCF_RESKEY_ARP_INTERVAL_MS]"
View
@@ -69,8 +69,8 @@
SENDARP=$HA_BIN/send_arp
FINDIF=$HA_BIN/findif
-VLDIR=$HA_RSCTMP/IPaddr
-SENDARPPIDDIR=$HA_RSCTMP/send_arp
+VLDIR=$HA_RSCTMP
+SENDARPPIDDIR=$HA_RSCTMP
CIP_lockfile=$HA_RSCTMP/IPaddr2-CIP-${OCF_RESKEY_ip}
#######################################################################
@@ -454,12 +454,6 @@ remove_conflicting_loopback() {
ifname="$4"
ocf_log info "Removing conflicting loopback $ifname."
- if [ -d "$VLDIR/" ] || mkdir -p "$VLDIR/"; then
- : Directory $VLDIR now exists
- else
- ocf_log err "Could not create \"$VLDIR/\" conflicting" \
- " loopback $ifname cannot be restored."
- fi
if
echo "$ipaddr $netmask $broadcast $ifname" > "$VLDIR/$ipaddr"
then
View
@@ -96,7 +96,7 @@
#include <libnet.h>
-#define PIDFILE_BASE HA_VARRUNDIR "/IPv6addr-"
+#define PIDFILE_BASE HA_RSCTMPDIR "/IPv6addr-"
/*
0 No error, action succeeded completely
View
@@ -51,8 +51,7 @@
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
SENDARP=$HA_BIN/send_arp
-VLDIR=${HA_RSCTMP}/IPaddr
-SENDARPPIDDIR=${HA_RSCTMP}/send_arp
+SENDARPPIDDIR=${HA_RSCTMP}
BASEIP="$OCF_RESKEY_ip"
INTERFACE="$OCF_RESKEY_nic"
View
@@ -26,8 +26,7 @@
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/resource.d/heartbeat}
. ${OCF_FUNCTIONS_DIR}/.ocf-shellfuncs
-VLDIR=$HA_RSCTMP/VIPArip
-RIPDCONF=$VLDIR/ripd.conf
+RIPDCONF=$HA_RSCTMP/VIPArip-ripd.conf
ZEBRA=/usr/sbin/zebra
RIPD=/usr/sbin/ripd
USAGE="usage: $0 {start|stop|status|monitor|validate-all|meta-data}";
@@ -202,13 +201,6 @@ stop_quagga() {
start_rip_ip() {
echo start_rip_ip
check_params
- if [ -d "$VLDIR/" ] || mkdir -p "$VLDIR/"
- then
- : Directory $VLDIR now exists
- else
- ocf_log err "Could not create \"$VLDIR/\"."
- exit $OCF_ERR_GENERIC
- fi
if [ x"$OCF_RESKEY_nic" = x ]
then
View
@@ -0,0 +1,24 @@
+#
+# 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
+
+idir=$(includedir)/heartbeat
+i_HEADERS = agent_config.h
+
+noinst_HEADERS = config.h
@@ -0,0 +1,2 @@
+/* Where Resouce agents keep state files */
+#undef HA_RSCTMPDIR
View
@@ -187,6 +187,8 @@ rm -rf $RPM_BUILD_DIR/resource-agents
%{_sbindir}/ocf-tester
%{_sbindir}/ocft
%{_sbindir}/sfex_init
+%{_includedir}/heartbeat
+%dir %attr (1755, root, root) %{_var}/run/resource-agents
%doc AUTHORS
%doc COPYING

0 comments on commit e591c95

Please sign in to comment.