resource-agents/nfsnotify.patch

96 lines
3.3 KiB
Diff

--- heartbeat/nfsnotify.in.orig 2021-12-06 11:36:48.000000000 +0100
+++ heartbeat/nfsnotify.in 2022-01-19 15:14:17.424694351 +0100
@@ -34,9 +34,11 @@
OCF_RESKEY_source_host_default=""
OCF_RESKEY_notify_args_default=""
+OCF_RESKEY_statd_path_default="/var/lib/nfs/statd"
: ${OCF_RESKEY_source_host=${OCF_RESKEY_source_host_default}}
: ${OCF_RESKEY_notify_args=${OCF_RESKEY_notify_args_default}}
+: ${OCF_RESKEY_statd_path=${OCF_RESKEY_statd_path_default}}
#######################################################################
@@ -50,7 +52,6 @@
NFSNOTIFY_TMP_DIR="${HA_RSCTMP}/nfsnotify_${OCF_RESOURCE_INSTANCE}/"
HA_STATD_PIDFILE="$NFSNOTIFY_TMP_DIR/rpc.statd_${OCF_RESOURCE_INSTANCE}.pid"
HA_STATD_PIDFILE_PREV="$NFSNOTIFY_TMP_DIR/rpc.statd_${OCF_RESOURCE_INSTANCE}.pid.prev"
-STATD_PATH="/var/lib/nfs/statd"
SM_NOTIFY_BINARY="${sbindir}/sm-notify"
IS_RENOTIFY=0
@@ -78,6 +79,15 @@
<content type="string" default="${OCF_RESKEY_source_host_default}" />
</parameter>
+<parameter name="statd_path" unique="0" required="0">
+<longdesc lang="en">
+Path to the directory in which the statd state lives. This needs
+to be on shared storage.
+</longdesc>
+<shortdesc lang="en">statd state directory path</shortdesc>
+<content type="string" default="${OCF_RESKEY_statd_path_default}" />
+</parameter>
+
<parameter name="notify_args" unique="0" required="0">
<longdesc lang="en">
Additional arguments to send to the sm-notify command. By default
@@ -91,6 +101,15 @@
<content type="string" default="${OCF_RESKEY_notify_args_default}" />
</parameter>
+<parameter name="statd_path" unique="0" required="0">
+<longdesc lang="en">
+Path to the directory in which the statd state lives. This needs
+to be on shared storage.
+</longdesc>
+<shortdesc lang="en">statd state directory path</shortdesc>
+<content type="string" default="${OCF_RESKEY_statd_path_default}" />
+</parameter>
+
</parameters>
<actions>
@@ -246,12 +265,12 @@
is_renotify=1
fi
- statd_backup="$STATD_PATH/nfsnotify.bu"
- copy_statd "$STATD_PATH" "$statd_backup"
+ statd_backup="$OCF_RESKEY_statd_path/nfsnotify.bu"
+ copy_statd "$OCF_RESKEY_statd_path" "$statd_backup"
if [ -z "$OCF_RESKEY_source_host" ]; then
if [ "$is_renotify" -eq 0 ]; then
- cur_statd="$STATD_PATH"
+ cur_statd="$OCF_RESKEY_statd_path"
else
cur_statd="$statd_backup"
fi
@@ -271,13 +290,13 @@
# have the first sm-notify use the actual statd directory so the
# notify list can be managed properly.
if [ "$is_renotify" -eq 0 ]; then
- cur_statd="$STATD_PATH"
+ cur_statd="$OCF_RESKEY_statd_path"
# everything after the first notify we are considering a renotification
# which means we don't use the real statd directory.
is_renotify=1
else
# use our copied statd directory for the remaining ip addresses
- cur_statd="$STATD_PATH/nfsnotify_${OCF_RESOURCE_INSTANCE}_${ip}"
+ cur_statd="$OCF_RESKEY_statd_path/nfsnotify_${OCF_RESOURCE_INSTANCE}_${ip}"
copy_statd "$statd_backup" "$cur_statd"
fi
@@ -312,7 +331,7 @@
which restorecon > /dev/null 2>&1 && selinuxenabled
SELINUX_ENABLED=$?
if [ $SELINUX_ENABLED -eq 0 ]; then
- export SELINUX_LABEL="$(ls -dZ $STATD_PATH | grep -o '\S\+:\S\+:\S\+')"
+ export SELINUX_LABEL="$(ls -dZ $OCF_RESKEY_statd_path | grep -o '\S\+:\S\+:\S\+')"
fi
case $__OCF_ACTION in