|
|
05afe3 |
From d4c9de6264251e4dbc91b64aaf7f500919d08d60 Mon Sep 17 00:00:00 2001
|
|
|
05afe3 |
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
|
|
05afe3 |
Date: Fri, 17 Aug 2018 12:48:46 +0200
|
|
|
05afe3 |
Subject: [PATCH] lvmlockd: add cmirrord support
|
|
|
05afe3 |
|
|
|
05afe3 |
---
|
|
|
05afe3 |
heartbeat/lvmlockd | 53 ++++++++++++++++++++++++++++++++++++++++++----
|
|
|
05afe3 |
1 file changed, 49 insertions(+), 4 deletions(-)
|
|
|
05afe3 |
|
|
|
05afe3 |
diff --git a/heartbeat/lvmlockd b/heartbeat/lvmlockd
|
|
|
05afe3 |
index 7fe73e364..57f7fdc76 100755
|
|
|
05afe3 |
--- a/heartbeat/lvmlockd
|
|
|
05afe3 |
+++ b/heartbeat/lvmlockd
|
|
|
05afe3 |
@@ -59,6 +59,14 @@ For more information, refer to manpage lvmlockd.8.
|
|
|
05afe3 |
<shortdesc lang="en">This agent manages the lvmlockd daemon</shortdesc>
|
|
|
05afe3 |
|
|
|
05afe3 |
<parameters>
|
|
|
05afe3 |
+<parameter name="with_cmirrord" unique="0" required="0">
|
|
|
05afe3 |
+<longdesc lang="en">
|
|
|
05afe3 |
+Start with cmirrord (cluster mirror log daemon).
|
|
|
05afe3 |
+</longdesc>
|
|
|
05afe3 |
+<shortdesc lang="en">activate cmirrord</shortdesc>
|
|
|
05afe3 |
+<content type="boolean" default="false" />
|
|
|
05afe3 |
+</parameter>
|
|
|
05afe3 |
+
|
|
|
05afe3 |
<parameter name="pidfile" unique="0">
|
|
|
05afe3 |
<longdesc lang="en">pid file</longdesc>
|
|
|
05afe3 |
<shortdesc lang="en">pid file</shortdesc>
|
|
|
05afe3 |
@@ -102,6 +110,7 @@ END
|
|
|
05afe3 |
: ${OCF_RESKEY_pidfile:="/run/lvmlockd.pid"}
|
|
|
05afe3 |
|
|
|
05afe3 |
LOCKD="lvmlockd"
|
|
|
05afe3 |
+CMIRRORD="cmirrord"
|
|
|
05afe3 |
# 0.5s sleep each count
|
|
|
05afe3 |
TIMEOUT_COUNT=20
|
|
|
05afe3 |
|
|
|
05afe3 |
@@ -138,6 +147,21 @@ silent_status()
|
|
|
05afe3 |
|
|
|
05afe3 |
if [ -n "$pid" ] ; then
|
|
|
05afe3 |
daemon_is_running "$pid"
|
|
|
05afe3 |
+ rc=$?
|
|
|
05afe3 |
+ mirror_rc=$rc
|
|
|
05afe3 |
+
|
|
|
05afe3 |
+ if ocf_is_true $OCF_RESKEY_with_cmirrord; then
|
|
|
05afe3 |
+ pid=$(pgrep $CMIRRORD | head -n1)
|
|
|
05afe3 |
+ daemon_is_running "$pid"
|
|
|
05afe3 |
+ mirror_rc=$?
|
|
|
05afe3 |
+ fi
|
|
|
05afe3 |
+
|
|
|
05afe3 |
+ # If these ever don't match, return error to force recovery
|
|
|
05afe3 |
+ if [ $mirror_rc -ne $rc ]; then
|
|
|
05afe3 |
+ return $OCF_ERR_GENERIC
|
|
|
05afe3 |
+ fi
|
|
|
05afe3 |
+
|
|
|
05afe3 |
+ return $rc
|
|
|
05afe3 |
else
|
|
|
05afe3 |
# No pid file
|
|
|
05afe3 |
false
|
|
|
05afe3 |
@@ -199,6 +223,16 @@ lvmlockd_start() {
|
|
|
05afe3 |
return $OCF_SUCCESS
|
|
|
05afe3 |
fi
|
|
|
05afe3 |
|
|
|
05afe3 |
+ if ocf_is_true $OCF_RESKEY_with_cmirrord; then
|
|
|
05afe3 |
+ ocf_log info "starting ${CMIRRORD}..."
|
|
|
05afe3 |
+ $CMIRRORD
|
|
|
05afe3 |
+ rc=$?
|
|
|
05afe3 |
+ if [ $rc -ne $OCF_SUCCESS ] ; then
|
|
|
05afe3 |
+ ocf_exit_reason "Failed to start ${CMIRRORD}, exit code: $rc"
|
|
|
05afe3 |
+ return $OCF_ERR_GENERIC
|
|
|
05afe3 |
+ fi
|
|
|
05afe3 |
+ fi
|
|
|
05afe3 |
+
|
|
|
05afe3 |
if [ ! -z "$OCF_RESKEY_socket_path" ] ; then
|
|
|
05afe3 |
extras="$extras -s ${OCF_RESKEY_socket_path}"
|
|
|
05afe3 |
fi
|
|
|
05afe3 |
@@ -252,10 +286,11 @@ wait_lockspaces_close()
|
|
|
05afe3 |
|
|
|
05afe3 |
kill_stop()
|
|
|
05afe3 |
{
|
|
|
05afe3 |
- local pid=$1
|
|
|
05afe3 |
+ local proc=$1
|
|
|
05afe3 |
+ local pid=$2
|
|
|
05afe3 |
local retries=0
|
|
|
05afe3 |
|
|
|
05afe3 |
- ocf_log info "Killing ${LOCKD} (pid=$pid)"
|
|
|
05afe3 |
+ ocf_log info "Killing $proc (pid=$pid)"
|
|
|
05afe3 |
while
|
|
|
05afe3 |
daemon_is_running $pid && [ $retries -lt "$TIMEOUT_COUNT" ]
|
|
|
05afe3 |
do
|
|
|
05afe3 |
@@ -292,9 +327,15 @@ lvmlockd_stop() {
|
|
|
05afe3 |
wait_lockspaces_close
|
|
|
05afe3 |
|
|
|
05afe3 |
pid=$(get_pid)
|
|
|
05afe3 |
- kill_stop $pid
|
|
|
05afe3 |
+ kill_stop $LOCKD $pid
|
|
|
05afe3 |
+
|
|
|
05afe3 |
+ if ocf_is_true $OCF_RESKEY_with_cmirrord; then
|
|
|
05afe3 |
+ pid=$(pgrep $CMIRRORD)
|
|
|
05afe3 |
+ kill_stop $CMIRRORD $pid
|
|
|
05afe3 |
+ fi
|
|
|
05afe3 |
+
|
|
|
05afe3 |
if silent_status ; then
|
|
|
05afe3 |
- ocf_exit_reason "Failed to stop, ${LOCKD}[$pid] still running."
|
|
|
05afe3 |
+ ocf_exit_reason "Failed to stop, ${LOCKD} or ${CMIRRORD} still running."
|
|
|
05afe3 |
return $OCF_ERR_GENERIC
|
|
|
05afe3 |
fi
|
|
|
05afe3 |
|
|
|
05afe3 |
@@ -317,6 +358,10 @@ lvmlockd_validate() {
|
|
|
05afe3 |
check_binary pgrep
|
|
|
05afe3 |
check_binary lvmlockctl
|
|
|
05afe3 |
|
|
|
05afe3 |
+ if ocf_is_true $OCF_RESKEY_with_cmirrord; then
|
|
|
05afe3 |
+ check_binary $CMIRRORD
|
|
|
05afe3 |
+ fi
|
|
|
05afe3 |
+
|
|
|
05afe3 |
return $OCF_SUCCESS
|
|
|
05afe3 |
}
|
|
|
05afe3 |
|