commit
533beda994
@ -0,0 +1 @@
|
|||||||
|
SOURCES/ClusterLabs-resource-agents-fd0720f7.tar.gz
|
@ -0,0 +1 @@
|
|||||||
|
3b517ecdbe2103df77813050e5c998e102c5de7e SOURCES/ClusterLabs-resource-agents-fd0720f7.tar.gz
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,29 @@
|
|||||||
|
From 9a7b47f1838e9d6e3c807e9db5312097adb5c499 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Fri, 5 Nov 2021 10:30:49 +0100
|
||||||
|
Subject: [PATCH] gcp-ilb/Squid: fix issues detected by CI
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/Squid.in | 2 +-
|
||||||
|
heartbeat/gcp-ilb | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/gcp-ilb b/heartbeat/gcp-ilb
|
||||||
|
index 28484b241..48dc3ac4e 100755
|
||||||
|
--- a/heartbeat/gcp-ilb
|
||||||
|
+++ b/heartbeat/gcp-ilb
|
||||||
|
@@ -53,12 +53,12 @@ pidfile="/var/run/$OCF_RESOURCE_INSTANCE.pid"
|
||||||
|
|
||||||
|
|
||||||
|
#Validate command for logging
|
||||||
|
-if $OCF_RESKEY_log_enable = "true"; then
|
||||||
|
+if [ $OCF_RESKEY_log_enable = "true" ]; then
|
||||||
|
if type $OCF_RESKEY_log_cmd > /dev/null 2>&1; then
|
||||||
|
logging_cmd="$OCF_RESKEY_log_cmd $OCF_RESKEY_log_params"
|
||||||
|
ocf_log debug "Logging command is: \'$logging_cmd\' "
|
||||||
|
else
|
||||||
|
- $OCF_RESKEY_log_enable = "false"
|
||||||
|
+ OCF_RESKEY_log_enable="false"
|
||||||
|
ocf_log err "\'$logging_cmd\' is invalid. External logging disabled."
|
||||||
|
|
||||||
|
fi;
|
@ -0,0 +1,51 @@
|
|||||||
|
From 14576f7ca02fb0abff188238ac019e88ab06e878 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 9 Nov 2021 11:49:36 +0100
|
||||||
|
Subject: [PATCH] gcp-ilb: only check if log_cmd binary is available if
|
||||||
|
log_enable is true
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/gcp-ilb | 9 +++++----
|
||||||
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/gcp-ilb b/heartbeat/gcp-ilb
|
||||||
|
index 48dc3ac4e..f84f373b7 100755
|
||||||
|
--- a/heartbeat/gcp-ilb
|
||||||
|
+++ b/heartbeat/gcp-ilb
|
||||||
|
@@ -37,7 +37,7 @@ if type "socat" > /dev/null 2>&1; then
|
||||||
|
OCF_RESKEY_cat_default="socat"
|
||||||
|
else
|
||||||
|
OCF_RESKEY_cat_default="nc"
|
||||||
|
-fi;
|
||||||
|
+fi
|
||||||
|
|
||||||
|
|
||||||
|
: ${OCF_RESKEY_cat=${OCF_RESKEY_cat_default}}
|
||||||
|
@@ -53,7 +53,7 @@ pidfile="/var/run/$OCF_RESOURCE_INSTANCE.pid"
|
||||||
|
|
||||||
|
|
||||||
|
#Validate command for logging
|
||||||
|
-if [ $OCF_RESKEY_log_enable = "true" ]; then
|
||||||
|
+if ocf_is_true "$OCF_RESKEY_log_enable"; then
|
||||||
|
if type $OCF_RESKEY_log_cmd > /dev/null 2>&1; then
|
||||||
|
logging_cmd="$OCF_RESKEY_log_cmd $OCF_RESKEY_log_params"
|
||||||
|
ocf_log debug "Logging command is: \'$logging_cmd\' "
|
||||||
|
@@ -61,7 +61,7 @@ if [ $OCF_RESKEY_log_enable = "true" ]; then
|
||||||
|
OCF_RESKEY_log_enable="false"
|
||||||
|
ocf_log err "\'$logging_cmd\' is invalid. External logging disabled."
|
||||||
|
|
||||||
|
- fi;
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
@@ -285,7 +285,8 @@ ilb_stop() {
|
||||||
|
|
||||||
|
ilb_validate() {
|
||||||
|
check_binary "$OCF_RESKEY_cat"
|
||||||
|
- check_binary "$OCF_RESKEY_log_cmd"
|
||||||
|
+
|
||||||
|
+ ocf_is_true "$OCF_RESKEY_log_enable" && check_binary "$OCF_RESKEY_log_cmd"
|
||||||
|
|
||||||
|
if ! ocf_is_decimal "$OCF_RESKEY_port"; then
|
||||||
|
ocf_exit_reason "$OCF_RESKEY_port is not a valid port"
|
@ -0,0 +1,32 @@
|
|||||||
|
From 925180da2f41feddc5aac3c249563eb179b34029 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Mon, 22 Nov 2021 16:44:48 +0100
|
||||||
|
Subject: [PATCH] db2: use -l forever instead of -t nodes -l reboot, as they
|
||||||
|
conflict with eachother
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/db2 | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/db2 b/heartbeat/db2
|
||||||
|
index 03146a957..fa2a45a5d 100755
|
||||||
|
--- a/heartbeat/db2
|
||||||
|
+++ b/heartbeat/db2
|
||||||
|
@@ -274,7 +274,7 @@ db2_fal_attrib() {
|
||||||
|
while read id node member
|
||||||
|
do
|
||||||
|
[ "$member" = member -a "$node" != "$me" ] || continue
|
||||||
|
- crm_attribute -t nodes -l reboot --node=$node -n $attr -v "$3"
|
||||||
|
+ crm_attribute -l forever --node=$node -n $attr -v "$3"
|
||||||
|
rc=$?
|
||||||
|
ocf_log info "DB2 instance $instance($db2node/$db: setting attrib for FAL to $FIRST_ACTIVE_LOG @ $node"
|
||||||
|
[ $rc != 0 ] && break
|
||||||
|
@@ -282,7 +282,7 @@ db2_fal_attrib() {
|
||||||
|
;;
|
||||||
|
|
||||||
|
get)
|
||||||
|
- crm_attribute -t nodes -l reboot -n $attr -G --quiet 2>&1
|
||||||
|
+ crm_attribute -l forever -n $attr -G --quiet 2>&1
|
||||||
|
rc=$?
|
||||||
|
if [ $rc != 0 ]
|
||||||
|
then
|
@ -0,0 +1,32 @@
|
|||||||
|
From 75eaf06eea8957aa3941823955d1c8fa7933ab1d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Wed, 23 Feb 2022 16:32:21 +0100
|
||||||
|
Subject: [PATCH] db2: only warn when notify isnt set, and use
|
||||||
|
ocf_local_nodename() to get node name
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/db2 | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/db2 b/heartbeat/db2
|
||||||
|
index fa2a45a5d..ea24d33fc 100755
|
||||||
|
--- a/heartbeat/db2
|
||||||
|
+++ b/heartbeat/db2
|
||||||
|
@@ -267,7 +267,7 @@ db2_fal_attrib() {
|
||||||
|
|
||||||
|
case "$2" in
|
||||||
|
set)
|
||||||
|
- me=$(uname -n)
|
||||||
|
+ me=$(ocf_local_nodename)
|
||||||
|
|
||||||
|
# loop over all member nodes and set attribute
|
||||||
|
crm_node -l |
|
||||||
|
@@ -284,7 +284,7 @@ db2_fal_attrib() {
|
||||||
|
get)
|
||||||
|
crm_attribute -l forever -n $attr -G --quiet 2>&1
|
||||||
|
rc=$?
|
||||||
|
- if [ $rc != 0 ]
|
||||||
|
+ if ! ocf_is_true "$OCF_RESKEY_CRM_meta_notify" && [ $rc != 0 ]
|
||||||
|
then
|
||||||
|
ocf_log warn "DB2 instance $instance($db2node/$db: can't retrieve attribute $attr, are you sure notifications are enabled ?"
|
||||||
|
fi
|
@ -0,0 +1,22 @@
|
|||||||
|
From c6338011cf9ea69324f44c8c31a4ca2478aab35a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 7 Dec 2021 08:59:50 +0100
|
||||||
|
Subject: [PATCH] podman: remove anonymous volumes
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/podman | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/podman b/heartbeat/podman
|
||||||
|
index fd901c968..2b73857f1 100755
|
||||||
|
--- a/heartbeat/podman
|
||||||
|
+++ b/heartbeat/podman
|
||||||
|
@@ -251,7 +251,7 @@ remove_container()
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
ocf_log notice "Cleaning up inactive container, ${CONTAINER}."
|
||||||
|
- ocf_run podman rm $CONTAINER
|
||||||
|
+ ocf_run podman rm -v $CONTAINER
|
||||||
|
rc=$?
|
||||||
|
if [ $rc -ne 0 ]; then
|
||||||
|
# due to a podman bug (rhbz#1841485), sometimes a stopped
|
@ -0,0 +1,43 @@
|
|||||||
|
From 7c54e4ecda33c90a1046c0688774f5b847ab10fe Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 7 Dec 2021 10:37:24 +0100
|
||||||
|
Subject: [PATCH] Route: return OCF_NOT_RUNNING for probe action when interface
|
||||||
|
or route doesnt exist
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/Route | 15 +++++----------
|
||||||
|
1 file changed, 5 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/Route b/heartbeat/Route
|
||||||
|
index 8b390615a..7db41d0ae 100755
|
||||||
|
--- a/heartbeat/Route
|
||||||
|
+++ b/heartbeat/Route
|
||||||
|
@@ -227,15 +227,6 @@ route_stop() {
|
||||||
|
}
|
||||||
|
|
||||||
|
route_status() {
|
||||||
|
- if [ -n "${OCF_RESKEY_device}" ]; then
|
||||||
|
- # Must check if device exists or is gone.
|
||||||
|
- # If device is gone, route is also unconfigured.
|
||||||
|
- ip link show dev ${OCF_RESKEY_device} >/dev/null 2>&1
|
||||||
|
- if [ $? -ne 0 ]; then
|
||||||
|
- # Assume device does not exist, and short-circuit here.
|
||||||
|
- return $OCF_NOT_RUNNING
|
||||||
|
- fi
|
||||||
|
- fi
|
||||||
|
show_output="$(ip $addr_family route show $(create_route_spec) 2>/dev/null)"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
if [ -n "$show_output" ]; then
|
||||||
|
@@ -251,7 +242,11 @@ route_status() {
|
||||||
|
else
|
||||||
|
# "ip route show" returned an error code. Assume something
|
||||||
|
# went wrong.
|
||||||
|
- return $OCF_ERR_GENERIC
|
||||||
|
+ if ocf_is_probe; then
|
||||||
|
+ return $OCF_NOT_RUNNING
|
||||||
|
+ else
|
||||||
|
+ return $OCF_ERR_GENERIC
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,41 @@
|
|||||||
|
From 6d2ed7615614ede093f097189876d0f08553a43e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Reid Wahl <nrwahl@protonmail.com>
|
||||||
|
Date: Mon, 14 Feb 2022 22:23:39 -0800
|
||||||
|
Subject: [PATCH] IPsrcaddr: Add warning about DHCP
|
||||||
|
|
||||||
|
If DHCP is enabled for the interface that serves OCF_RESKEY_ipaddress,
|
||||||
|
then NetworkManager (and possibly dhclient in systems without NM;
|
||||||
|
unsure) may later re-add a route that the IPsrcaddr resource replaced.
|
||||||
|
This may cause the resource to fail or cause other unexpected behavior.
|
||||||
|
|
||||||
|
So far this has been observed with a default route, albeit with an edge
|
||||||
|
case of a configuration (OCF_RESKEY_ipaddress on a different subnet)
|
||||||
|
that may not be totally valid. There are likely to be other situations
|
||||||
|
as well where DHCP can cause conflicts with IPsrcaddr's manual updates
|
||||||
|
via iproute. The safest option is to use only static configuration for
|
||||||
|
the involved interface.
|
||||||
|
|
||||||
|
Resolves: RHBZ#1654862
|
||||||
|
|
||||||
|
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
||||||
|
---
|
||||||
|
heartbeat/IPsrcaddr | 6 ++++++
|
||||||
|
1 file changed, 6 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
|
||||||
|
index ec868409f..fd7b6f68d 100755
|
||||||
|
--- a/heartbeat/IPsrcaddr
|
||||||
|
+++ b/heartbeat/IPsrcaddr
|
||||||
|
@@ -99,6 +99,12 @@ meta_data() {
|
||||||
|
<longdesc lang="en">
|
||||||
|
Resource script for IPsrcaddr. It manages the preferred source address
|
||||||
|
modification.
|
||||||
|
+
|
||||||
|
+Note: DHCP should not be enabled for the interface serving the preferred
|
||||||
|
+source address. Enabling DHCP may result in unexpected behavior, such as
|
||||||
|
+the automatic addition of duplicate or conflicting routes. This may
|
||||||
|
+cause the IPsrcaddr resource to fail, or it may produce undesired
|
||||||
|
+behavior while the resource continues to run.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Manages the preferred source address for outgoing IP packets</shortdesc>
|
||||||
|
|
@ -0,0 +1,49 @@
|
|||||||
|
From 5a65f66ff803ad7ed15af958cc1efdde4d53dcb7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Reid Wahl <nrwahl@protonmail.com>
|
||||||
|
Date: Thu, 17 Feb 2022 03:53:21 -0800
|
||||||
|
Subject: [PATCH] IPsrcaddr: Better error message when no matching route found
|
||||||
|
|
||||||
|
If OCF_RESKEY_destination is not explicitly set and `ip route list`
|
||||||
|
can't find a route matching the specifications, the NETWORK variable
|
||||||
|
doesn't get set. This causes a certain failure of the start operation,
|
||||||
|
because there is no PREFIX argument to `ip route replace` (syntax
|
||||||
|
error). It may also cause unexpected behavior for stop operations (but
|
||||||
|
not in all cases). During a monitor, this event can only happen if
|
||||||
|
something has changed outside the cluster's control, and so is cause
|
||||||
|
for warning there.
|
||||||
|
|
||||||
|
Exit OCF_ERR_ARGS for start, log debug for probe, log warning for all
|
||||||
|
other ops.
|
||||||
|
|
||||||
|
Resolves: RHBZ#1654862
|
||||||
|
|
||||||
|
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
|
||||||
|
---
|
||||||
|
heartbeat/IPsrcaddr | 14 ++++++++++++++
|
||||||
|
1 file changed, 14 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
|
||||||
|
index fd7b6f68d..f0216722d 100755
|
||||||
|
--- a/heartbeat/IPsrcaddr
|
||||||
|
+++ b/heartbeat/IPsrcaddr
|
||||||
|
@@ -549,6 +549,20 @@ rc=$?
|
||||||
|
INTERFACE=`echo $findif_out | awk '{print $1}'`
|
||||||
|
if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
|
||||||
|
NETWORK=`$IP2UTIL route list dev $INTERFACE scope link $PROTO match $ipaddress|grep -m 1 -o '^[^ ]*'`
|
||||||
|
+
|
||||||
|
+ if [ -z "$NETWORK" ]; then
|
||||||
|
+ err_str="command '$IP2UTIL route list dev $INTERFACE scope link $PROTO"
|
||||||
|
+ err_str="$err_str match $ipaddress' failed to find a matching route"
|
||||||
|
+
|
||||||
|
+ if [ "$__OCF_ACTION" = "start" ]; then
|
||||||
|
+ ocf_exit_reason "$err_str"
|
||||||
|
+ exit $OCF_ERR_ARGS
|
||||||
|
+ elif ! ocf_is_probe; then
|
||||||
|
+ ocf_log warn "$err_str"
|
||||||
|
+ else
|
||||||
|
+ ocf_log debug "$err_str"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
else
|
||||||
|
NETWORK="$OCF_RESKEY_destination"
|
||||||
|
fi
|
@ -0,0 +1,56 @@
|
|||||||
|
From 0a197f1cd227e768837dff778a0c56fc1085d434 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Mon, 21 Feb 2022 13:54:04 +0100
|
||||||
|
Subject: [PATCH] IPsrcaddr: fix indentation in better error message code
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/IPsrcaddr | 30 +++++++++++++++---------------
|
||||||
|
1 file changed, 15 insertions(+), 15 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
|
||||||
|
index f0216722d..c82adc0e9 100755
|
||||||
|
--- a/heartbeat/IPsrcaddr
|
||||||
|
+++ b/heartbeat/IPsrcaddr
|
||||||
|
@@ -542,27 +542,27 @@ fi
|
||||||
|
findif_out=`$FINDIF -C`
|
||||||
|
rc=$?
|
||||||
|
[ $rc -ne 0 ] && {
|
||||||
|
- ocf_exit_reason "[$FINDIF -C] failed"
|
||||||
|
- exit $rc
|
||||||
|
+ ocf_exit_reason "[$FINDIF -C] failed"
|
||||||
|
+ exit $rc
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERFACE=`echo $findif_out | awk '{print $1}'`
|
||||||
|
if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
|
||||||
|
NETWORK=`$IP2UTIL route list dev $INTERFACE scope link $PROTO match $ipaddress|grep -m 1 -o '^[^ ]*'`
|
||||||
|
|
||||||
|
- if [ -z "$NETWORK" ]; then
|
||||||
|
- err_str="command '$IP2UTIL route list dev $INTERFACE scope link $PROTO"
|
||||||
|
- err_str="$err_str match $ipaddress' failed to find a matching route"
|
||||||
|
-
|
||||||
|
- if [ "$__OCF_ACTION" = "start" ]; then
|
||||||
|
- ocf_exit_reason "$err_str"
|
||||||
|
- exit $OCF_ERR_ARGS
|
||||||
|
- elif ! ocf_is_probe; then
|
||||||
|
- ocf_log warn "$err_str"
|
||||||
|
- else
|
||||||
|
- ocf_log debug "$err_str"
|
||||||
|
- fi
|
||||||
|
- fi
|
||||||
|
+ if [ -z "$NETWORK" ]; then
|
||||||
|
+ err_str="command '$IP2UTIL route list dev $INTERFACE scope link $PROTO"
|
||||||
|
+ err_str="$err_str match $ipaddress' failed to find a matching route"
|
||||||
|
+
|
||||||
|
+ if [ "$__OCF_ACTION" = "start" ]; then
|
||||||
|
+ ocf_exit_reason "$err_str"
|
||||||
|
+ exit $OCF_ERR_ARGS
|
||||||
|
+ elif ! ocf_is_probe; then
|
||||||
|
+ ocf_log warn "$err_str"
|
||||||
|
+ else
|
||||||
|
+ ocf_log debug "$err_str"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
else
|
||||||
|
NETWORK="$OCF_RESKEY_destination"
|
||||||
|
fi
|
@ -0,0 +1,117 @@
|
|||||||
|
From 50a596bfb977b18902dc62b99145bbd1a087690a Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 1 Mar 2022 11:06:07 +0100
|
||||||
|
Subject: [PATCH] IPsrcaddr: fixes
|
||||||
|
|
||||||
|
- use findif.sh to detect secondary interfaces
|
||||||
|
- get metric and proto to update the correct route/update it correctly
|
||||||
|
- match route using interface to fail when trying to update secondary
|
||||||
|
interfaces without specifying destination (would update default route
|
||||||
|
before)
|
||||||
|
- also use PRIMARY_IP/OPTS during stop-action for default routes (to get
|
||||||
|
back to the exact routes we started with)
|
||||||
|
- dont fail during stop-action if route doesnt exist
|
||||||
|
- use [[:blank:]] for WS to follow POSIX standard (suggested by nrwahl)
|
||||||
|
---
|
||||||
|
heartbeat/IPsrcaddr | 35 +++++++++++++++++++----------------
|
||||||
|
1 file changed, 19 insertions(+), 16 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
|
||||||
|
index c82adc0e9..7dbf65ff5 100755
|
||||||
|
--- a/heartbeat/IPsrcaddr
|
||||||
|
+++ b/heartbeat/IPsrcaddr
|
||||||
|
@@ -52,6 +52,7 @@
|
||||||
|
# Initialization:
|
||||||
|
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
+. ${OCF_FUNCTIONS_DIR}/findif.sh
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
OCF_RESKEY_ipaddress_default=""
|
||||||
|
@@ -181,19 +182,21 @@ errorexit() {
|
||||||
|
#
|
||||||
|
# where the src clause "src Y.Y.Y.Y" may or may not be present
|
||||||
|
|
||||||
|
-WS="[`echo -en ' \t'`]"
|
||||||
|
+WS="[[:blank:]]"
|
||||||
|
OCTET="[0-9]\{1,3\}"
|
||||||
|
IPADDR="\($OCTET\.\)\{3\}$OCTET"
|
||||||
|
SRCCLAUSE="src$WS$WS*\($IPADDR\)"
|
||||||
|
MATCHROUTE="\(.*${WS}\)\($SRCCLAUSE\)\($WS.*\|$\)"
|
||||||
|
-FINDIF=$HA_BIN/findif
|
||||||
|
+METRICCLAUSE=".*\(metric$WS[^ ]\+\)"
|
||||||
|
+PROTOCLAUSE=".*\(proto$WS[^ ]\+\)"
|
||||||
|
+FINDIF=findif
|
||||||
|
|
||||||
|
# findif needs that to be set
|
||||||
|
export OCF_RESKEY_ip=$OCF_RESKEY_ipaddress
|
||||||
|
|
||||||
|
srca_read() {
|
||||||
|
# Capture matching route - doublequotes prevent word splitting...
|
||||||
|
- ROUTE="`$CMDSHOW 2> /dev/null`" || errorexit "command '$CMDSHOW' failed"
|
||||||
|
+ ROUTE="`$CMDSHOW dev $INTERFACE 2> /dev/null`" || errorexit "command '$CMDSHOW' failed"
|
||||||
|
|
||||||
|
# ... so we can make sure there is only 1 matching route
|
||||||
|
[ 1 -eq `echo "$ROUTE" | wc -l` ] || \
|
||||||
|
@@ -201,7 +204,7 @@ srca_read() {
|
||||||
|
|
||||||
|
# But there might still be no matching route
|
||||||
|
[ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] && [ -z "$ROUTE" ] && \
|
||||||
|
- ! ocf_is_probe && errorexit "no matching route exists"
|
||||||
|
+ ! ocf_is_probe && [ "$__OCF_ACTION" != stop ] && errorexit "no matching route exists"
|
||||||
|
|
||||||
|
# Sed out the source ip address if it exists
|
||||||
|
SRCIP=`echo $ROUTE | sed -n "s/$MATCHROUTE/\3/p"`
|
||||||
|
@@ -232,8 +235,8 @@ srca_start() {
|
||||||
|
rc=$OCF_SUCCESS
|
||||||
|
ocf_log info "The ip route has been already set.($NETWORK, $INTERFACE, $ROUTE_WO_SRC)"
|
||||||
|
else
|
||||||
|
- $IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE src $1 || \
|
||||||
|
- errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE src $1' failed"
|
||||||
|
+ $IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE $PROTO src $1 $METRIC || \
|
||||||
|
+ errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $PROTO src $1 $METRIC' failed"
|
||||||
|
|
||||||
|
if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
|
||||||
|
$CMDCHANGE $ROUTE_WO_SRC src $1 || \
|
||||||
|
@@ -266,14 +269,11 @@ srca_stop() {
|
||||||
|
|
||||||
|
[ $rc = 2 ] && errorexit "The address you specified to stop does not match the preferred source address"
|
||||||
|
|
||||||
|
- OPTS=""
|
||||||
|
- if [ "$OCF_RESKEY_destination" != "0.0.0.0/0" ] ;then
|
||||||
|
- PRIMARY_IP="$($IP2UTIL -4 -o addr show dev $INTERFACE primary | awk '{split($4,a,"/");print a[1]}')"
|
||||||
|
- OPTS="proto kernel scope host src $PRIMARY_IP"
|
||||||
|
- fi
|
||||||
|
+ PRIMARY_IP="$($IP2UTIL -4 -o addr show dev $INTERFACE primary | awk '{split($4,a,"/");print a[1]}')"
|
||||||
|
+ OPTS="proto kernel scope link src $PRIMARY_IP"
|
||||||
|
|
||||||
|
- $IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE $OPTS || \
|
||||||
|
- errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $OPTS' failed"
|
||||||
|
+ $IP2UTIL route replace $TABLE $NETWORK dev $INTERFACE $OPTS $METRIC || \
|
||||||
|
+ errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $OPTS $METRIC' failed"
|
||||||
|
|
||||||
|
if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
|
||||||
|
$CMDCHANGE $ROUTE_WO_SRC || \
|
||||||
|
@@ -539,16 +539,19 @@ if [ $rc -ne $OCF_SUCCESS ]; then
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
-findif_out=`$FINDIF -C`
|
||||||
|
+findif_out=`$FINDIF`
|
||||||
|
rc=$?
|
||||||
|
[ $rc -ne 0 ] && {
|
||||||
|
- ocf_exit_reason "[$FINDIF -C] failed"
|
||||||
|
+ ocf_exit_reason "[$FINDIF] failed"
|
||||||
|
exit $rc
|
||||||
|
}
|
||||||
|
|
||||||
|
INTERFACE=`echo $findif_out | awk '{print $1}'`
|
||||||
|
+LISTROUTE=`$IP2UTIL route list dev $INTERFACE scope link $PROTO match $ipaddress`
|
||||||
|
+METRIC=`echo $LISTROUTE | sed -n "s/$METRICCLAUSE/\1/p"`
|
||||||
|
+[ -z "$PROTO" ] && PROTO=`echo $LISTROUTE | sed -n "s/$PROTOCLAUSE/\1/p"`
|
||||||
|
if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] ;then
|
||||||
|
- NETWORK=`$IP2UTIL route list dev $INTERFACE scope link $PROTO match $ipaddress|grep -m 1 -o '^[^ ]*'`
|
||||||
|
+ NETWORK=`echo $LISTROUTE | grep -m 1 -o '^[^ ]*'`
|
||||||
|
|
||||||
|
if [ -z "$NETWORK" ]; then
|
||||||
|
err_str="command '$IP2UTIL route list dev $INTERFACE scope link $PROTO"
|
@ -0,0 +1,543 @@
|
|||||||
|
From 3e469239e8c853725b28a9c6b509152aacc2c5cc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Mon, 13 Jun 2022 11:24:05 +0200
|
||||||
|
Subject: [PATCH 1/2] all agents: update to promotable terms
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/SAPInstance | 22 +++++++++++-----------
|
||||||
|
heartbeat/conntrackd.in | 6 +++---
|
||||||
|
heartbeat/db2 | 12 ++++++------
|
||||||
|
heartbeat/dnsupdate.in | 2 +-
|
||||||
|
heartbeat/galera.in | 26 +++++++++++++-------------
|
||||||
|
heartbeat/iface-bridge | 6 +++---
|
||||||
|
heartbeat/mariadb.in | 30 +++++++++++++++---------------
|
||||||
|
heartbeat/mpathpersist.in | 24 ++++++++++++------------
|
||||||
|
heartbeat/mysql | 4 ++--
|
||||||
|
heartbeat/mysql-proxy | 2 +-
|
||||||
|
heartbeat/pgsql | 2 +-
|
||||||
|
heartbeat/redis.in | 4 ++--
|
||||||
|
heartbeat/sg_persist.in | 4 ++--
|
||||||
|
14 files changed, 74 insertions(+), 74 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance
|
||||||
|
index 016f59aff..e3fe788ae 100755
|
||||||
|
--- a/heartbeat/SAPInstance
|
||||||
|
+++ b/heartbeat/SAPInstance
|
||||||
|
@@ -25,8 +25,8 @@
|
||||||
|
# OCF_RESKEY_AUTOMATIC_RECOVER (optional, automatic startup recovery using cleanipc, default is false)
|
||||||
|
# OCF_RESKEY_MONITOR_SERVICES (optional, default is to monitor critical services only)
|
||||||
|
# OCF_RESKEY_SHUTDOWN_METHOD (optional, defaults to NORMAL, KILL: terminate the SAP instance with OS commands - faster, at your own risk)
|
||||||
|
-# OCF_RESKEY_ERS_InstanceName (optional, InstanceName of the ERS instance in a Master/Slave configuration)
|
||||||
|
-# OCF_RESKEY_ERS_START_PROFILE (optional, START_PROFILE of the ERS instance in a Master/Slave configuration)
|
||||||
|
+# OCF_RESKEY_ERS_InstanceName (optional, InstanceName of the ERS instance in a Promotable configuration)
|
||||||
|
+# OCF_RESKEY_ERS_START_PROFILE (optional, START_PROFILE of the ERS instance in a Promotable configuration)
|
||||||
|
# OCF_RESKEY_PRE_START_USEREXIT (optional, lists a script which can be executed before the resource is started)
|
||||||
|
# OCF_RESKEY_POST_START_USEREXIT (optional, lists a script which can be executed after the resource is started)
|
||||||
|
# OCF_RESKEY_PRE_STOP_USEREXIT (optional, lists a script which can be executed before the resource is stopped)
|
||||||
|
@@ -92,11 +92,11 @@ sapinstance_usage() {
|
||||||
|
|
||||||
|
$0 manages a SAP Instance as an HA resource.
|
||||||
|
|
||||||
|
- The 'start' operation starts the instance or the ERS instance in a Master/Slave configuration
|
||||||
|
+ The 'start' operation starts the instance or the ERS instance in a Promotable configuration
|
||||||
|
The 'stop' operation stops the instance
|
||||||
|
The 'status' operation reports whether the instance is running
|
||||||
|
The 'monitor' operation reports whether the instance seems to be working
|
||||||
|
- The 'promote' operation starts the primary instance in a Master/Slave configuration
|
||||||
|
+ The 'promote' operation starts the primary instance in a Promotable configuration
|
||||||
|
The 'demote' operation stops the primary instance and starts the ERS instance
|
||||||
|
The 'reload' operation allows changed parameters (non-unique only) without restarting the service
|
||||||
|
The 'notify' operation always returns SUCCESS
|
||||||
|
@@ -201,11 +201,11 @@ You may specify multiple services separated by a | (pipe) sign in this parameter
|
||||||
|
<content type="string" default="${OCF_RESKEY_SHUTDOWN_METHOD_default}"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="ERS_InstanceName" unique="1" required="0">
|
||||||
|
- <longdesc lang="en">Only used in a Master/Slave resource configuration:
|
||||||
|
+ <longdesc lang="en">Only used in a Promotable resource configuration:
|
||||||
|
The full qualified SAP enqueue replication instance name. e.g. P01_ERS02_sapp01ers. Usually this is the name of the SAP instance profile.
|
||||||
|
-The enqueue replication instance must be installed, before you want to configure a master-slave cluster resource.
|
||||||
|
+The enqueue replication instance must be installed, before you want to configure a promotable cluster resource.
|
||||||
|
|
||||||
|
-The master-slave configuration in the cluster must use this properties:
|
||||||
|
+The promotable configuration in the cluster must use this properties:
|
||||||
|
clone_max = 2
|
||||||
|
clone_node_max = 1
|
||||||
|
master_node_max = 1
|
||||||
|
@@ -215,7 +215,7 @@ master_max = 1
|
||||||
|
<content type="string" default="${OCF_RESKEY_ERS_InstanceName_default}"/>
|
||||||
|
</parameter>
|
||||||
|
<parameter name="ERS_START_PROFILE" unique="1" required="0">
|
||||||
|
- <longdesc lang="en">Only used in a Master/Slave resource configuration:
|
||||||
|
+ <longdesc lang="en">Only used in a Promotable resource configuration:
|
||||||
|
The parameter ERS_InstanceName must also be set in this configuration.
|
||||||
|
The name of the SAP START profile. Specify this parameter, if you have changed the name of the SAP START profile after the default SAP installation. As SAP release 7.10 does not have a START profile anymore, you need to specify the Instance Profile than.
|
||||||
|
</longdesc>
|
||||||
|
@@ -243,7 +243,7 @@ The name of the SAP START profile. Specify this parameter, if you have changed t
|
||||||
|
<content type="string" default="${OCF_RESKEY_POST_STOP_USEREXIT_default}" />
|
||||||
|
</parameter>
|
||||||
|
<parameter name="IS_ERS" unique="0" required="0">
|
||||||
|
- <longdesc lang="en">Only used for ASCS/ERS SAP Netweaver installations without implementing a master/slave resource to
|
||||||
|
+ <longdesc lang="en">Only used for ASCS/ERS SAP Netweaver installations without implementing a promotable resource to
|
||||||
|
allow the ASCS to 'find' the ERS running on another cluster node after a resource failure. This parameter should be set
|
||||||
|
to true 'only' for the ERS instance for implementations following the SAP NetWeaver 7.40 HA certification (NW-HA-CLU-740). This includes also
|
||||||
|
systems for NetWeaver less than 7.40, if you like to implement the NW-HA-CLU-740 scenario.
|
||||||
|
@@ -266,8 +266,8 @@ The name of the SAP START profile. Specify this parameter, if you have changed t
|
||||||
|
<action name="stop" timeout="240s" />
|
||||||
|
<action name="status" timeout="60s" />
|
||||||
|
<action name="monitor" depth="0" timeout="60s" interval="120s" />
|
||||||
|
-<action name="monitor" depth="0" timeout="60s" interval="121s" role="Slave" />
|
||||||
|
-<action name="monitor" depth="0" timeout="60s" interval="119s" role="Master" />
|
||||||
|
+<action name="monitor" depth="0" timeout="60s" interval="121s" role="Unpromoted" />
|
||||||
|
+<action name="monitor" depth="0" timeout="60s" interval="119s" role="Promoted" />
|
||||||
|
<action name="promote" timeout="320s" />
|
||||||
|
<action name="demote" timeout="320s" />
|
||||||
|
<action name="reload" timeout="320s" />
|
||||||
|
diff --git a/heartbeat/conntrackd.in b/heartbeat/conntrackd.in
|
||||||
|
index f115250d6..1c2ee955b 100644
|
||||||
|
--- a/heartbeat/conntrackd.in
|
||||||
|
+++ b/heartbeat/conntrackd.in
|
||||||
|
@@ -50,7 +50,7 @@ meta_data() {
|
||||||
|
<version>1.0</version>
|
||||||
|
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Master/Slave OCF Resource Agent for conntrackd
|
||||||
|
+Promotable OCF Resource Agent for conntrackd
|
||||||
|
</longdesc>
|
||||||
|
|
||||||
|
<shortdesc lang="en">This resource agent manages conntrackd</shortdesc>
|
||||||
|
@@ -81,8 +81,8 @@ For example "/packages/conntrackd-0.9.14/etc/conntrackd/conntrackd.conf"</longde
|
||||||
|
<action name="demote" timeout="30s" />
|
||||||
|
<action name="notify" timeout="30s" />
|
||||||
|
<action name="stop" timeout="30s" />
|
||||||
|
-<action name="monitor" timeout="20s" interval="20s" role="Slave" />
|
||||||
|
-<action name="monitor" timeout="20s" interval="10s" role="Master" />
|
||||||
|
+<action name="monitor" timeout="20s" interval="20s" role="Unpromoted" />
|
||||||
|
+<action name="monitor" timeout="20s" interval="10s" role="Promoted" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
<action name="validate-all" timeout="30s" />
|
||||||
|
</actions>
|
||||||
|
diff --git a/heartbeat/db2 b/heartbeat/db2
|
||||||
|
index 4a4b2f477..620b89583 100755
|
||||||
|
--- a/heartbeat/db2
|
||||||
|
+++ b/heartbeat/db2
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
# db2
|
||||||
|
#
|
||||||
|
# Resource agent that manages a DB2 LUW database in Standard role
|
||||||
|
-# or HADR configuration in master/slave configuration.
|
||||||
|
+# or HADR configuration in promotable configuration.
|
||||||
|
# Multi partition is supported as well.
|
||||||
|
#
|
||||||
|
# Copyright (c) 2011 Holger Teutsch <holger.teutsch@web.de>
|
||||||
|
@@ -61,7 +61,7 @@ cat <<END
|
||||||
|
<resource-agent name="db2" version="1.0">
|
||||||
|
<version>1.0</version>
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Resource Agent that manages an IBM DB2 LUW databases in Standard role as primitive or in HADR roles in master/slave configuration. Multiple partitions are supported.
|
||||||
|
+Resource Agent that manages an IBM DB2 LUW databases in Standard role as primitive or in HADR roles in promotable configuration. Multiple partitions are supported.
|
||||||
|
|
||||||
|
Standard mode:
|
||||||
|
|
||||||
|
@@ -71,8 +71,8 @@ Configure each partition as a separate primitive resource.
|
||||||
|
HADR mode:
|
||||||
|
|
||||||
|
A single database in HADR configuration is made highly available by automating takeover operations.
|
||||||
|
-Configure a master / slave resource with notifications enabled and an
|
||||||
|
-additional monitoring operation with role "Master".
|
||||||
|
+Configure a promotable resource with notifications enabled and an
|
||||||
|
+additional monitoring operation with role "Promoted".
|
||||||
|
|
||||||
|
In case of HADR be very deliberate in specifying intervals/timeouts. The detection of a failure including promote must complete within HADR_PEER_WINDOW.
|
||||||
|
|
||||||
|
@@ -84,7 +84,7 @@ In addition to honoring requirements for crash recovery etc. for your specific d
|
||||||
|
|
||||||
|
For further information and examples consult http://www.linux-ha.org/wiki/db2_(resource_agent)
|
||||||
|
</longdesc>
|
||||||
|
-<shortdesc lang="en">Resource Agent that manages an IBM DB2 LUW databases in Standard role as primitive or in HADR roles as master/slave configuration. Multiple partitions are supported.</shortdesc>
|
||||||
|
+<shortdesc lang="en">Resource Agent that manages an IBM DB2 LUW databases in Standard role as primitive or in HADR roles as promotable configuration. Multiple partitions are supported.</shortdesc>
|
||||||
|
|
||||||
|
<parameters>
|
||||||
|
<parameter name="instance" unique="1" required="1">
|
||||||
|
@@ -125,7 +125,7 @@ The number of the partition (DBPARTITIONNUM) to be managed.
|
||||||
|
<action name="demote" timeout="120s"/>
|
||||||
|
<action name="notify" timeout="10s"/>
|
||||||
|
<action name="monitor" depth="0" timeout="60s" interval="20s"/>
|
||||||
|
-<action name="monitor" depth="0" timeout="60s" role="Master" interval="22s"/>
|
||||||
|
+<action name="monitor" depth="0" timeout="60s" role="Promoted" interval="22s"/>
|
||||||
|
<action name="validate-all" timeout="5s"/>
|
||||||
|
<action name="meta-data" timeout="5s"/>
|
||||||
|
</actions>
|
||||||
|
diff --git a/heartbeat/dnsupdate.in b/heartbeat/dnsupdate.in
|
||||||
|
index 35b7c99bb..b54822cd8 100755
|
||||||
|
--- a/heartbeat/dnsupdate.in
|
||||||
|
+++ b/heartbeat/dnsupdate.in
|
||||||
|
@@ -119,7 +119,7 @@ the exact syntax.
|
||||||
|
<parameter name="server" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Which DNS server to send these updates for. When no
|
||||||
|
-server is provided, this defaults to the master server
|
||||||
|
+server is provided, this defaults to the promoted server
|
||||||
|
for the correct zone.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">DNS server to contact</shortdesc>
|
||||||
|
diff --git a/heartbeat/galera.in b/heartbeat/galera.in
|
||||||
|
index c363eb254..546b1a853 100755
|
||||||
|
--- a/heartbeat/galera.in
|
||||||
|
+++ b/heartbeat/galera.in
|
||||||
|
@@ -26,31 +26,31 @@
|
||||||
|
##
|
||||||
|
# README.
|
||||||
|
#
|
||||||
|
-# This agent only supports being configured as a multistate Master
|
||||||
|
+# This agent only supports being configured as a multistate Promoted
|
||||||
|
# resource.
|
||||||
|
#
|
||||||
|
-# Slave vs Master role:
|
||||||
|
+# Unpromoted vs Promoted role:
|
||||||
|
#
|
||||||
|
-# During the 'Slave' role, galera instances are in read-only mode and
|
||||||
|
+# During the 'Unpromoted' role, galera instances are in read-only mode and
|
||||||
|
# will not attempt to connect to the cluster. This role exists only as
|
||||||
|
# a means to determine which galera instance is the most up-to-date. The
|
||||||
|
# most up-to-date node will be used to bootstrap a galera cluster that
|
||||||
|
# has no current members.
|
||||||
|
#
|
||||||
|
-# The galera instances will only begin to be promoted to the Master role
|
||||||
|
+# The galera instances will only begin to be promoted to the Promoted role
|
||||||
|
# once all the nodes in the 'wsrep_cluster_address' connection address
|
||||||
|
# have entered read-only mode. At that point the node containing the
|
||||||
|
-# database that is most current will be promoted to Master. Once the first
|
||||||
|
-# Master instance bootstraps the galera cluster, the other nodes will be
|
||||||
|
-# promoted to Master as well.
|
||||||
|
+# database that is most current will be promoted to Promoted. Once the first
|
||||||
|
+# Promoted instance bootstraps the galera cluster, the other nodes will be
|
||||||
|
+# promoted to Promoted as well.
|
||||||
|
#
|
||||||
|
# Example: Create a galera cluster using nodes rhel7-node1 rhel7-node2 rhel7-node3
|
||||||
|
#
|
||||||
|
# pcs resource create db galera enable_creation=true \
|
||||||
|
-# wsrep_cluster_address="gcomm://rhel7-auto1,rhel7-auto2,rhel7-auto3" meta master-max=3 --master
|
||||||
|
+# wsrep_cluster_address="gcomm://rhel7-auto1,rhel7-auto2,rhel7-auto3" meta promoted-max=3 --promoted
|
||||||
|
#
|
||||||
|
# By setting the 'enable_creation' option, the database will be automatically
|
||||||
|
-# generated at startup. The meta attribute 'master-max=3' means that all 3
|
||||||
|
+# generated at startup. The meta attribute 'promoted-max=3' means that all 3
|
||||||
|
# nodes listed in the wsrep_cluster_address list will be allowed to connect
|
||||||
|
# to the galera cluster and perform replication.
|
||||||
|
#
|
||||||
|
@@ -114,8 +114,8 @@ The 'start' operation starts the database.
|
||||||
|
The 'stop' operation stops the database.
|
||||||
|
The 'status' operation reports whether the database is running
|
||||||
|
The 'monitor' operation reports whether the database seems to be working
|
||||||
|
-The 'promote' operation makes this mysql server run as master
|
||||||
|
-The 'demote' operation makes this mysql server run as slave
|
||||||
|
+The 'promote' operation makes this mysql server run as promoted
|
||||||
|
+The 'demote' operation makes this mysql server run as unpromoted
|
||||||
|
The 'validate-all' operation reports whether the parameters are valid
|
||||||
|
|
||||||
|
UEND
|
||||||
|
@@ -298,8 +298,8 @@ Use it with caution! (and fencing)
|
||||||
|
<action name="stop" timeout="120s" />
|
||||||
|
<action name="status" timeout="60s" />
|
||||||
|
<action name="monitor" depth="0" timeout="30s" interval="20s" />
|
||||||
|
-<action name="monitor" role="Master" depth="0" timeout="30s" interval="10s" />
|
||||||
|
-<action name="monitor" role="Slave" depth="0" timeout="30s" interval="30s" />
|
||||||
|
+<action name="monitor" role="Promoted" depth="0" timeout="30s" interval="10s" />
|
||||||
|
+<action name="monitor" role="Unpromoted" depth="0" timeout="30s" interval="30s" />
|
||||||
|
<action name="promote" timeout="300s" />
|
||||||
|
<action name="demote" timeout="120s" />
|
||||||
|
<action name="validate-all" timeout="5s" />
|
||||||
|
diff --git a/heartbeat/iface-bridge b/heartbeat/iface-bridge
|
||||||
|
index 75d5371dd..a4e50adb9 100755
|
||||||
|
--- a/heartbeat/iface-bridge
|
||||||
|
+++ b/heartbeat/iface-bridge
|
||||||
|
@@ -211,7 +211,7 @@ bridge_meta_data() {
|
||||||
|
<longdesc lang="en">
|
||||||
|
Set the port cost. This is a dimensionless metric.
|
||||||
|
A list of port/cost can be specified using the following
|
||||||
|
- format: slave cost slave cost.
|
||||||
|
+ format: unpromoted cost unpromoted cost.
|
||||||
|
Example: eth0 100 eth1 1000
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">
|
||||||
|
@@ -228,7 +228,7 @@ bridge_meta_data() {
|
||||||
|
This metric is used in the designated port and root port
|
||||||
|
selection algorithms.
|
||||||
|
A list of port/priority can be specified using the following
|
||||||
|
- format: slave cost slave cost.
|
||||||
|
+ format: unpromoted cost unpromoted cost.
|
||||||
|
Example: eth0 10 eth1 60
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">
|
||||||
|
@@ -262,7 +262,7 @@ bridge_meta_data() {
|
||||||
|
Enable or disable a port from the multicast router.
|
||||||
|
Kernel enables all port by default.
|
||||||
|
A list of port can be specified using the following
|
||||||
|
- format: slave 0|1 slave 0|1.
|
||||||
|
+ format: unpromoted 0|1 unpromoted 0|1.
|
||||||
|
Example: eth0 1 eth1 0
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">
|
||||||
|
diff --git a/heartbeat/mariadb.in b/heartbeat/mariadb.in
|
||||||
|
index 39ad191bb..5a39ccb66 100644
|
||||||
|
--- a/heartbeat/mariadb.in
|
||||||
|
+++ b/heartbeat/mariadb.in
|
||||||
|
@@ -3,7 +3,7 @@
|
||||||
|
#
|
||||||
|
# MariaDB
|
||||||
|
#
|
||||||
|
-# Description: Manages a MariaDB Master/Slave database as Linux-HA resource
|
||||||
|
+# Description: Manages a MariaDB Promotable database as Linux-HA resource
|
||||||
|
#
|
||||||
|
# Authors: Alan Robertson: DB2 Script
|
||||||
|
# Jakub Janczak: rewrite as MySQL
|
||||||
|
@@ -61,8 +61,8 @@ The 'start' operation starts the database.
|
||||||
|
The 'stop' operation stops the database.
|
||||||
|
The 'status' operation reports whether the database is running
|
||||||
|
The 'monitor' operation reports whether the database seems to be working
|
||||||
|
-The 'promote' operation makes this mysql server run as master
|
||||||
|
-The 'demote' operation makes this mysql server run as slave
|
||||||
|
+The 'promote' operation makes this mysql server run as promoted
|
||||||
|
+The 'demote' operation makes this mysql server run as unpromoted
|
||||||
|
The 'validate-all' operation reports whether the parameters are valid
|
||||||
|
|
||||||
|
UEND
|
||||||
|
@@ -78,20 +78,20 @@ meta_data() {
|
||||||
|
<longdesc lang="en">
|
||||||
|
Resource script for MariaDB.
|
||||||
|
|
||||||
|
-Manages a complete master/slave replication setup with GTID, for simpler
|
||||||
|
+Manages a complete promotable replication setup with GTID, for simpler
|
||||||
|
uses look at the mysql resource agent which supports older replication
|
||||||
|
forms which mysql and mariadb have in common.
|
||||||
|
|
||||||
|
The resource must be setup to use notifications. Set 'notify=true' in the metadata
|
||||||
|
-attributes when defining a MariaDB master/slave instance.
|
||||||
|
+attributes when defining a MariaDB promotable instance.
|
||||||
|
|
||||||
|
-The default behavior is to use uname -n values in the change master to command.
|
||||||
|
+The default behavior is to use uname -n values in the change promoted to command.
|
||||||
|
Other IPs can be specified manually by adding a node attribute
|
||||||
|
\${INSTANCE_ATTR_NAME}_mysql_master_IP giving the IP to use for replication.
|
||||||
|
For example, if the mariadb primitive you are using is p_mariadb, the
|
||||||
|
attribute to set will be p_mariadb_mysql_master_IP.
|
||||||
|
</longdesc>
|
||||||
|
-<shortdesc lang="en">Manages a MariaDB master/slave instance</shortdesc>
|
||||||
|
+<shortdesc lang="en">Manages a MariaDB promotable instance</shortdesc>
|
||||||
|
<parameters>
|
||||||
|
|
||||||
|
<parameter name="binary" unique="0" required="0">
|
||||||
|
@@ -154,7 +154,7 @@ The logfile to be used for mysqld.
|
||||||
|
<longdesc lang="en">
|
||||||
|
All node names of nodes that will execute mariadb.
|
||||||
|
Please separate each node name with a space.
|
||||||
|
-This is required for the master selection to function.
|
||||||
|
+This is required for the promoted selection to function.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">node list</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_node_list_default}" />
|
||||||
|
@@ -220,11 +220,11 @@ Additional parameters which are passed to the mysqld on startup.
|
||||||
|
<parameter name="replication_user" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
MariaDB replication user. This user is used for starting and stopping
|
||||||
|
-MariaDB replication, for setting and resetting the master host, and for
|
||||||
|
+MariaDB replication, for setting and resetting the promoted host, and for
|
||||||
|
setting and unsetting read-only mode. Because of that, this user must
|
||||||
|
have SUPER, REPLICATION SLAVE, REPLICATION CLIENT, PROCESS and RELOAD
|
||||||
|
privileges on all nodes within the cluster. Mandatory if you define a
|
||||||
|
-master-slave resource.
|
||||||
|
+promotable resource.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">MariaDB replication user</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_replication_user_default}" />
|
||||||
|
@@ -232,8 +232,8 @@ master-slave resource.
|
||||||
|
|
||||||
|
<parameter name="replication_passwd" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-MariaDB replication password. Used for replication client and slave.
|
||||||
|
-Mandatory if you define a master-slave resource.
|
||||||
|
+MariaDB replication password. Used for replication client and unpromoted.
|
||||||
|
+Mandatory if you define a promotable resource.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">MariaDB replication user password</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_replication_passwd_default}" />
|
||||||
|
@@ -241,7 +241,7 @@ Mandatory if you define a master-slave resource.
|
||||||
|
|
||||||
|
<parameter name="replication_port" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-The port on which the Master MariaDB instance is listening.
|
||||||
|
+The port on which the Promoted MariaDB instance is listening.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">MariaDB replication port</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_replication_port_default}" />
|
||||||
|
@@ -254,8 +254,8 @@ The port on which the Master MariaDB instance is listening.
|
||||||
|
<action name="stop" timeout="120s" />
|
||||||
|
<action name="status" timeout="60s" />
|
||||||
|
<action name="monitor" depth="0" timeout="30s" interval="20s" />
|
||||||
|
-<action name="monitor" role="Master" depth="0" timeout="30s" interval="10s" />
|
||||||
|
-<action name="monitor" role="Slave" depth="0" timeout="30s" interval="30s" />
|
||||||
|
+<action name="monitor" role="Promoted" depth="0" timeout="30s" interval="10s" />
|
||||||
|
+<action name="monitor" role="Unpromoted" depth="0" timeout="30s" interval="30s" />
|
||||||
|
<action name="promote" timeout="120s" />
|
||||||
|
<action name="demote" timeout="120s" />
|
||||||
|
<action name="notify" timeout="90s" />
|
||||||
|
diff --git a/heartbeat/mpathpersist.in b/heartbeat/mpathpersist.in
|
||||||
|
index fcf1b3a4b..e47fef4bd 100644
|
||||||
|
--- a/heartbeat/mpathpersist.in
|
||||||
|
+++ b/heartbeat/mpathpersist.in
|
||||||
|
@@ -80,9 +80,9 @@ meta_data() {
|
||||||
|
<longdesc lang="en">
|
||||||
|
This resource agent manages SCSI persistent reservations on multipath devices.
|
||||||
|
"mpathpersist" from multipath-tools is used, please see its documentation.
|
||||||
|
-Should be used as multistate (Master/Slave) resource
|
||||||
|
-Slave registers its node id ("crm_node -i") as reservation key ( --param-sark ) on each device in the params "devs" list.
|
||||||
|
-Master reserves all devices from params "devs" list with reservation "--prout-type" value from "reservation_type" parameter.
|
||||||
|
+Should be used as multistate (Promotable) resource
|
||||||
|
+Unpromoted registers its node id ("crm_node -i") as reservation key ( --param-sark ) on each device in the params "devs" list.
|
||||||
|
+Promoted reserves all devices from params "devs" list with reservation "--prout-type" value from "reservation_type" parameter.
|
||||||
|
Please see man sg_persist(8) and mpathpersist(8) for reservation_type details.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Manages SCSI persistent reservations on multipath devices</shortdesc>
|
||||||
|
@@ -132,7 +132,7 @@ reservation type
|
||||||
|
master_score_base value
|
||||||
|
"master_score_base" value is used in "master_score" calculation:
|
||||||
|
master_score = master_score_base + master_score_dev_factor * working_devs
|
||||||
|
-if set to bigger value in mpathpersist resource configuration on some node, this node will be "preferred" for master role.
|
||||||
|
+if set to bigger value in mpathpersist resource configuration on some node, this node will be "preferred" for promoted role.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">base master_score value</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_master_score_base_default}" />
|
||||||
|
@@ -140,9 +140,9 @@ if set to bigger value in mpathpersist resource configuration on some node, this
|
||||||
|
|
||||||
|
<parameter name="master_score_dev_factor" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Working device factor in master_score calculation
|
||||||
|
+Working device factor in promoted calculation
|
||||||
|
each "working" device provides additional value to "master_score",
|
||||||
|
-so the node that sees more devices will be preferred for the "Master"-role
|
||||||
|
+so the node that sees more devices will be preferred for the "Promoted"-role
|
||||||
|
Setting it to 0 will disable this behavior.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">working device factor in master_score calculation</shortdesc>
|
||||||
|
@@ -151,10 +151,10 @@ Setting it to 0 will disable this behavior.
|
||||||
|
|
||||||
|
<parameter name="master_score_delay" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-master/slave decreases/increases its master_score after delay of "master_score_delay" seconds
|
||||||
|
-so if some device gets inaccessible, the slave decreases its master_score first and the resource will no be watched
|
||||||
|
-and after this device reappears again the master increases its master_score first
|
||||||
|
-this can work only if the master_score_delay is bigger then monitor interval on both master and slave
|
||||||
|
+promoted/unpromoted decreases/increases its master_score after delay of "master_score_delay" seconds
|
||||||
|
+so if some device gets inaccessible, the unpromoted decreases its promoted first and the resource will no be watched
|
||||||
|
+and after this device reappears again the promoted increases its master_score first
|
||||||
|
+this can work only if the master_score_delay is bigger then monitor interval on both promoted and unpromoted
|
||||||
|
Setting it to 0 will disable this behavior.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">master_score decrease/increase delay time</shortdesc>
|
||||||
|
@@ -168,8 +168,8 @@ Setting it to 0 will disable this behavior.
|
||||||
|
<action name="demote" timeout="30s" />
|
||||||
|
<action name="notify" timeout="30s" />
|
||||||
|
<action name="stop" timeout="30s" />
|
||||||
|
-<action name="monitor" depth="0" timeout="20s" interval="29s" role="Slave" />
|
||||||
|
-<action name="monitor" depth="0" timeout="20s" interval="60s" role="Master" />
|
||||||
|
+<action name="monitor" depth="0" timeout="20s" interval="29s" role="Unpromoted" />
|
||||||
|
+<action name="monitor" depth="0" timeout="20s" interval="60s" role="Promoted" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
<action name="validate-all" timeout="30s" />
|
||||||
|
</actions>
|
||||||
|
diff --git a/heartbeat/mysql b/heartbeat/mysql
|
||||||
|
index 720de8c1a..aec44fe5e 100755
|
||||||
|
--- a/heartbeat/mysql
|
||||||
|
+++ b/heartbeat/mysql
|
||||||
|
@@ -321,8 +321,8 @@ whether a node is usable for clients to read from.</shortdesc>
|
||||||
|
<action name="stop" timeout="120s" />
|
||||||
|
<action name="status" timeout="60s" />
|
||||||
|
<action name="monitor" depth="0" timeout="30s" interval="20s" />
|
||||||
|
-<action name="monitor" role="Master" depth="0" timeout="30s" interval="10s" />
|
||||||
|
-<action name="monitor" role="Slave" depth="0" timeout="30s" interval="30s" />
|
||||||
|
+<action name="monitor" role="Promoted" depth="0" timeout="30s" interval="10s" />
|
||||||
|
+<action name="monitor" role="Unpromoted" depth="0" timeout="30s" interval="30s" />
|
||||||
|
<action name="promote" timeout="120s" />
|
||||||
|
<action name="demote" timeout="120s" />
|
||||||
|
<action name="notify" timeout="90s" />
|
||||||
|
diff --git a/heartbeat/mysql-proxy b/heartbeat/mysql-proxy
|
||||||
|
index e34396d9a..fdf2fa230 100755
|
||||||
|
--- a/heartbeat/mysql-proxy
|
||||||
|
+++ b/heartbeat/mysql-proxy
|
||||||
|
@@ -162,7 +162,7 @@ Address:port of the remote back-end servers (default: 127.0.0.1:3306).
|
||||||
|
|
||||||
|
<parameter name="proxy_read_only_backend_addresses" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Address:port of the remote (read only) slave-server (default: ).
|
||||||
|
+Address:port of the remote (read only) unpromoted-server (default: ).
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">MySql Proxy read only back-end servers</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_proxy_read_only_backend_addresses_default}" />
|
||||||
|
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
|
||||||
|
index e3a39038f..94aceb324 100755
|
||||||
|
--- a/heartbeat/pgsql
|
||||||
|
+++ b/heartbeat/pgsql
|
||||||
|
@@ -458,7 +458,7 @@ wal receiver is not running in the master and the attribute shows status as
|
||||||
|
<action name="stop" timeout="120s" />
|
||||||
|
<action name="status" timeout="60s" />
|
||||||
|
<action name="monitor" depth="0" timeout="30s" interval="30s"/>
|
||||||
|
-<action name="monitor" depth="0" timeout="30s" interval="29s" role="Master" />
|
||||||
|
+<action name="monitor" depth="0" timeout="30s" interval="29s" role="Promoted" />
|
||||||
|
<action name="promote" timeout="120s" />
|
||||||
|
<action name="demote" timeout="120s" />
|
||||||
|
<action name="notify" timeout="90s" />
|
||||||
|
diff --git a/heartbeat/redis.in b/heartbeat/redis.in
|
||||||
|
index 7f886c7ea..6429477e1 100755
|
||||||
|
--- a/heartbeat/redis.in
|
||||||
|
+++ b/heartbeat/redis.in
|
||||||
|
@@ -220,8 +220,8 @@ is in use.
|
||||||
|
<action name="stop" timeout="120s" />
|
||||||
|
<action name="status" timeout="60s" />
|
||||||
|
<action name="monitor" depth="0" timeout="60s" interval="45s" />
|
||||||
|
-<action name="monitor" role="Master" depth="0" timeout="60s" interval="20s" />
|
||||||
|
-<action name="monitor" role="Slave" depth="0" timeout="60s" interval="60s" />
|
||||||
|
+<action name="monitor" role="Promoted" depth="0" timeout="60s" interval="20s" />
|
||||||
|
+<action name="monitor" role="Unpromoted" depth="0" timeout="60s" interval="60s" />
|
||||||
|
<action name="promote" timeout="120s" />
|
||||||
|
<action name="demote" timeout="120s" />
|
||||||
|
<action name="notify" timeout="90s" />
|
||||||
|
diff --git a/heartbeat/sg_persist.in b/heartbeat/sg_persist.in
|
||||||
|
index 678762f40..0497cc469 100644
|
||||||
|
--- a/heartbeat/sg_persist.in
|
||||||
|
+++ b/heartbeat/sg_persist.in
|
||||||
|
@@ -168,8 +168,8 @@ Setting it to 0 will disable this behavior.
|
||||||
|
<action name="demote" timeout="30s" />
|
||||||
|
<action name="notify" timeout="30s" />
|
||||||
|
<action name="stop" timeout="30s" />
|
||||||
|
-<action name="monitor" depth="0" timeout="20s" interval="29s" role="Slave" />
|
||||||
|
-<action name="monitor" depth="0" timeout="20s" interval="60s" role="Master" />
|
||||||
|
+<action name="monitor" depth="0" timeout="20s" interval="29s" role="Unpromoted" />
|
||||||
|
+<action name="monitor" depth="0" timeout="20s" interval="60s" role="Promoted" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
<action name="validate-all" timeout="30s" />
|
||||||
|
</actions>
|
||||||
|
|
||||||
|
From 14e5cb71e3749d311745f110f90cc1139f9cedaf Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Thu, 16 Jun 2022 15:54:39 +0200
|
||||||
|
Subject: [PATCH 2/2] metadata: update to promoted roles
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/metadata.rng | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/metadata.rng b/heartbeat/metadata.rng
|
||||||
|
index 3dd735547..909efc284 100644
|
||||||
|
--- a/heartbeat/metadata.rng
|
||||||
|
+++ b/heartbeat/metadata.rng
|
||||||
|
@@ -85,8 +85,8 @@
|
||||||
|
|
||||||
|
<define name="role-values">
|
||||||
|
<choice>
|
||||||
|
- <value>Master</value>
|
||||||
|
- <value>Slave</value>
|
||||||
|
+ <value>Promoted</value>
|
||||||
|
+ <value>Unpromoted</value>
|
||||||
|
</choice>
|
||||||
|
</define>
|
||||||
|
|
@ -0,0 +1,102 @@
|
|||||||
|
From e651576c1b5c1ffbe0fd1b78f209be9a3f9764e7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: XingWei-Liu <liuxingwei@uniontech.com>
|
||||||
|
Date: Thu, 10 Mar 2022 10:38:11 +0800
|
||||||
|
Subject: [PATCH 1/4] change lvm_status return value from ocf_not_running to
|
||||||
|
ocf_err_generic
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/LVM-activate | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
||||||
|
index aed672ea3..0aef76706 100755
|
||||||
|
--- a/heartbeat/LVM-activate
|
||||||
|
+++ b/heartbeat/LVM-activate
|
||||||
|
@@ -790,7 +790,7 @@ lvm_status() {
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $dm_count -eq 0 ]; then
|
||||||
|
- return $OCF_NOT_RUNNING
|
||||||
|
+ return $OCF_ERR_GENERIC
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$OCF_CHECK_LEVEL" in
|
||||||
|
|
||||||
|
From 540ae56436a4f9547bb17aa206fe0e8c7a7fea87 Mon Sep 17 00:00:00 2001
|
||||||
|
From: XingWei-Liu <liuxingwei@uniontech.com>
|
||||||
|
Date: Thu, 10 Mar 2022 16:44:25 +0800
|
||||||
|
Subject: [PATCH 2/4] add if ocf_is_probe in monitor func
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/LVM-activate | 6 +++++-
|
||||||
|
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
||||||
|
index 0aef76706..c86606637 100755
|
||||||
|
--- a/heartbeat/LVM-activate
|
||||||
|
+++ b/heartbeat/LVM-activate
|
||||||
|
@@ -790,7 +790,11 @@ lvm_status() {
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $dm_count -eq 0 ]; then
|
||||||
|
- return $OCF_ERR_GENERIC
|
||||||
|
+ if ocf_is_probe ;then
|
||||||
|
+ return $OCF_NOT_RUNNING
|
||||||
|
+ else
|
||||||
|
+ return $OCF_ERR_GENERIC
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$OCF_CHECK_LEVEL" in
|
||||||
|
|
||||||
|
From ae3f35d4f671f3288034a257c6dd8eff9a83447a Mon Sep 17 00:00:00 2001
|
||||||
|
From: XingWei-Liu <liuxingwei@uniontech.com>
|
||||||
|
Date: Thu, 10 Mar 2022 16:50:04 +0800
|
||||||
|
Subject: [PATCH 3/4] add if ocf_is_probe in monitor func
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/LVM-activate | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
||||||
|
index c86606637..f345f73a9 100755
|
||||||
|
--- a/heartbeat/LVM-activate
|
||||||
|
+++ b/heartbeat/LVM-activate
|
||||||
|
@@ -791,9 +791,9 @@ lvm_status() {
|
||||||
|
|
||||||
|
if [ $dm_count -eq 0 ]; then
|
||||||
|
if ocf_is_probe ;then
|
||||||
|
- return $OCF_NOT_RUNNING
|
||||||
|
- else
|
||||||
|
return $OCF_ERR_GENERIC
|
||||||
|
+ else
|
||||||
|
+ return $OCF_NOT_RUNNING
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
From 1072c0490ef936a1a7dfd8411da434dce1569457 Mon Sep 17 00:00:00 2001
|
||||||
|
From: XingWei-Liu <liuxingwei@uniontech.com>
|
||||||
|
Date: Thu, 10 Mar 2022 18:10:21 +0800
|
||||||
|
Subject: [PATCH 4/4] reverse return value in monitor func
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/LVM-activate | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/LVM-activate b/heartbeat/LVM-activate
|
||||||
|
index f345f73a9..c86606637 100755
|
||||||
|
--- a/heartbeat/LVM-activate
|
||||||
|
+++ b/heartbeat/LVM-activate
|
||||||
|
@@ -791,9 +791,9 @@ lvm_status() {
|
||||||
|
|
||||||
|
if [ $dm_count -eq 0 ]; then
|
||||||
|
if ocf_is_probe ;then
|
||||||
|
- return $OCF_ERR_GENERIC
|
||||||
|
- else
|
||||||
|
return $OCF_NOT_RUNNING
|
||||||
|
+ else
|
||||||
|
+ return $OCF_ERR_GENERIC
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,312 @@
|
|||||||
|
From fd1d6426a2d05f521207c305d10b49fedd92c2df Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||||
|
Date: Mon, 28 Feb 2022 09:27:42 +0100
|
||||||
|
Subject: [PATCH 1/4] IPaddr2: Allow to disable Duplicate Address Detection for
|
||||||
|
IPv6
|
||||||
|
|
||||||
|
"Starting" an IPv6 address with IPaddr2 involves performing Duplicate
|
||||||
|
Address Detection which typically takes at least 1000 ms. Allow the user
|
||||||
|
to disable DAD if they can guarantee that the configured address is not
|
||||||
|
duplicate and they wish to start the resource faster.
|
||||||
|
---
|
||||||
|
heartbeat/IPaddr2 | 15 +++++++++++++++
|
||||||
|
1 file changed, 15 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
|
||||||
|
index 735dd7779..650392b70 100755
|
||||||
|
--- a/heartbeat/IPaddr2
|
||||||
|
+++ b/heartbeat/IPaddr2
|
||||||
|
@@ -88,6 +88,7 @@ OCF_RESKEY_arp_sender_default=""
|
||||||
|
OCF_RESKEY_send_arp_opts_default=""
|
||||||
|
OCF_RESKEY_flush_routes_default="false"
|
||||||
|
OCF_RESKEY_run_arping_default=false
|
||||||
|
+OCF_RESKEY_nodad_default=false
|
||||||
|
OCF_RESKEY_noprefixroute_default="false"
|
||||||
|
OCF_RESKEY_preferred_lft_default="forever"
|
||||||
|
OCF_RESKEY_network_namespace_default=""
|
||||||
|
@@ -110,6 +111,7 @@ OCF_RESKEY_network_namespace_default=""
|
||||||
|
: ${OCF_RESKEY_send_arp_opts=${OCF_RESKEY_send_arp_opts_default}}
|
||||||
|
: ${OCF_RESKEY_flush_routes=${OCF_RESKEY_flush_routes_default}}
|
||||||
|
: ${OCF_RESKEY_run_arping=${OCF_RESKEY_run_arping_default}}
|
||||||
|
+: ${OCF_RESKEY_nodad=${OCF_RESKEY_nodad_default}}
|
||||||
|
: ${OCF_RESKEY_noprefixroute=${OCF_RESKEY_noprefixroute_default}}
|
||||||
|
: ${OCF_RESKEY_preferred_lft=${OCF_RESKEY_preferred_lft_default}}
|
||||||
|
: ${OCF_RESKEY_network_namespace=${OCF_RESKEY_network_namespace_default}}
|
||||||
|
@@ -391,6 +393,14 @@ Whether or not to run arping for IPv4 collision detection check.
|
||||||
|
<content type="string" default="${OCF_RESKEY_run_arping_default}"/>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
+<parameter name="nodad">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+For IPv6, do not perform Duplicate Address Detection when adding the address.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Use nodad flag</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_nodad_default}"/>
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
<parameter name="noprefixroute">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Use noprefixroute flag (see 'man ip-address').
|
||||||
|
@@ -662,6 +672,11 @@ add_interface () {
|
||||||
|
msg="Adding $FAMILY address $ipaddr/$netmask with broadcast address $broadcast to device $iface"
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ if [ "$FAMILY" = "inet6" ] && ocf_is_true "${OCF_RESKEY_nodad}"; then
|
||||||
|
+ cmd="$cmd nodad"
|
||||||
|
+ msg="${msg} (with nodad)"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
if ocf_is_true "${OCF_RESKEY_noprefixroute}"; then
|
||||||
|
cmd="$cmd noprefixroute"
|
||||||
|
msg="${msg} (with noprefixroute)"
|
||||||
|
|
||||||
|
From f4a9e3281d48c5d37f5df593d014706c46ddb3a7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||||
|
Date: Mon, 7 Mar 2022 17:21:59 +0100
|
||||||
|
Subject: [PATCH 2/4] IPaddr2: Allow to send IPv6 Neighbor Advertisements in
|
||||||
|
background
|
||||||
|
|
||||||
|
"Starting" an IPv6 address with IPaddr2 involves sending Neighbor
|
||||||
|
Advertisement packets to inform neighboring machines about the new
|
||||||
|
IP+MAC translation. By default, 5x packets with 200 ms sleep after each
|
||||||
|
are sent which delays the start by 1000 ms. Allow the user to run this
|
||||||
|
operation in background, similarly as is possible with GARP for IPv4.
|
||||||
|
---
|
||||||
|
heartbeat/IPaddr2 | 33 +++++++++++++++++++++++++++++----
|
||||||
|
1 file changed, 29 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
|
||||||
|
index 650392b70..e243a642d 100755
|
||||||
|
--- a/heartbeat/IPaddr2
|
||||||
|
+++ b/heartbeat/IPaddr2
|
||||||
|
@@ -83,7 +83,7 @@ OCF_RESKEY_unique_clone_address_default=false
|
||||||
|
OCF_RESKEY_arp_interval_default=200
|
||||||
|
OCF_RESKEY_arp_count_default=5
|
||||||
|
OCF_RESKEY_arp_count_refresh_default=0
|
||||||
|
-OCF_RESKEY_arp_bg_default=true
|
||||||
|
+OCF_RESKEY_arp_bg_default=""
|
||||||
|
OCF_RESKEY_arp_sender_default=""
|
||||||
|
OCF_RESKEY_send_arp_opts_default=""
|
||||||
|
OCF_RESKEY_flush_routes_default="false"
|
||||||
|
@@ -336,9 +336,10 @@ situations.
|
||||||
|
|
||||||
|
<parameter name="arp_bg">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Whether or not to send the ARP packets in the background.
|
||||||
|
+Whether or not to send the ARP (IPv4) or NA (IPv6) packets in the background.
|
||||||
|
+The default is true for IPv4 and false for IPv6.
|
||||||
|
</longdesc>
|
||||||
|
-<shortdesc lang="en">ARP from background</shortdesc>
|
||||||
|
+<shortdesc lang="en">ARP/NA from background</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_arp_bg_default}"/>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
@@ -507,6 +508,9 @@ ip_init() {
|
||||||
|
ocf_exit_reason "IPv4 does not support lvs_ipv6_addrlabel"
|
||||||
|
exit $OCF_ERR_CONFIGURED
|
||||||
|
fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_arp_bg" ]; then
|
||||||
|
+ OCF_RESKEY_arp_bg=true
|
||||||
|
+ fi
|
||||||
|
else
|
||||||
|
FAMILY=inet6
|
||||||
|
# address sanitization defined in RFC5952
|
||||||
|
@@ -527,6 +531,9 @@ ip_init() {
|
||||||
|
exit $OCF_ERR_CONFIGURED
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_arp_bg" ]; then
|
||||||
|
+ OCF_RESKEY_arp_bg=false
|
||||||
|
+ fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# support nic:iflabel format in nic parameter
|
||||||
|
@@ -893,6 +900,20 @@ run_arp_sender() {
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
+log_send_ua() {
|
||||||
|
+ local cmdline
|
||||||
|
+ local output
|
||||||
|
+ local rc
|
||||||
|
+
|
||||||
|
+ cmdline="$@"
|
||||||
|
+ output=$($cmdline 2>&1)
|
||||||
|
+ rc=$?
|
||||||
|
+ if [ $rc -ne 0 ] ; then
|
||||||
|
+ ocf_log err "Could not send ICMPv6 Unsolicited Neighbor Advertisements: rc=$rc"
|
||||||
|
+ fi
|
||||||
|
+ ocf_log info "$output"
|
||||||
|
+ return $rc
|
||||||
|
+}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Run send_ua to note send ICMPv6 Unsolicited Neighbor Advertisements.
|
||||||
|
@@ -930,7 +951,11 @@ run_send_ua() {
|
||||||
|
|
||||||
|
ARGS="-i $OCF_RESKEY_arp_interval -c $OCF_RESKEY_arp_count $OCF_RESKEY_ip $NETMASK $NIC"
|
||||||
|
ocf_log info "$SENDUA $ARGS"
|
||||||
|
- $SENDUA $ARGS || ocf_log err "Could not send ICMPv6 Unsolicited Neighbor Advertisements."
|
||||||
|
+ if ocf_is_true $OCF_RESKEY_arp_bg; then
|
||||||
|
+ log_send_ua $SENDUA $ARGS &
|
||||||
|
+ else
|
||||||
|
+ log_send_ua $SENDUA $ARGS
|
||||||
|
+ fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Do we already serve this IP address on the given $NIC?
|
||||||
|
|
||||||
|
From c8afb43012c264f3ee24013a92b2a2f3566db2fd Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||||
|
Date: Tue, 8 Mar 2022 12:35:56 +0100
|
||||||
|
Subject: [PATCH 3/4] IPaddr2: Log 'ip addr add' options together
|
||||||
|
|
||||||
|
Change the log message in add_interface() from
|
||||||
|
"Adding ... (with <opt1>) (with <opt2>)"
|
||||||
|
to
|
||||||
|
"Adding ... (with <opt1> <opt2>)".
|
||||||
|
---
|
||||||
|
heartbeat/IPaddr2 | 19 ++++++++++---------
|
||||||
|
1 file changed, 10 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
|
||||||
|
index e243a642d..dca1b6f5b 100755
|
||||||
|
--- a/heartbeat/IPaddr2
|
||||||
|
+++ b/heartbeat/IPaddr2
|
||||||
|
@@ -651,7 +651,7 @@ delete_interface () {
|
||||||
|
# Add an interface
|
||||||
|
#
|
||||||
|
add_interface () {
|
||||||
|
- local cmd msg ipaddr netmask broadcast iface label
|
||||||
|
+ local cmd msg extra_opts ipaddr netmask broadcast iface label
|
||||||
|
|
||||||
|
ipaddr="$1"
|
||||||
|
netmask="$2"
|
||||||
|
@@ -679,23 +679,24 @@ add_interface () {
|
||||||
|
msg="Adding $FAMILY address $ipaddr/$netmask with broadcast address $broadcast to device $iface"
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ extra_opts=""
|
||||||
|
if [ "$FAMILY" = "inet6" ] && ocf_is_true "${OCF_RESKEY_nodad}"; then
|
||||||
|
- cmd="$cmd nodad"
|
||||||
|
- msg="${msg} (with nodad)"
|
||||||
|
+ extra_opts="$extra_opts nodad"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ocf_is_true "${OCF_RESKEY_noprefixroute}"; then
|
||||||
|
- cmd="$cmd noprefixroute"
|
||||||
|
- msg="${msg} (with noprefixroute)"
|
||||||
|
+ extra_opts="$extra_opts noprefixroute"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -z "$label" ]; then
|
||||||
|
- cmd="$cmd label $label"
|
||||||
|
- msg="${msg} (with label $label)"
|
||||||
|
+ extra_opts="$extra_opts label $label"
|
||||||
|
fi
|
||||||
|
if [ "$FAMILY" = "inet6" ] ;then
|
||||||
|
- cmd="$cmd preferred_lft $OCF_RESKEY_preferred_lft"
|
||||||
|
- msg="${msg} (with preferred_lft $OCF_RESKEY_preferred_lft)"
|
||||||
|
+ extra_opts="$extra_opts preferred_lft $OCF_RESKEY_preferred_lft"
|
||||||
|
+ fi
|
||||||
|
+ if [ -n "$extra_opts" ]; then
|
||||||
|
+ cmd="$cmd$extra_opts"
|
||||||
|
+ msg="$msg (with$extra_opts)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ocf_log info "$msg"
|
||||||
|
|
||||||
|
From cb4d52ead694718282a40eab24e04b6d85bcc802 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||||
|
Date: Mon, 7 Mar 2022 17:25:02 +0100
|
||||||
|
Subject: [PATCH 4/4] IPaddr2: Clarify behavior of 'arp_*' parameters for IPv4
|
||||||
|
and IPv6
|
||||||
|
|
||||||
|
* Mention that 'arp_*' parameters are shared by the IPv4 and IPv6 code.
|
||||||
|
* Clarify description of these parameters and mark which of them apply
|
||||||
|
only to IPv4.
|
||||||
|
---
|
||||||
|
heartbeat/IPaddr2 | 26 +++++++++++++++++---------
|
||||||
|
1 file changed, 17 insertions(+), 9 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2
|
||||||
|
index dca1b6f5b..97a7431a2 100755
|
||||||
|
--- a/heartbeat/IPaddr2
|
||||||
|
+++ b/heartbeat/IPaddr2
|
||||||
|
@@ -157,6 +157,12 @@ and/or clone-max < number of nodes. In case of node failure,
|
||||||
|
clone instances need to be re-allocated on surviving nodes.
|
||||||
|
This would not be possible if there is already an instance
|
||||||
|
on those nodes, and clone-node-max=1 (which is the default).
|
||||||
|
+
|
||||||
|
+When the specified IP address gets assigned to a respective interface, the
|
||||||
|
+resource agent sends unsolicited ARP (Address Resolution Protocol, IPv4) or NA
|
||||||
|
+(Neighbor Advertisement, IPv6) packets to inform neighboring machines about the
|
||||||
|
+change. This functionality is controlled for both IPv4 and IPv6 by shared
|
||||||
|
+'arp_*' parameters.
|
||||||
|
</longdesc>
|
||||||
|
|
||||||
|
<shortdesc lang="en">Manages virtual IPv4 and IPv6 addresses (Linux specific version)</shortdesc>
|
||||||
|
@@ -306,28 +312,30 @@ a unique address to manage
|
||||||
|
|
||||||
|
<parameter name="arp_interval">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Specify the interval between unsolicited ARP packets in milliseconds.
|
||||||
|
+Specify the interval between unsolicited ARP (IPv4) or NA (IPv6) packets in
|
||||||
|
+milliseconds.
|
||||||
|
|
||||||
|
This parameter is deprecated and used for the backward compatibility only.
|
||||||
|
It is effective only for the send_arp binary which is built with libnet,
|
||||||
|
and send_ua for IPv6. It has no effect for other arp_sender.
|
||||||
|
</longdesc>
|
||||||
|
-<shortdesc lang="en">ARP packet interval in ms (deprecated)</shortdesc>
|
||||||
|
+<shortdesc lang="en">ARP/NA packet interval in ms (deprecated)</shortdesc>
|
||||||
|
<content type="integer" default="${OCF_RESKEY_arp_interval_default}"/>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<parameter name="arp_count">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Number of unsolicited ARP packets to send at resource initialization.
|
||||||
|
+Number of unsolicited ARP (IPv4) or NA (IPv6) packets to send at resource
|
||||||
|
+initialization.
|
||||||
|
</longdesc>
|
||||||
|
-<shortdesc lang="en">ARP packet count sent during initialization</shortdesc>
|
||||||
|
+<shortdesc lang="en">ARP/NA packet count sent during initialization</shortdesc>
|
||||||
|
<content type="integer" default="${OCF_RESKEY_arp_count_default}"/>
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<parameter name="arp_count_refresh">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Number of unsolicited ARP packets to send during resource monitoring. Doing
|
||||||
|
-so helps mitigate issues of stuck ARP caches resulting from split-brain
|
||||||
|
+For IPv4, number of unsolicited ARP packets to send during resource monitoring.
|
||||||
|
+Doing so helps mitigate issues of stuck ARP caches resulting from split-brain
|
||||||
|
situations.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">ARP packet count sent during monitoring</shortdesc>
|
||||||
|
@@ -345,7 +353,7 @@ The default is true for IPv4 and false for IPv6.
|
||||||
|
|
||||||
|
<parameter name="arp_sender">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-The program to send ARP packets with on start. Available options are:
|
||||||
|
+For IPv4, the program to send ARP packets with on start. Available options are:
|
||||||
|
- send_arp: default
|
||||||
|
- ipoibarping: default for infiniband interfaces if ipoibarping is available
|
||||||
|
- iputils_arping: use arping in iputils package
|
||||||
|
@@ -357,7 +365,7 @@ The program to send ARP packets with on start. Available options are:
|
||||||
|
|
||||||
|
<parameter name="send_arp_opts">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Extra options to pass to the arp_sender program.
|
||||||
|
+For IPv4, extra options to pass to the arp_sender program.
|
||||||
|
Available options are vary depending on which arp_sender is used.
|
||||||
|
|
||||||
|
A typical use case is specifying '-A' for iputils_arping to use
|
||||||
|
@@ -388,7 +396,7 @@ IP address goes away.
|
||||||
|
|
||||||
|
<parameter name="run_arping">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Whether or not to run arping for IPv4 collision detection check.
|
||||||
|
+For IPv4, whether or not to run arping for collision detection check.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Run arping for IPv4 collision detection check</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_run_arping_default}"/>
|
@ -0,0 +1,401 @@
|
|||||||
|
From d59a000da2766476538bb82d1889f5c0f3882f9f Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jan Friesse <jfriesse@redhat.com>
|
||||||
|
Date: Wed, 2 Mar 2022 18:43:31 +0100
|
||||||
|
Subject: [PATCH] corosync-qnetd: Add resource agent
|
||||||
|
|
||||||
|
Mostly for better monitor operation using corosync-qnetd-tool. As qnetd
|
||||||
|
is (almost) stateless only directory which has to be copied (once)
|
||||||
|
across the nodes is nss db directory (usually
|
||||||
|
/etc/corosync/qnetd/nssdb).
|
||||||
|
|
||||||
|
Signed-off-by: Jan Friesse <jfriesse@redhat.com>
|
||||||
|
---
|
||||||
|
doc/man/Makefile.am | 1 +
|
||||||
|
heartbeat/Makefile.am | 1 +
|
||||||
|
heartbeat/corosync-qnetd | 353 +++++++++++++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 355 insertions(+)
|
||||||
|
create mode 100755 heartbeat/corosync-qnetd
|
||||||
|
|
||||||
|
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
|
||||||
|
index 1093717fe..013aa392d 100644
|
||||||
|
--- a/doc/man/Makefile.am
|
||||||
|
+++ b/doc/man/Makefile.am
|
||||||
|
@@ -127,6 +127,7 @@ man_MANS = ocf_heartbeat_AoEtarget.7 \
|
||||||
|
ocf_heartbeat_azure-lb.7 \
|
||||||
|
ocf_heartbeat_clvm.7 \
|
||||||
|
ocf_heartbeat_conntrackd.7 \
|
||||||
|
+ ocf_heartbeat_corosync-qnetd.7 \
|
||||||
|
ocf_heartbeat_crypt.7 \
|
||||||
|
ocf_heartbeat_db2.7 \
|
||||||
|
ocf_heartbeat_dhcpd.7 \
|
||||||
|
diff --git a/heartbeat/Makefile.am b/heartbeat/Makefile.am
|
||||||
|
index 67b400679..38154e2da 100644
|
||||||
|
--- a/heartbeat/Makefile.am
|
||||||
|
+++ b/heartbeat/Makefile.am
|
||||||
|
@@ -101,6 +101,7 @@ ocf_SCRIPTS = AoEtarget \
|
||||||
|
azure-lb \
|
||||||
|
clvm \
|
||||||
|
conntrackd \
|
||||||
|
+ corosync-qnetd \
|
||||||
|
crypt \
|
||||||
|
db2 \
|
||||||
|
dhcpd \
|
||||||
|
diff --git a/heartbeat/corosync-qnetd b/heartbeat/corosync-qnetd
|
||||||
|
new file mode 100755
|
||||||
|
index 000000000..6b9777711
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/heartbeat/corosync-qnetd
|
||||||
|
@@ -0,0 +1,353 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+#
|
||||||
|
+# Copyright (C) 2022 Red Hat, Inc. All rights reserved.
|
||||||
|
+#
|
||||||
|
+# Authors: Jan Friesse <jfriesse@redhat.com>
|
||||||
|
+#
|
||||||
|
+# 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"
|
||||||
|
+
|
||||||
|
+# Use runuser if available for SELinux.
|
||||||
|
+if [ -x "/sbin/runuser" ]; then
|
||||||
|
+ SU="runuser"
|
||||||
|
+else
|
||||||
|
+ SU="su"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# Attempt to detect a default binary
|
||||||
|
+OCF_RESKEY_binary_default=$(which corosync-qnetd 2> /dev/null)
|
||||||
|
+if [ "${OCF_RESKEY_binary_default}" = "" ]; then
|
||||||
|
+ OCF_RESKEY_binary_default="/usr/bin/corosync-qnetd"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# Defaults
|
||||||
|
+OCF_RESKEY_qnetd_opts_default=""
|
||||||
|
+OCF_RESKEY_qnetd_tool_binary_default="/usr/bin/corosync-qnetd-tool"
|
||||||
|
+OCF_RESKEY_ip_default=""
|
||||||
|
+OCF_RESKEY_port_default=""
|
||||||
|
+OCF_RESKEY_nss_db_dir_default=""
|
||||||
|
+OCF_RESKEY_pid_default="/var/run/corosync-qnetd/corosync-qnetd-${OCF_RESOURCE_INSTANCE}.pid"
|
||||||
|
+OCF_RESKEY_ipc_sock_default="/var/run/corosync-qnetd/corosync-qnetd-${OCF_RESOURCE_INSTANCE}.sock"
|
||||||
|
+OCF_RESKEY_user_default="coroqnetd"
|
||||||
|
+OCF_RESKEY_group_default="${OCF_RESKEY_user_default}"
|
||||||
|
+
|
||||||
|
+: "${OCF_RESKEY_binary=${OCF_RESKEY_binary_default}}"
|
||||||
|
+: "${OCF_RESKEY_qnetd_opts=${OCF_RESKEY_qnetd_opts_default}}"
|
||||||
|
+: "${OCF_RESKEY_qnetd_tool_binary=${OCF_RESKEY_qnetd_tool_binary_default}}"
|
||||||
|
+: "${OCF_RESKEY_ip=${OCF_RESKEY_ip_default}}"
|
||||||
|
+: "${OCF_RESKEY_port=${OCF_RESKEY_port_default}}"
|
||||||
|
+: "${OCF_RESKEY_nss_db_dir=${OCF_RESKEY_nss_db_dir_default}}"
|
||||||
|
+: "${OCF_RESKEY_pid=${OCF_RESKEY_pid_default}}"
|
||||||
|
+: "${OCF_RESKEY_ipc_sock=${OCF_RESKEY_ipc_sock_default}}"
|
||||||
|
+: "${OCF_RESKEY_user=${OCF_RESKEY_user_default}}"
|
||||||
|
+: "${OCF_RESKEY_group=${OCF_RESKEY_group_default}}"
|
||||||
|
+
|
||||||
|
+corosync_qnetd_usage() {
|
||||||
|
+ cat <<END
|
||||||
|
+usage: $0 {start|stop|status|monitor|validate-all|meta-data}
|
||||||
|
+
|
||||||
|
+Expects to have a fully populated OCF RA-compliant environment set.
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+corosync_qnetd_meta_data() {
|
||||||
|
+ cat <<END
|
||||||
|
+<?xml version="1.0"?>
|
||||||
|
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||||
|
+<resource-agent name="corosync-qnetd" version="1.0">
|
||||||
|
+<version>1.0</version>
|
||||||
|
+
|
||||||
|
+<longdesc lang="en">OCF Resource script for corosync-qnetd. It manages a corosync-qnetd
|
||||||
|
+instance as a HA resource. It is required to copy nss db directory (usually /etc/corosync/qnetd/nssdb)
|
||||||
|
+across all nodes (only once - after database is initialized).</longdesc>
|
||||||
|
+<shortdesc lang="en">Corosync QNet daemon resource agent</shortdesc>
|
||||||
|
+
|
||||||
|
+<parameters>
|
||||||
|
+
|
||||||
|
+<parameter name="binary">
|
||||||
|
+ <longdesc lang="en">Location of the corosync-qnetd binary</longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd binary</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_binary_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="qnetd_opts">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ Additional options for corosync-qnetd binary. "-4" for example.
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd extra options</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_qnetd_opts_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="qnetd_tool_binary">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ The absolute path to the corosync-qnetd-tool for monitoring with OCF_CHECK_LEVEL greater zero.
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">The absolute path to the corosync-qnetd-tool binary</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_qnetd_tool_binary_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="ip">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ IP address to listen on. By default the daemon listens on all addresses (wildcard).
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">IP address to listen on</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_ip_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="port">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ TCP port to listen on. Default port is 5403.
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">TCP port to listen on</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_port_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="nss_db_dir">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ Location of the corosync-qnetd nss db directory (empty for default - usually /etc/corosync/qnetd/nssdb)
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd nss db directory</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_nss_db_dir_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="pid">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ Location of the corosync-qnetd pid/lock
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd pid file</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_pid_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="ipc_sock">
|
||||||
|
+ <longdesc lang="en">
|
||||||
|
+ Location of the corosync-qnetd ipc socket
|
||||||
|
+ </longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd ipc socket file</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_ipc_sock_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="user">
|
||||||
|
+ <longdesc lang="en">User running corosync-qnetd</longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd user</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_user_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="group">
|
||||||
|
+ <longdesc lang="en">Group running corosync-qnetd</longdesc>
|
||||||
|
+ <shortdesc lang="en">corosync-qnetd group</shortdesc>
|
||||||
|
+ <content type="string" default="${OCF_RESKEY_group_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+</parameters>
|
||||||
|
+
|
||||||
|
+<actions>
|
||||||
|
+<action name="start" timeout="20s" />
|
||||||
|
+<action name="stop" timeout="20s" />
|
||||||
|
+<action name="status" timeout="20s" />
|
||||||
|
+<action name="monitor" depth="0" timeout="20s" interval="10s" start-delay="10s" />
|
||||||
|
+<action name="validate-all" timeout="20s" />
|
||||||
|
+<action name="meta-data" timeout="20s" />
|
||||||
|
+</actions>
|
||||||
|
+</resource-agent>
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+corosync_qnetd_status() {
|
||||||
|
+ ocf_pidfile_status "${OCF_RESKEY_pid}" > /dev/null 2>&1
|
||||||
|
+ case "$?" in
|
||||||
|
+ 0)
|
||||||
|
+ rc="$OCF_SUCCESS"
|
||||||
|
+ ;;
|
||||||
|
+ 1|2)
|
||||||
|
+ rc="$OCF_NOT_RUNNING"
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ rc="$OCF_ERR_GENERIC"
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+
|
||||||
|
+ return "$rc"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+corosync_qnetd_start() {
|
||||||
|
+ corosync_qnetd_validate_all
|
||||||
|
+ rc="$?"
|
||||||
|
+
|
||||||
|
+ if [ "$rc" -ne 0 ]; then
|
||||||
|
+ return "$rc"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # if resource is already running,no need to continue code after this.
|
||||||
|
+ if corosync_qnetd_status; then
|
||||||
|
+ ocf_log info "corosync-qnetd is already running"
|
||||||
|
+ return "${OCF_SUCCESS}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ pid_dir=$(dirname "${OCF_RESKEY_pid}")
|
||||||
|
+ sock_dir=$(dirname "${OCF_RESKEY_ipc_sock}")
|
||||||
|
+
|
||||||
|
+ for d in "$pid_dir" "$sock_dir";do
|
||||||
|
+ if [ ! -d "$d" ];then
|
||||||
|
+ mkdir -p "$d"
|
||||||
|
+ chmod 0770 "$d"
|
||||||
|
+ chown "${OCF_RESKEY_user}:${OCF_RESKEY_group}" "$d"
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ params="-S \"local_socket_file=${OCF_RESKEY_ipc_sock}\" -S \"lock_file=${OCF_RESKEY_pid}\""
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_nss_db_dir}" ];then
|
||||||
|
+ params="$params -S \"nss_db_dir=${OCF_RESKEY_nss_db_dir}\""
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_ip}" ];then
|
||||||
|
+ params="$params -l \"${OCF_RESKEY_ip}\""
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_port}" ];then
|
||||||
|
+ params="$params -p \"${OCF_RESKEY_port}\""
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ params="$params ${OCF_RESKEY_qnetd_opts}"
|
||||||
|
+
|
||||||
|
+ ocf_run "$SU" -s "/bin/sh" "${OCF_RESKEY_user}" -c "${OCF_RESKEY_binary} $params"
|
||||||
|
+
|
||||||
|
+ while :; do
|
||||||
|
+ corosync_qnetd_monitor "debug"
|
||||||
|
+ rc="$?"
|
||||||
|
+
|
||||||
|
+ if [ "$rc" -eq "${OCF_SUCCESS}" ]; then
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ sleep 1
|
||||||
|
+
|
||||||
|
+ ocf_log debug "corosync-qnetd still hasn't started yet. Waiting..."
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ ocf_log info "corosync-qnetd started"
|
||||||
|
+ return "${OCF_SUCCESS}"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+corosync_qnetd_stop() {
|
||||||
|
+ corosync_qnetd_status
|
||||||
|
+
|
||||||
|
+ if [ "$?" -ne "$OCF_SUCCESS" ]; then
|
||||||
|
+ # Currently not running. Nothing to do.
|
||||||
|
+ ocf_log info "corosync-qnetd is already stopped"
|
||||||
|
+
|
||||||
|
+ return "$OCF_SUCCESS"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ pid=$(cat "${OCF_RESKEY_pid}")
|
||||||
|
+ kill "$pid"
|
||||||
|
+
|
||||||
|
+ # Wait for process to stop
|
||||||
|
+ while corosync_qnetd_monitor "debug"; do
|
||||||
|
+ sleep 1
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ ocf_log info "corosync-qnetd stopped"
|
||||||
|
+ return "$OCF_SUCCESS"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+corosync_qnetd_monitor() {
|
||||||
|
+ loglevel=${1:-err}
|
||||||
|
+
|
||||||
|
+ corosync_qnetd_status
|
||||||
|
+ rc="$?"
|
||||||
|
+
|
||||||
|
+ if [ "$rc" -ne "$OCF_SUCCESS" ];then
|
||||||
|
+ return "$rc"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ out=$("${OCF_RESKEY_qnetd_tool_binary}" -s -p "${OCF_RESKEY_ipc_sock}" 2>&1 >/dev/null)
|
||||||
|
+ rc="$?"
|
||||||
|
+
|
||||||
|
+ if [ "$rc" != 0 ];then
|
||||||
|
+ ocf_log "$loglevel" "$out"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ case "$rc" in
|
||||||
|
+ "0") rc="$OCF_SUCCESS" ;;
|
||||||
|
+ "3") rc="$OCF_NOT_RUNNING" ;;
|
||||||
|
+ *) rc="$OCF_ERR_GENERIC" ;;
|
||||||
|
+ esac
|
||||||
|
+
|
||||||
|
+ return "$rc"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+corosync_qnetd_validate_all() {
|
||||||
|
+ check_binary "${OCF_RESKEY_binary}"
|
||||||
|
+
|
||||||
|
+ check_binary "${OCF_RESKEY_qnetd_tool_binary}"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# **************************** MAIN SCRIPT ************************************
|
||||||
|
+
|
||||||
|
+# Make sure meta-data and usage always succeed
|
||||||
|
+case "$__OCF_ACTION" in
|
||||||
|
+ meta-data)
|
||||||
|
+ corosync_qnetd_meta_data
|
||||||
|
+ exit "$OCF_SUCCESS"
|
||||||
|
+ ;;
|
||||||
|
+ usage|help)
|
||||||
|
+ corosync_qnetd_usage
|
||||||
|
+ exit "$OCF_SUCCESS"
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+
|
||||||
|
+# This OCF agent script need to be run as root user.
|
||||||
|
+if ! ocf_is_root; then
|
||||||
|
+ echo "$0 agent script need to be run as root user."
|
||||||
|
+ ocf_log debug "$0 agent script need to be run as root user."
|
||||||
|
+ exit "$OCF_ERR_GENERIC"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+# Translate each action into the appropriate function call
|
||||||
|
+case "$__OCF_ACTION" in
|
||||||
|
+ start)
|
||||||
|
+ corosync_qnetd_start
|
||||||
|
+ ;;
|
||||||
|
+ stop)
|
||||||
|
+ corosync_qnetd_stop
|
||||||
|
+ ;;
|
||||||
|
+ status)
|
||||||
|
+ corosync_qnetd_status
|
||||||
|
+ ;;
|
||||||
|
+ monitor)
|
||||||
|
+ corosync_qnetd_monitor
|
||||||
|
+ ;;
|
||||||
|
+ validate-all)
|
||||||
|
+ corosync_qnetd_validate_all
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ corosync_qnetd_usage
|
||||||
|
+ exit "$OCF_ERR_UNIMPLEMENTED"
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+
|
||||||
|
+rc="$?"
|
||||||
|
+exit "$rc"
|
||||||
|
+# End of this script
|
@ -0,0 +1,44 @@
|
|||||||
|
From 26de0ad2f0f975166fe79ef72ab08e2c03519eea Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Mon, 28 Mar 2022 13:25:35 +0200
|
||||||
|
Subject: [PATCH] Filesystem: fix logic for UUID/label devices with space
|
||||||
|
between parameter and UUID/label
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/Filesystem | 14 ++++++++++----
|
||||||
|
1 file changed, 10 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
|
||||||
|
index 1a90d6a42..72a1b8623 100755
|
||||||
|
--- a/heartbeat/Filesystem
|
||||||
|
+++ b/heartbeat/Filesystem
|
||||||
|
@@ -596,11 +596,11 @@ Filesystem_start()
|
||||||
|
flushbufs "$DEVICE"
|
||||||
|
# Mount the filesystem.
|
||||||
|
case "$FSTYPE" in
|
||||||
|
- none) $MOUNT $options "$DEVICE" "$MOUNTPOINT" &&
|
||||||
|
+ none) $MOUNT $options $device_opt "$DEVICE" "$MOUNTPOINT" &&
|
||||||
|
bind_mount
|
||||||
|
;;
|
||||||
|
- "") $MOUNT $options "$DEVICE" "$MOUNTPOINT" ;;
|
||||||
|
- *) $MOUNT -t "$FSTYPE" $options "$DEVICE" "$MOUNTPOINT" ;;
|
||||||
|
+ "") $MOUNT $options $device_opt "$DEVICE" "$MOUNTPOINT" ;;
|
||||||
|
+ *) $MOUNT -t "$FSTYPE" $options $device_opt "$DEVICE" "$MOUNTPOINT" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
@@ -902,7 +902,13 @@ set_blockdevice_var() {
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$DEVICE" in
|
||||||
|
- -*) # Oh... An option to mount instead... Typically -U or -L
|
||||||
|
+ --*) # Typically --uuid or --label
|
||||||
|
+ device_opt=$(echo $DEVICE | sed -E "s/([[:blank:]]|=).*//")
|
||||||
|
+ DEVICE=$(echo $DEVICE | sed -E "s/$device_opt([[:blank:]]*|=)//")
|
||||||
|
+ ;;
|
||||||
|
+ -*) # Oh... An option to mount instead... Typically -U or -L
|
||||||
|
+ device_opt=$(echo $DEVICE | cut -c1-2)
|
||||||
|
+ DEVICE=$(echo $DEVICE | sed "s/$device_opt[[:blank:]]*//")
|
||||||
|
;;
|
||||||
|
/dev/null) # Special case for BSC
|
||||||
|
blockdevice=yes
|
@ -0,0 +1,38 @@
|
|||||||
|
From d9b46474fc19d9c57e2cfb752d60319017da8410 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Wed, 6 Apr 2022 14:14:19 +0200
|
||||||
|
Subject: [PATCH] Filesystem: improve logic for UUID/label and add note that
|
||||||
|
/dev/disk/by-{uuid,label}/ are preferred on Linux
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/Filesystem | 8 +++++---
|
||||||
|
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/Filesystem b/heartbeat/Filesystem
|
||||||
|
index 72a1b8623..44270ad98 100755
|
||||||
|
--- a/heartbeat/Filesystem
|
||||||
|
+++ b/heartbeat/Filesystem
|
||||||
|
@@ -163,6 +163,8 @@ directory where the status file is to be placed.
|
||||||
|
<parameter name="device" required="1">
|
||||||
|
<longdesc lang="en">
|
||||||
|
The name of block device for the filesystem, or -U, -L options for mount, or NFS mount specification.
|
||||||
|
+
|
||||||
|
+NOTE: On Linux /dev/disk/by-{uuid,label}/ are preferred to -U/-L.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">block device</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_device_default}" />
|
||||||
|
@@ -902,11 +904,11 @@ set_blockdevice_var() {
|
||||||
|
fi
|
||||||
|
|
||||||
|
case "$DEVICE" in
|
||||||
|
- --*) # Typically --uuid or --label
|
||||||
|
- device_opt=$(echo $DEVICE | sed -E "s/([[:blank:]]|=).*//")
|
||||||
|
+ --uuid=*|--uuid\ *|--label=*|--label\ *)
|
||||||
|
+ device_opt=$(echo $DEVICE | sed "s/\([[:blank:]]\|=\).*//")
|
||||||
|
DEVICE=$(echo $DEVICE | sed -E "s/$device_opt([[:blank:]]*|=)//")
|
||||||
|
;;
|
||||||
|
- -*) # Oh... An option to mount instead... Typically -U or -L
|
||||||
|
+ -U*|-L*) # short versions of --uuid/--label
|
||||||
|
device_opt=$(echo $DEVICE | cut -c1-2)
|
||||||
|
DEVICE=$(echo $DEVICE | sed "s/$device_opt[[:blank:]]*//")
|
||||||
|
;;
|
@ -0,0 +1,61 @@
|
|||||||
|
From 340e12c0d457d244d375c2d805e78033c9dbdf78 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Kajinami <tkajinam@redhat.com>
|
||||||
|
Date: Wed, 04 May 2022 23:13:35 +0900
|
||||||
|
Subject: [PATCH] NovaCompute/Evacuate: Make user/project domain configurable
|
||||||
|
|
||||||
|
... so that we can use a user or a project in a non-default keystone
|
||||||
|
domain.
|
||||||
|
|
||||||
|
Change-Id: I6e2175adca08fd97942cb83b8f8094e980b60c9d
|
||||||
|
---
|
||||||
|
|
||||||
|
diff --git a/heartbeat/NovaEvacuate b/heartbeat/NovaEvacuate
|
||||||
|
index 596f520..4565766 100644
|
||||||
|
--- a/heartbeat/NovaEvacuate
|
||||||
|
+++ b/heartbeat/NovaEvacuate
|
||||||
|
@@ -63,13 +63,29 @@
|
||||||
|
|
||||||
|
<parameter name="tenant_name" unique="0" required="1">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Tenant name for connecting to keystone in admin context.
|
||||||
|
+Tenant(Project) name for connecting to keystone in admin context.
|
||||||
|
Note that with Keystone V3 tenant names are only unique within a domain.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Tenant name</shortdesc>
|
||||||
|
<content type="string" default="" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
+<parameter name="user_domain" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Keystone domain the user belongs to
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Keystone v3 User Domain</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="project_domain" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Keystone domain the tenant(project) belongs to
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Keystone v3 Project Domain</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
<parameter name="domain" unique="0" required="0">
|
||||||
|
<longdesc lang="en">
|
||||||
|
DNS domain in which hosts live, useful when the cluster uses short names and nova uses FQDN
|
||||||
|
@@ -319,6 +335,14 @@
|
||||||
|
|
||||||
|
fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
|
||||||
|
|
||||||
|
+ if [ -n "${OCF_RESKEY_user_domain}" ]; then
|
||||||
|
+ fence_options="${fence_options} -u ${OCF_RESKEY_user_domain}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_project_domain}" ]; then
|
||||||
|
+ fence_options="${fence_options} -P ${OCF_RESKEY_project_domain}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
if [ -n "${OCF_RESKEY_domain}" ]; then
|
||||||
|
fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
|
||||||
|
fi
|
@ -0,0 +1,55 @@
|
|||||||
|
From bb5cfa172ca58cd8adcedcaca92bde54d0645661 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Thu, 14 Jul 2022 10:55:19 +0200
|
||||||
|
Subject: [PATCH] openstack-agents: set domain parameter's default to Default
|
||||||
|
and fix missing parameter name in ocf_exit_reason
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/openstack-common.sh | 10 +++++++---
|
||||||
|
1 file changed, 7 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/openstack-common.sh b/heartbeat/openstack-common.sh
|
||||||
|
index b6eec09c..14d290bd 100644
|
||||||
|
--- a/heartbeat/openstack-common.sh
|
||||||
|
+++ b/heartbeat/openstack-common.sh
|
||||||
|
@@ -1,6 +1,10 @@
|
||||||
|
+OCF_RESKEY_user_domain_name_default="Default"
|
||||||
|
+OCF_RESKEY_project_domain_name_default="Default"
|
||||||
|
OCF_RESKEY_openstackcli_default="/usr/bin/openstack"
|
||||||
|
OCF_RESKEY_insecure_default="false"
|
||||||
|
|
||||||
|
+: ${OCF_RESKEY_user_domain_name=${OCF_RESKEY_user_domain_name_default}}
|
||||||
|
+: ${OCF_RESKEY_project_domain_name=${OCF_RESKEY_project_domain_name_default}}
|
||||||
|
: ${OCF_RESKEY_openstackcli=${OCF_RESKEY_openstackcli_default}}
|
||||||
|
: ${OCF_RESKEY_insecure=${OCF_RESKEY_insecure_default}}
|
||||||
|
|
||||||
|
@@ -64,7 +68,7 @@ Keystone Project.
|
||||||
|
Keystone User Domain Name.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Keystone User Domain Name</shortdesc>
|
||||||
|
-<content type="string" />
|
||||||
|
+<content type="string" default="${OCF_RESKEY_user_domain_name_default}" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<parameter name="project_domain_name" required="0">
|
||||||
|
@@ -72,7 +76,7 @@ Keystone User Domain Name.
|
||||||
|
Keystone Project Domain Name.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Keystone Project Domain Name</shortdesc>
|
||||||
|
-<content type="string" />
|
||||||
|
+<content type="string" default="${OCF_RESKEY_project_domain_name_default}" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
<parameter name="openstackcli">
|
||||||
|
@@ -133,7 +137,7 @@ get_config() {
|
||||||
|
exit $OCF_ERR_CONFIGURED
|
||||||
|
fi
|
||||||
|
if [ -z "$OCF_RESKEY_project_domain_name" ]; then
|
||||||
|
- ocf_exit_reason " not set"
|
||||||
|
+ ocf_exit_reason "project_domain_name not set"
|
||||||
|
exit $OCF_ERR_CONFIGURED
|
||||||
|
fi
|
||||||
|
|
||||||
|
--
|
||||||
|
2.36.1
|
||||||
|
|
@ -0,0 +1,770 @@
|
|||||||
|
diff --color -uNr a/heartbeat/Makefile.am b/heartbeat/Makefile.am
|
||||||
|
--- a/heartbeat/Makefile.am 2022-03-15 16:14:29.355209012 +0100
|
||||||
|
+++ b/heartbeat/Makefile.am 2022-03-15 16:18:35.917048467 +0100
|
||||||
|
@@ -217,6 +217,7 @@
|
||||||
|
lvm-clvm.sh \
|
||||||
|
lvm-plain.sh \
|
||||||
|
lvm-tag.sh \
|
||||||
|
+ openstack-common.sh \
|
||||||
|
ora-common.sh \
|
||||||
|
mysql-common.sh \
|
||||||
|
nfsserver-redhat.sh \
|
||||||
|
diff --color -uNr a/heartbeat/openstack-cinder-volume b/heartbeat/openstack-cinder-volume
|
||||||
|
--- a/heartbeat/openstack-cinder-volume 2022-03-15 16:14:29.370209063 +0100
|
||||||
|
+++ b/heartbeat/openstack-cinder-volume 2022-03-15 16:17:36.231840008 +0100
|
||||||
|
@@ -34,11 +34,11 @@
|
||||||
|
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
|
||||||
|
+. ${OCF_FUNCTIONS_DIR}/openstack-common.sh
|
||||||
|
+
|
||||||
|
# Defaults
|
||||||
|
-OCF_RESKEY_openstackcli_default="/usr/bin/openstack"
|
||||||
|
OCF_RESKEY_volume_local_check_default="true"
|
||||||
|
|
||||||
|
-: ${OCF_RESKEY_openstackcli=${OCF_RESKEY_openstackcli_default}}
|
||||||
|
: ${OCF_RESKEY_volume_local_check=${OCF_RESKEY_volume_local_check_default}}
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
@@ -68,14 +68,11 @@
|
||||||
|
<shortdesc lang="en">Attach a cinder volume</shortdesc>
|
||||||
|
|
||||||
|
<parameters>
|
||||||
|
-<parameter name="openstackcli">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Path to command line tools for openstack.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">Path to Openstack CLI tool</shortdesc>
|
||||||
|
-<content type="string" default="${OCF_RESKEY_openstackcli_default}" />
|
||||||
|
-</parameter>
|
||||||
|
+END
|
||||||
|
|
||||||
|
+common_meta_data
|
||||||
|
+
|
||||||
|
+cat <<END
|
||||||
|
<parameter name="volume_local_check">
|
||||||
|
<longdesc lang="en">
|
||||||
|
This option allows the cluster to monitor the cinder volume presence without
|
||||||
|
@@ -85,28 +82,19 @@
|
||||||
|
<content type="boolean" default="${OCF_RESKEY_volume_local_check_default}" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
-<parameter name="openrc" required="1">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Valid Openstack credentials as openrc file from api_access/openrc.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">openrc file</shortdesc>
|
||||||
|
-<content type="string" />
|
||||||
|
-</parameter>
|
||||||
|
-
|
||||||
|
<parameter name="volume_id" required="1">
|
||||||
|
<longdesc lang="en">
|
||||||
|
-Cinder volume identifier to use to attach the bloc storage.
|
||||||
|
+Cinder volume identifier to use to attach the block storage.
|
||||||
|
</longdesc>
|
||||||
|
<shortdesc lang="en">Volume ID</shortdesc>
|
||||||
|
<content type="string" />
|
||||||
|
</parameter>
|
||||||
|
-
|
||||||
|
</parameters>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
<action name="start" timeout="180s" />
|
||||||
|
<action name="stop" timeout="180s" />
|
||||||
|
-<action name="monitor" depth="0" timeout="30s" interval="60s" />
|
||||||
|
+<action name="monitor" depth="0" timeout="180s" interval="60s" />
|
||||||
|
<action name="validate-all" timeout="5s" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
</actions>
|
||||||
|
@@ -127,17 +115,7 @@
|
||||||
|
osvol_validate() {
|
||||||
|
check_binary "$OCF_RESKEY_openstackcli"
|
||||||
|
|
||||||
|
- if [ -z "$OCF_RESKEY_openrc" ]; then
|
||||||
|
- ocf_exit_reason "openrc parameter not set"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- if [ ! -f "$OCF_RESKEY_openrc" ] ; then
|
||||||
|
- ocf_exit_reason "openrc file not found"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- . $OCF_RESKEY_openrc
|
||||||
|
+ get_config
|
||||||
|
|
||||||
|
if ! $OCF_RESKEY_openstackcli volume list|grep -q $OCF_RESKEY_volume_id ; then
|
||||||
|
ocf_exit_reason "volume-id $OCF_RESKEY_volume_id not found"
|
||||||
|
diff --color -uNr a/heartbeat/openstack-common.sh b/heartbeat/openstack-common.sh
|
||||||
|
--- a/heartbeat/openstack-common.sh 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ b/heartbeat/openstack-common.sh 2022-03-15 16:17:36.232840011 +0100
|
||||||
|
@@ -0,0 +1,147 @@
|
||||||
|
+OCF_RESKEY_openstackcli_default="/usr/bin/openstack"
|
||||||
|
+OCF_RESKEY_insecure_default="false"
|
||||||
|
+
|
||||||
|
+: ${OCF_RESKEY_openstackcli=${OCF_RESKEY_openstackcli_default}}
|
||||||
|
+: ${OCF_RESKEY_insecure=${OCF_RESKEY_insecure_default}}
|
||||||
|
+
|
||||||
|
+if ocf_is_true "${OCF_RESKEY_insecure}"; then
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --insecure"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+common_meta_data() {
|
||||||
|
+ cat <<END
|
||||||
|
+
|
||||||
|
+<parameter name="cloud" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Openstack cloud (from ~/.config/openstack/clouds.yaml or /etc/openstack/clouds.yaml).
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Cloud from clouds.yaml</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="openrc" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Openstack credentials as openrc file from api_access/openrc.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">openrc file</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="auth_url" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Keystone Auth URL
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Keystone Auth URL</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="username" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Username.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Username</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="password" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Password.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Password</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="project_name" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Keystone Project.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Keystone Project</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="user_domain_name" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Keystone User Domain Name.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Keystone User Domain Name</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="project_domain_name" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Keystone Project Domain Name.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Keystone Project Domain Name</shortdesc>
|
||||||
|
+<content type="string" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="openstackcli">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Path to command line tools for openstack.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Path to Openstack CLI tool</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_openstackcli_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="insecure">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Allow insecure connections
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Allow insecure connections</shortdesc>
|
||||||
|
+<content type="boolean" default="${OCF_RESKEY_insecure_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+get_config() {
|
||||||
|
+ if [ -n "$OCF_RESKEY_cloud" ]; then
|
||||||
|
+ TILDE=$(echo ~)
|
||||||
|
+ clouds_yaml="$TILDE/.config/openstack/clouds.yaml"
|
||||||
|
+ if [ ! -f "$clouds_yaml" ]; then
|
||||||
|
+ clouds_yaml="/etc/openstack/clouds.yaml"
|
||||||
|
+ fi
|
||||||
|
+ if [ ! -f "$clouds_yaml" ]; then
|
||||||
|
+ ocf_exit_reason "~/.config/openstack/clouds.yaml and /etc/openstack/clouds.yaml does not exist"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-cloud $OCF_RESKEY_cloud"
|
||||||
|
+ elif [ -n "$OCF_RESKEY_openrc" ]; then
|
||||||
|
+ if [ ! -f "$OCF_RESKEY_openrc" ]; then
|
||||||
|
+ ocf_exit_reason "$OCF_RESKEY_openrc does not exist"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ . $OCF_RESKEY_openrc
|
||||||
|
+ else
|
||||||
|
+ if [ -z "$OCF_RESKEY_auth_url" ]; then
|
||||||
|
+ ocf_exit_reason "auth_url not set"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_username" ]; then
|
||||||
|
+ ocf_exit_reason "username not set"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_password" ]; then
|
||||||
|
+ ocf_exit_reason "password not set"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_project_name" ]; then
|
||||||
|
+ ocf_exit_reason "project_name not set"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_user_domain_name" ]; then
|
||||||
|
+ ocf_exit_reason "user_domain_name not set"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ if [ -z "$OCF_RESKEY_project_domain_name" ]; then
|
||||||
|
+ ocf_exit_reason " not set"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-auth-url $OCF_RESKEY_auth_url"
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-username $OCF_RESKEY_username"
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-password $OCF_RESKEY_password"
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-project-name $OCF_RESKEY_project_name"
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-user-domain-name $OCF_RESKEY_user_domain_name"
|
||||||
|
+ OCF_RESKEY_openstackcli="${OCF_RESKEY_openstackcli} --os-project-domain-name $OCF_RESKEY_project_domain_name"
|
||||||
|
+ fi
|
||||||
|
+}
|
||||||
|
diff --color -uNr a/heartbeat/openstack-floating-ip b/heartbeat/openstack-floating-ip
|
||||||
|
--- a/heartbeat/openstack-floating-ip 2022-03-15 16:14:29.370209063 +0100
|
||||||
|
+++ b/heartbeat/openstack-floating-ip 2022-03-15 16:17:36.233840014 +0100
|
||||||
|
@@ -34,10 +34,9 @@
|
||||||
|
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
|
||||||
|
-# Defaults
|
||||||
|
-OCF_RESKEY_openstackcli_default="/usr/bin/openstack"
|
||||||
|
+. ${OCF_FUNCTIONS_DIR}/openstack-common.sh
|
||||||
|
|
||||||
|
-: ${OCF_RESKEY_openstackcli=${OCF_RESKEY_openstackcli_default}}
|
||||||
|
+# Defaults
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
@@ -67,22 +66,11 @@
|
||||||
|
<shortdesc lang="en">Move a floating IP</shortdesc>
|
||||||
|
|
||||||
|
<parameters>
|
||||||
|
-<parameter name="openstackcli">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Path to command line tools for openstack.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">Path to Openstack CLI tool</shortdesc>
|
||||||
|
-<content type="string" default="${OCF_RESKEY_openstackcli_default}" />
|
||||||
|
-</parameter>
|
||||||
|
+END
|
||||||
|
|
||||||
|
-<parameter name="openrc" required="1">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Valid Openstack credentials as openrc file from api_access/openrc.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">openrc file</shortdesc>
|
||||||
|
-<content type="string" />
|
||||||
|
-</parameter>
|
||||||
|
+common_meta_data
|
||||||
|
|
||||||
|
+cat <<END
|
||||||
|
<parameter name="ip_id" required="1">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Floating IP Identifier.
|
||||||
|
@@ -104,7 +92,7 @@
|
||||||
|
<actions>
|
||||||
|
<action name="start" timeout="180s" />
|
||||||
|
<action name="stop" timeout="180s" />
|
||||||
|
-<action name="monitor" depth="0" timeout="30s" interval="60s" />
|
||||||
|
+<action name="monitor" depth="0" timeout="180s" interval="60s" />
|
||||||
|
<action name="validate-all" timeout="5s" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
</actions>
|
||||||
|
@@ -115,17 +103,7 @@
|
||||||
|
osflip_validate() {
|
||||||
|
check_binary "$OCF_RESKEY_openstackcli"
|
||||||
|
|
||||||
|
- if [ -z "$OCF_RESKEY_openrc" ]; then
|
||||||
|
- ocf_exit_reason "openrc parameter not set"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- if [ ! -f "$OCF_RESKEY_openrc" ] ; then
|
||||||
|
- ocf_exit_reason "openrc file not found"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- . $OCF_RESKEY_openrc
|
||||||
|
+ get_config
|
||||||
|
|
||||||
|
if ! $OCF_RESKEY_openstackcli floating ip list|grep -q $OCF_RESKEY_ip_id ; then
|
||||||
|
ocf_exit_reason "ip-id $OCF_RESKEY_ip_id not found"
|
||||||
|
diff --color -uNr a/heartbeat/openstack-info b/heartbeat/openstack-info
|
||||||
|
--- a/heartbeat/openstack-info 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ b/heartbeat/openstack-info 2022-03-15 16:17:36.234840018 +0100
|
||||||
|
@@ -0,0 +1,270 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+#
|
||||||
|
+#
|
||||||
|
+# OCF resource agent to set attributes from Openstack instance details.
|
||||||
|
+# It records (in the CIB) various attributes of a node
|
||||||
|
+#
|
||||||
|
+# Copyright (c) 2018 Mathieu Grzybek
|
||||||
|
+# 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}/openstack-common.sh
|
||||||
|
+
|
||||||
|
+# Defaults
|
||||||
|
+OCF_RESKEY_pidfile_default="$HA_RSCTMP/OSInfo-${OCF_RESOURCE_HOSTNAME}"
|
||||||
|
+OCF_RESKEY_delay_default="0"
|
||||||
|
+OCF_RESKEY_clone_default="0"
|
||||||
|
+OCF_RESKEY_curlcli_default="/usr/bin/curl"
|
||||||
|
+OCF_RESKEY_pythoncli_default="/usr/bin/python"
|
||||||
|
+
|
||||||
|
+: ${OCF_RESKEY_curlcli=${OCF_RESKEY_curlcli_default}}
|
||||||
|
+: ${OCF_RESKEY_pythoncli=${OCF_RESKEY_pythoncli_default}}
|
||||||
|
+: ${OCF_RESKEY_pidfile=${OCF_RESKEY_pidfile_default}}
|
||||||
|
+: ${OCF_RESKEY_delay=${OCF_RESKEY_delay_default}}
|
||||||
|
+: ${OCF_RESKEY_clone=${OCF_RESKEY_clone_default}}
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+
|
||||||
|
+meta_data() {
|
||||||
|
+ cat <<END
|
||||||
|
+<?xml version="1.0"?>
|
||||||
|
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||||
|
+<resource-agent name="openstack-info" version="1.0">
|
||||||
|
+<version>1.0</version>
|
||||||
|
+
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+OCF resource agent to set attributes from Openstack instance details.
|
||||||
|
+It records (in the CIB) various attributes of a node.
|
||||||
|
+Sample output:
|
||||||
|
+ openstack_az : nova
|
||||||
|
+ openstack_flavor : c1.small
|
||||||
|
+ openstack_id : 60ac4343-5828-49b1-8aac-7c69b1417f31
|
||||||
|
+ openstack_ports : 7960d889-9750-4160-bf41-c69a41ad72d9:96530d18-57a3-4718-af32-30f2a74c22a2,b0e55a06-bd75-468d-8baa-22cfeb65799f:a55ae917-8016-4b1e-8ffa-04311b9dc7d6
|
||||||
|
+
|
||||||
|
+The layout of openstack_ports is a comma-separated list of tuples "subnet_id:port_id".
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Records various node attributes in the CIB</shortdesc>
|
||||||
|
+
|
||||||
|
+<parameters>
|
||||||
|
+END
|
||||||
|
+
|
||||||
|
+common_meta_data
|
||||||
|
+
|
||||||
|
+ cat <<END
|
||||||
|
+<parameter name="pidfile" unique="0">
|
||||||
|
+<longdesc lang="en">PID file</longdesc>
|
||||||
|
+<shortdesc lang="en">PID file</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_pidfile_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="delay" unique="0">
|
||||||
|
+<longdesc lang="en">Interval to allow values to stabilize</longdesc>
|
||||||
|
+<shortdesc lang="en">Dampening Delay</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_delay_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="curlcli">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Path to command line cURL binary.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Path to cURL binary</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_curlcli_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="pythoncli">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Path to command line Python interpreter.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Path to Python interpreter</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_pythoncli_default}" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+</parameters>
|
||||||
|
+
|
||||||
|
+<actions>
|
||||||
|
+<action name="start" timeout="180s" />
|
||||||
|
+<action name="stop" timeout="180s" />
|
||||||
|
+<action name="monitor" timeout="30s" interval="60s"/>
|
||||||
|
+<action name="meta-data" timeout="5s" />
|
||||||
|
+<action name="validate-all" timeout="20s" />
|
||||||
|
+</actions>
|
||||||
|
+</resource-agent>
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+
|
||||||
|
+OSInfoStats() {
|
||||||
|
+ local result
|
||||||
|
+ local value
|
||||||
|
+ local node
|
||||||
|
+ local node_id
|
||||||
|
+
|
||||||
|
+ get_config
|
||||||
|
+
|
||||||
|
+ # Nova data: server ID
|
||||||
|
+ node_id=$($OCF_RESKEY_curlcli \
|
||||||
|
+ -s http://169.254.169.254/openstack/latest/meta_data.json |
|
||||||
|
+ $OCF_RESKEY_pythoncli -m json.tool |
|
||||||
|
+ grep -P '\"uuid\": \".*\",$' |
|
||||||
|
+ grep -P -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||||
|
+
|
||||||
|
+ if [ $? -ne 0 ] ; then
|
||||||
|
+ ocf_exit_reason "Cannot find server ID"
|
||||||
|
+ exit $OCF_ERR_GENERIC
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_id -v "$node_id"
|
||||||
|
+
|
||||||
|
+ # Nova data: flavor
|
||||||
|
+ value=$($OCF_RESKEY_openstackcli server show \
|
||||||
|
+ --format value \
|
||||||
|
+ --column flavor \
|
||||||
|
+ $node_id)
|
||||||
|
+
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_flavor -v "$value"
|
||||||
|
+
|
||||||
|
+ # Nova data: availability zone
|
||||||
|
+ value=$($OCF_RESKEY_openstackcli server show \
|
||||||
|
+ --format value \
|
||||||
|
+ --column OS-EXT-AZ:availability_zone \
|
||||||
|
+ $node_id)
|
||||||
|
+
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_az -v "$value"
|
||||||
|
+
|
||||||
|
+ # Network data: ports
|
||||||
|
+ value=""
|
||||||
|
+ for port_id in $($OCF_RESKEY_openstackcli port list \
|
||||||
|
+ --format value \
|
||||||
|
+ --column id \
|
||||||
|
+ --server $node_id); do
|
||||||
|
+ subnet_id=$($OCF_RESKEY_openstackcli port show \
|
||||||
|
+ --format json \
|
||||||
|
+ --column fixed_ips \
|
||||||
|
+ ${port_id} | grep -P '\"subnet_id\": \".*\",$' |
|
||||||
|
+ grep -P -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||||
|
+ value+="${subnet_id}:${port_id},"
|
||||||
|
+ done
|
||||||
|
+ value=$(echo ${value} | sed -e 's/,$//g')
|
||||||
|
+
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_ports -v "$value"
|
||||||
|
+
|
||||||
|
+ if [ ! -z "$OS_REGION_NAME" ] ; then
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_region -v "$OS_REGION_NAME"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ ! -z "$OS_TENANT_ID" ] ; then
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_tenant_id -v "$OS_TENANT_ID"
|
||||||
|
+
|
||||||
|
+ if [ ! -z "$OS_TENANT_NAME" ] ; then
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_tenant_name -v "$OS_TENANT_NAME"
|
||||||
|
+ fi
|
||||||
|
+ else
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_project_id -v "$OS_PROJECT_ID"
|
||||||
|
+
|
||||||
|
+ if [ ! -z "$OS_PROJECT_NAME" ] ; then
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_project_name -v "$OS_PROJECT_NAME"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OSInfo_usage() {
|
||||||
|
+ cat <<END
|
||||||
|
+usage: $0 {start|stop|monitor|validate-all|meta-data}
|
||||||
|
+
|
||||||
|
+Expects to have a fully populated OCF RA-compliant environment set.
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OSInfo_start() {
|
||||||
|
+ echo $OCF_RESKEY_clone > $OCF_RESKEY_pidfile
|
||||||
|
+ OSInfoStats
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OSInfo_stop() {
|
||||||
|
+ rm -f $OCF_RESKEY_pidfile
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_id
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_flavor
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_az
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_ports
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_region
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_tenant_id
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_tenant_name
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_project_id
|
||||||
|
+ ${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -D -n openstack_project_name
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OSInfo_monitor() {
|
||||||
|
+ if [ -f "$OCF_RESKEY_pidfile" ] ; then
|
||||||
|
+ OSInfoStats
|
||||||
|
+ exit $OCF_RUNNING
|
||||||
|
+ fi
|
||||||
|
+ exit $OCF_NOT_RUNNING
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+OSInfo_validate() {
|
||||||
|
+ check_binary "$OCF_RESKEY_curlcli"
|
||||||
|
+ check_binary "$OCF_RESKEY_openstackcli"
|
||||||
|
+ check_binary "$OCF_RESKEY_pythoncli"
|
||||||
|
+
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if [ $# -ne 1 ]; then
|
||||||
|
+ OSInfo_usage
|
||||||
|
+ exit $OCF_ERR_ARGS
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+if [ x != x${OCF_RESKEY_delay} ]; then
|
||||||
|
+ OCF_RESKEY_delay="-d ${OCF_RESKEY_delay}"
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+case $__OCF_ACTION in
|
||||||
|
+meta-data) meta_data
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+start) OSInfo_validate || exit $?
|
||||||
|
+ OSInfo_start
|
||||||
|
+ ;;
|
||||||
|
+stop) OSInfo_stop
|
||||||
|
+ ;;
|
||||||
|
+monitor) OSInfo_monitor
|
||||||
|
+ ;;
|
||||||
|
+validate-all) OSInfo_validate
|
||||||
|
+ ;;
|
||||||
|
+usage|help) OSInfo_usage
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+*) OSInfo_usage
|
||||||
|
+ exit $OCF_ERR_UNIMPLEMENTED
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+
|
||||||
|
+exit $?
|
||||||
|
diff --color -uNr a/heartbeat/openstack-info.in b/heartbeat/openstack-info.in
|
||||||
|
--- a/heartbeat/openstack-info.in 2022-03-15 16:14:29.370209063 +0100
|
||||||
|
+++ b/heartbeat/openstack-info.in 2022-03-15 16:17:36.234840018 +0100
|
||||||
|
@@ -32,16 +32,16 @@
|
||||||
|
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
|
||||||
|
+. ${OCF_FUNCTIONS_DIR}/openstack-common.sh
|
||||||
|
+
|
||||||
|
# Defaults
|
||||||
|
OCF_RESKEY_pidfile_default="$HA_RSCTMP/OSInfo-${OCF_RESOURCE_HOSTNAME}"
|
||||||
|
OCF_RESKEY_delay_default="0"
|
||||||
|
OCF_RESKEY_clone_default="0"
|
||||||
|
OCF_RESKEY_curlcli_default="/usr/bin/curl"
|
||||||
|
-OCF_RESKEY_openstackcli_default="/usr/bin/openstack"
|
||||||
|
OCF_RESKEY_pythoncli_default="@PYTHON@"
|
||||||
|
|
||||||
|
: ${OCF_RESKEY_curlcli=${OCF_RESKEY_curlcli_default}}
|
||||||
|
-: ${OCF_RESKEY_openstackcli=${OCF_RESKEY_openstackcli_default}}
|
||||||
|
: ${OCF_RESKEY_pythoncli=${OCF_RESKEY_pythoncli_default}}
|
||||||
|
: ${OCF_RESKEY_pidfile=${OCF_RESKEY_pidfile_default}}
|
||||||
|
: ${OCF_RESKEY_delay=${OCF_RESKEY_delay_default}}
|
||||||
|
@@ -70,25 +70,23 @@
|
||||||
|
<shortdesc lang="en">Records various node attributes in the CIB</shortdesc>
|
||||||
|
|
||||||
|
<parameters>
|
||||||
|
+END
|
||||||
|
+
|
||||||
|
+common_meta_data
|
||||||
|
+
|
||||||
|
+ cat <<END
|
||||||
|
<parameter name="pidfile" unique="0">
|
||||||
|
<longdesc lang="en">PID file</longdesc>
|
||||||
|
<shortdesc lang="en">PID file</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_pidfile_default}" />
|
||||||
|
</parameter>
|
||||||
|
+
|
||||||
|
<parameter name="delay" unique="0">
|
||||||
|
<longdesc lang="en">Interval to allow values to stabilize</longdesc>
|
||||||
|
<shortdesc lang="en">Dampening Delay</shortdesc>
|
||||||
|
<content type="string" default="${OCF_RESKEY_delay_default}" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
-<parameter name="openrc" required="1">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Valid Openstack credentials as openrc file from api_access/openrc.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">openrc file</shortdesc>
|
||||||
|
-<content type="string" />
|
||||||
|
-</parameter>
|
||||||
|
-
|
||||||
|
<parameter name="curlcli">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Path to command line cURL binary.
|
||||||
|
@@ -97,14 +95,6 @@
|
||||||
|
<content type="string" default="${OCF_RESKEY_curlcli_default}" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
-<parameter name="openstackcli">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Path to command line tools for openstack.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">Path to Openstack CLI tool</shortdesc>
|
||||||
|
-<content type="string" default="${OCF_RESKEY_openstackcli_default}" />
|
||||||
|
-</parameter>
|
||||||
|
-
|
||||||
|
<parameter name="pythoncli">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Path to command line Python interpreter.
|
||||||
|
@@ -116,9 +106,9 @@
|
||||||
|
</parameters>
|
||||||
|
|
||||||
|
<actions>
|
||||||
|
-<action name="start" timeout="20s" />
|
||||||
|
-<action name="stop" timeout="20s" />
|
||||||
|
-<action name="monitor" timeout="20s" interval="60s"/>
|
||||||
|
+<action name="start" timeout="180s" />
|
||||||
|
+<action name="stop" timeout="180s" />
|
||||||
|
+<action name="monitor" timeout="180s" interval="60s"/>
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
<action name="validate-all" timeout="20s" />
|
||||||
|
</actions>
|
||||||
|
@@ -134,7 +124,7 @@
|
||||||
|
local node
|
||||||
|
local node_id
|
||||||
|
|
||||||
|
- . $OCF_RESKEY_openrc
|
||||||
|
+ get_config
|
||||||
|
|
||||||
|
# Nova data: server ID
|
||||||
|
node_id=$($OCF_RESKEY_curlcli \
|
||||||
|
@@ -244,16 +234,6 @@
|
||||||
|
check_binary "$OCF_RESKEY_openstackcli"
|
||||||
|
check_binary "$OCF_RESKEY_pythoncli"
|
||||||
|
|
||||||
|
- if [ -z "$OCF_RESKEY_openrc" ]; then
|
||||||
|
- ocf_exit_reason "openrc parameter not set"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- if [ ! -f "$OCF_RESKEY_openrc" ] ; then
|
||||||
|
- ocf_exit_reason "openrc file not found"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
return $OCF_SUCCESS
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --color -uNr a/heartbeat/openstack-virtual-ip b/heartbeat/openstack-virtual-ip
|
||||||
|
--- a/heartbeat/openstack-virtual-ip 2022-03-15 16:14:29.370209063 +0100
|
||||||
|
+++ b/heartbeat/openstack-virtual-ip 2022-03-15 16:17:36.235840021 +0100
|
||||||
|
@@ -34,10 +34,9 @@
|
||||||
|
: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
|
||||||
|
-# Defaults
|
||||||
|
-OCF_RESKEY_openstackcli_default="/usr/bin/openstack"
|
||||||
|
+. ${OCF_FUNCTIONS_DIR}/openstack-common.sh
|
||||||
|
|
||||||
|
-: ${OCF_RESKEY_openstackcli=${OCF_RESKEY_openstackcli_default}}
|
||||||
|
+# Defaults
|
||||||
|
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
@@ -68,22 +67,11 @@
|
||||||
|
<shortdesc lang="en">Move a virtual IP</shortdesc>
|
||||||
|
|
||||||
|
<parameters>
|
||||||
|
-<parameter name="openstackcli">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Path to command line tools for openstack.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">Path to Openstack CLI tool</shortdesc>
|
||||||
|
-<content type="string" default="${OCF_RESKEY_openstackcli_default}" />
|
||||||
|
-</parameter>
|
||||||
|
+END
|
||||||
|
|
||||||
|
-<parameter name="openrc" required="1">
|
||||||
|
-<longdesc lang="en">
|
||||||
|
-Valid Openstack credentials as openrc file from api_access/openrc.
|
||||||
|
-</longdesc>
|
||||||
|
-<shortdesc lang="en">openrc file</shortdesc>
|
||||||
|
-<content type="string" />
|
||||||
|
-</parameter>
|
||||||
|
+common_meta_data
|
||||||
|
|
||||||
|
+cat <<END
|
||||||
|
<parameter name="ip" required="1">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Virtual IP Address.
|
||||||
|
@@ -105,7 +93,7 @@
|
||||||
|
<actions>
|
||||||
|
<action name="start" timeout="180s" />
|
||||||
|
<action name="stop" timeout="180s" />
|
||||||
|
-<action name="monitor" depth="0" timeout="30s" interval="60s" />
|
||||||
|
+<action name="monitor" depth="0" timeout="180s" interval="60s" />
|
||||||
|
<action name="validate-all" timeout="5s" />
|
||||||
|
<action name="meta-data" timeout="5s" />
|
||||||
|
</actions>
|
||||||
|
@@ -128,17 +116,7 @@
|
||||||
|
osvip_validate() {
|
||||||
|
check_binary "$OCF_RESKEY_openstackcli"
|
||||||
|
|
||||||
|
- if [ -z "$OCF_RESKEY_openrc" ]; then
|
||||||
|
- ocf_exit_reason "openrc parameter not set"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- if [ ! -f "$OCF_RESKEY_openrc" ] ; then
|
||||||
|
- ocf_exit_reason "openrc file not found"
|
||||||
|
- return $OCF_ERR_CONFIGURED
|
||||||
|
- fi
|
||||||
|
-
|
||||||
|
- . $OCF_RESKEY_openrc
|
||||||
|
+ get_config
|
||||||
|
|
||||||
|
${HA_SBIN_DIR}/attrd_updater --query -n openstack_ports -N $(crm_node -n) > /dev/null 2>&1
|
||||||
|
if [ $? -ne 0 ] ; then
|
@ -0,0 +1,26 @@
|
|||||||
|
From 8b1d3257e5176a2f50a843a21888c4b4f51f370b Mon Sep 17 00:00:00 2001
|
||||||
|
From: Valentin Vidic <vvidic@valentin-vidic.from.hr>
|
||||||
|
Date: Sun, 3 Apr 2022 20:31:50 +0200
|
||||||
|
Subject: [PATCH] openstack-info: fix bashism
|
||||||
|
|
||||||
|
Also simplify striping of trailing comma.
|
||||||
|
---
|
||||||
|
heartbeat/openstack-info.in | 4 ++--
|
||||||
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/openstack-info.in b/heartbeat/openstack-info.in
|
||||||
|
index f6dc1ee4d..f3a59fc7a 100755
|
||||||
|
--- a/heartbeat/openstack-info.in
|
||||||
|
+++ b/heartbeat/openstack-info.in
|
||||||
|
@@ -167,9 +167,9 @@ OSInfoStats() {
|
||||||
|
--column fixed_ips \
|
||||||
|
${port_id} | grep -P '\"subnet_id\": \".*\",$' |
|
||||||
|
grep -P -o '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}')
|
||||||
|
- value+="${subnet_id}:${port_id},"
|
||||||
|
+ value="${value}${subnet_id}:${port_id},"
|
||||||
|
done
|
||||||
|
- value=$(echo ${value} | sed -e 's/,$//g')
|
||||||
|
+ value=${value%,}
|
||||||
|
|
||||||
|
${HA_SBIN_DIR}/attrd_updater ${OCF_RESKEY_delay} -n openstack_ports -v "$value"
|
||||||
|
|
@ -0,0 +1,82 @@
|
|||||||
|
From 4420ef84f3172c67fc7b8b6ae41ea173de017bf4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Petr Pavlu <petr.pavlu@suse.com>
|
||||||
|
Date: Wed, 25 May 2022 15:12:33 +0200
|
||||||
|
Subject: [PATCH] aws-vpc-move-ip: Allow to set the interface label
|
||||||
|
|
||||||
|
Add a parameter to specify an interface label to distinguish the IP
|
||||||
|
address managed by aws-vpc-move-ip, similarly as can be done with
|
||||||
|
IPaddr2. This allows to easily recognize the address from other
|
||||||
|
addresses assigned to a given interface.
|
||||||
|
---
|
||||||
|
heartbeat/aws-vpc-move-ip | 30 +++++++++++++++++++++++++++++-
|
||||||
|
1 file changed, 29 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip
|
||||||
|
index 5d5204080..dee040300 100755
|
||||||
|
--- a/heartbeat/aws-vpc-move-ip
|
||||||
|
+++ b/heartbeat/aws-vpc-move-ip
|
||||||
|
@@ -43,6 +43,7 @@ OCF_RESKEY_address_default=""
|
||||||
|
OCF_RESKEY_routing_table_default=""
|
||||||
|
OCF_RESKEY_routing_table_role_default=""
|
||||||
|
OCF_RESKEY_interface_default="eth0"
|
||||||
|
+OCF_RESKEY_iflabel_default=""
|
||||||
|
OCF_RESKEY_monapi_default="false"
|
||||||
|
OCF_RESKEY_lookup_type_default="InstanceId"
|
||||||
|
|
||||||
|
@@ -54,6 +55,7 @@ OCF_RESKEY_lookup_type_default="InstanceId"
|
||||||
|
: ${OCF_RESKEY_routing_table=${OCF_RESKEY_routing_table_default}}
|
||||||
|
: ${OCF_RESKEY_routing_table_role=${OCF_RESKEY_routing_table_role_default}}
|
||||||
|
: ${OCF_RESKEY_interface=${OCF_RESKEY_interface_default}}
|
||||||
|
+: ${OCF_RESKEY_iflabel=${OCF_RESKEY_iflabel_default}}
|
||||||
|
: ${OCF_RESKEY_monapi=${OCF_RESKEY_monapi_default}}
|
||||||
|
: ${OCF_RESKEY_lookup_type=${OCF_RESKEY_lookup_type_default}}
|
||||||
|
|
||||||
|
@@ -149,6 +151,18 @@ Name of the network interface, i.e. eth0
|
||||||
|
<content type="string" default="${OCF_RESKEY_interface_default}" />
|
||||||
|
</parameter>
|
||||||
|
|
||||||
|
+<parameter name="iflabel">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+You can specify an additional label for your IP address here.
|
||||||
|
+This label is appended to your interface name.
|
||||||
|
+
|
||||||
|
+The kernel allows alphanumeric labels up to a maximum length of 15
|
||||||
|
+characters including the interface name and colon (e.g. eth0:foobar1234)
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Interface label</shortdesc>
|
||||||
|
+<content type="string" default="${OCF_RESKEY_iflabel_default}"/>
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
<parameter name="monapi">
|
||||||
|
<longdesc lang="en">
|
||||||
|
Enable enhanced monitoring using AWS API calls to check route table entry
|
||||||
|
@@ -215,6 +229,14 @@ ec2ip_validate() {
|
||||||
|
return $OCF_ERR_CONFIGURED
|
||||||
|
fi
|
||||||
|
|
||||||
|
+ if [ -n "$OCF_RESKEY_iflabel" ]; then
|
||||||
|
+ label=${OCF_RESKEY_interface}:${OFC_RESKEY_iflabel}
|
||||||
|
+ if [ ${#label} -gt 15 ]; then
|
||||||
|
+ ocf_exit_reason "Interface label [$label] exceeds maximum character limit of 15"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
TOKEN=$(curl -sX PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600")
|
||||||
|
EC2_INSTANCE_ID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id -H "X-aws-ec2-metadata-token: $TOKEN")
|
||||||
|
|
||||||
|
@@ -363,7 +385,13 @@ ec2ip_get_and_configure() {
|
||||||
|
|
||||||
|
# Reconfigure the local ip address
|
||||||
|
ec2ip_drop
|
||||||
|
- cmd="ip addr add ${OCF_RESKEY_ip}/32 dev $OCF_RESKEY_interface"
|
||||||
|
+
|
||||||
|
+ extra_opts=""
|
||||||
|
+ if [ -n "$OCF_RESKEY_iflabel" ]; then
|
||||||
|
+ extra_opts="$extra_opts label $OCF_RESKEY_interface:$OCF_RESKEY_iflabel"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ cmd="ip addr add ${OCF_RESKEY_ip}/32 dev $OCF_RESKEY_interface $extra_opts"
|
||||||
|
ocf_log debug "executing command: $cmd"
|
||||||
|
$cmd
|
||||||
|
rc=$?
|
@ -0,0 +1,25 @@
|
|||||||
|
From b3885f7d95fe390371f806c7f3debb3ec8ad012d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 7 Jun 2022 15:20:11 +0200
|
||||||
|
Subject: [PATCH] lvmlockd: fail when use_lvmlockd has not been set
|
||||||
|
|
||||||
|
---
|
||||||
|
heartbeat/lvmlockd | 5 +++++
|
||||||
|
1 file changed, 5 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/lvmlockd b/heartbeat/lvmlockd
|
||||||
|
index 05bb0a2e5..dc7bd2d7e 100755
|
||||||
|
--- a/heartbeat/lvmlockd
|
||||||
|
+++ b/heartbeat/lvmlockd
|
||||||
|
@@ -179,6 +179,11 @@ setup_lvm_config()
|
||||||
|
out=$(lvmconfig 'global/locking_type' 2> /dev/null)
|
||||||
|
lock_type=$(echo "$out" | cut -d'=' -f2)
|
||||||
|
|
||||||
|
+ if [ -z "$use_lvmlockd" ]; then
|
||||||
|
+ ocf_exit_reason "\"use_lvmlockd\" not set in /etc/lvm/lvm.conf ..."
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
if [ -n "$use_lvmlockd" ] && [ "$use_lvmlockd" != 1 ] ; then
|
||||||
|
ocf_log info "setting \"use_lvmlockd=1\" in /etc/lvm/lvm.conf ..."
|
||||||
|
sed -i 's,^[[:blank:]]*use_lvmlockd[[:blank:]]*=.*,\ \ \ \ use_lvmlockd = 1,g' /etc/lvm/lvm.conf
|
@ -0,0 +1,39 @@
|
|||||||
|
From 46e8d346ca4803245f51a157591c4df1126d3b49 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 12 Jul 2022 12:45:52 +0200
|
||||||
|
Subject: [PATCH] ocf-tester: use promotable terms
|
||||||
|
|
||||||
|
---
|
||||||
|
tools/ocf-tester.in | 8 ++++----
|
||||||
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/ocf-tester.in b/tools/ocf-tester.in
|
||||||
|
index 10822a5a06..f1703ba1b7 100755
|
||||||
|
--- a/tools/ocf-tester.in
|
||||||
|
+++ b/tools/ocf-tester.in
|
||||||
|
@@ -295,10 +295,10 @@ if [ $rc -eq 3 ]; then
|
||||||
|
|
||||||
|
elif [ $rc -eq 8 ]; then
|
||||||
|
test_command demote "Cleanup, demote"
|
||||||
|
- assert $? 0 "Your agent was a master and could not be demoted" 1
|
||||||
|
+ assert $? 0 "Your agent was promoted and could not be demoted" 1
|
||||||
|
|
||||||
|
test_command stop "Cleanup, stop"
|
||||||
|
- assert $? 0 "Your agent was a master and could not be stopped" 1
|
||||||
|
+ assert $? 0 "Your agent was promoted and could not be stopped" 1
|
||||||
|
|
||||||
|
elif [ $rc -ne 7 ]; then
|
||||||
|
test_command stop
|
||||||
|
@@ -370,10 +370,10 @@ if [ $has_promote -eq 1 -a $has_demote -eq 1 ]; then
|
||||||
|
assert $? 0 "Demote failed" 1
|
||||||
|
|
||||||
|
elif [ $has_promote -eq 0 -a $has_demote -eq 0 ]; then
|
||||||
|
- info "* Your agent does not support master/slave (optional)"
|
||||||
|
+ info "* Your agent does not support promotable clones (optional)"
|
||||||
|
|
||||||
|
else
|
||||||
|
- echo "* Your agent partially supports master/slave"
|
||||||
|
+ echo "* Your agent partially supports promotable clones"
|
||||||
|
num_errors=`expr $num_errors + 1`
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,166 @@
|
|||||||
|
From 687aa646852d5fd5d4e811b2ec562ebffa15e23d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Thu, 14 Jul 2022 14:52:07 +0200
|
||||||
|
Subject: [PATCH] ocf-tester: remove deprecated lrmd/lrmadmin code that hasnt
|
||||||
|
worked since pre-pacemaker days
|
||||||
|
|
||||||
|
---
|
||||||
|
tools/ocf-tester.8 | 12 ++-----
|
||||||
|
tools/ocf-tester.in | 81 ---------------------------------------------
|
||||||
|
2 files changed, 2 insertions(+), 91 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/tools/ocf-tester.8 b/tools/ocf-tester.8
|
||||||
|
index 850ec0be04..3f398282d2 100644
|
||||||
|
--- a/tools/ocf-tester.8
|
||||||
|
+++ b/tools/ocf-tester.8
|
||||||
|
@@ -1,9 +1,9 @@
|
||||||
|
-.TH OCF-TESTER "8" "January 2012" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities"
|
||||||
|
+.TH OCF-TESTER "8" "July 2022" "Tool for testing if a cluster resource is OCF compliant" "System Administration Utilities"
|
||||||
|
.SH NAME
|
||||||
|
ocf-tester \- Part of the Linux-HA project
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.B ocf-tester
|
||||||
|
-[\fI-LhvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR
|
||||||
|
+[\fI-hvqdX\fR] \fI-n resource_name \fR[\fI-o name=value\fR]\fI* /full/path/to/resource/agent\fR
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Tool for testing if a cluster resource is OCF compliant
|
||||||
|
.SH OPTIONS
|
||||||
|
@@ -26,11 +26,6 @@ Name of the resource
|
||||||
|
\fB\-o\fR name=value
|
||||||
|
Name and value of any parameters required by the agent
|
||||||
|
.TP
|
||||||
|
-\fB\-L\fR
|
||||||
|
-Use lrmadmin/lrmd for tests
|
||||||
|
-.PP
|
||||||
|
-Usage: ocf\-tester [\-Lh] \fB\-n\fR resource_name [\-o name=value]* /full/path/to/resource/agent
|
||||||
|
-.TP
|
||||||
|
\fB\-h\fR
|
||||||
|
This text
|
||||||
|
.TP
|
||||||
|
@@ -51,6 +46,3 @@ Name of the resource
|
||||||
|
.TP
|
||||||
|
\fB\-o\fR name=value
|
||||||
|
Name and value of any parameters required by the agent
|
||||||
|
-.TP
|
||||||
|
-\fB\-L\fR
|
||||||
|
-Use lrmadmin/lrmd for tests
|
||||||
|
diff --git a/tools/ocf-tester.in b/tools/ocf-tester.in
|
||||||
|
index 10822a5a06..15b14e51ea 100755
|
||||||
|
--- a/tools/ocf-tester.in
|
||||||
|
+++ b/tools/ocf-tester.in
|
||||||
|
@@ -25,8 +25,6 @@
|
||||||
|
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
|
||||||
|
-LRMD=@libdir@/heartbeat/lrmd
|
||||||
|
-LRMADMIN=@sbindir@/lrmadmin
|
||||||
|
DATADIR=@datadir@
|
||||||
|
METADATA_LINT="xmllint --noout --valid -"
|
||||||
|
|
||||||
|
@@ -61,7 +59,6 @@ usage() {
|
||||||
|
echo " -X Turn on RA tracing (expect large output)"
|
||||||
|
echo " -n name Name of the resource"
|
||||||
|
echo " -o name=value Name and value of any parameters required by the agent"
|
||||||
|
- echo " -L Use lrmadmin/lrmd for tests"
|
||||||
|
exit $1
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -104,7 +101,6 @@ while test "$done" = "0"; do
|
||||||
|
-o) name=${2%%=*}; value=${2#*=};
|
||||||
|
lrm_ra_args="$lrm_ra_args $2";
|
||||||
|
ra_args="$ra_args OCF_RESKEY_$name='$value'"; shift; shift;;
|
||||||
|
- -L) use_lrmd=1; shift;;
|
||||||
|
-v) verbose=1; shift;;
|
||||||
|
-d) export HA_debug=1; shift;;
|
||||||
|
-X) export OCF_TRACE_RA=1; verbose=1; shift;;
|
||||||
|
@@ -140,79 +136,6 @@ stopped_rc=7
|
||||||
|
has_demote=1
|
||||||
|
has_promote=1
|
||||||
|
|
||||||
|
-start_lrmd() {
|
||||||
|
- lrmd_timeout=0
|
||||||
|
- lrmd_interval=0
|
||||||
|
- lrmd_target_rc=EVERYTIME
|
||||||
|
- lrmd_started=""
|
||||||
|
- $LRMD -s 2>/dev/null
|
||||||
|
- rc=$?
|
||||||
|
- if [ $rc -eq 3 ]; then
|
||||||
|
- lrmd_started=1
|
||||||
|
- $LRMD &
|
||||||
|
- sleep 1
|
||||||
|
- $LRMD -s 2>/dev/null
|
||||||
|
- else
|
||||||
|
- return $rc
|
||||||
|
- fi
|
||||||
|
-}
|
||||||
|
-add_resource() {
|
||||||
|
- $LRMADMIN -A $OCF_RESOURCE_INSTANCE \
|
||||||
|
- ocf \
|
||||||
|
- `basename $agent` \
|
||||||
|
- $(basename `dirname $agent`) \
|
||||||
|
- $lrm_ra_args > /dev/null
|
||||||
|
-}
|
||||||
|
-del_resource() {
|
||||||
|
- $LRMADMIN -D $OCF_RESOURCE_INSTANCE
|
||||||
|
-}
|
||||||
|
-parse_lrmadmin_output() {
|
||||||
|
- awk '
|
||||||
|
-BEGIN{ rc=1; }
|
||||||
|
-/Waiting for lrmd to callback.../ { n=1; next; }
|
||||||
|
-n==1 && /----------------operation--------------/ { n++; next; }
|
||||||
|
-n==2 && /return code:/ { rc=$0; sub("return code: *","",rc); next }
|
||||||
|
-n==2 && /---------------------------------------/ {
|
||||||
|
- n++;
|
||||||
|
- next;
|
||||||
|
-}
|
||||||
|
-END{
|
||||||
|
- if( n!=3 ) exit 1;
|
||||||
|
- else exit rc;
|
||||||
|
-}
|
||||||
|
-'
|
||||||
|
-}
|
||||||
|
-exec_resource() {
|
||||||
|
- op="$1"
|
||||||
|
- args="$2"
|
||||||
|
- $LRMADMIN -E $OCF_RESOURCE_INSTANCE \
|
||||||
|
- $op $lrmd_timeout $lrmd_interval \
|
||||||
|
- $lrmd_target_rc \
|
||||||
|
- $args | parse_lrmadmin_output
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-if [ "$use_lrmd" = 1 ]; then
|
||||||
|
- echo "Using lrmd/lrmadmin for all tests"
|
||||||
|
- start_lrmd || {
|
||||||
|
- echo "could not start lrmd" >&2
|
||||||
|
- exit 1
|
||||||
|
- }
|
||||||
|
- trap '
|
||||||
|
- [ "$lrmd_started" = 1 ] && $LRMD -k
|
||||||
|
- ' EXIT
|
||||||
|
- add_resource || {
|
||||||
|
- echo "failed to add resource to lrmd" >&2
|
||||||
|
- exit 1
|
||||||
|
- }
|
||||||
|
-fi
|
||||||
|
-
|
||||||
|
-lrm_test_command() {
|
||||||
|
- action="$1"
|
||||||
|
- msg="$2"
|
||||||
|
- debug "$msg"
|
||||||
|
- exec_resource $action "$lrm_ra_args"
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
test_permissions() {
|
||||||
|
action=meta-data
|
||||||
|
debug ${1:-"Testing permissions with uid nobody"}
|
||||||
|
@@ -233,10 +156,6 @@ test_command() {
|
||||||
|
action=$1; shift
|
||||||
|
export __OCF_ACTION=$action
|
||||||
|
msg=${1:-"Testing: $action"}
|
||||||
|
- if [ "$use_lrmd" = 1 ]; then
|
||||||
|
- lrm_test_command $action "$msg"
|
||||||
|
- return $?
|
||||||
|
- fi
|
||||||
|
#echo Running: "export $ra_args; $agent $action 2>&1 > /dev/null"
|
||||||
|
if [ $verbose -eq 0 ]; then
|
||||||
|
command_output=`$agent $action 2>&1`
|
@ -0,0 +1,75 @@
|
|||||||
|
From 0063164d72bbaca68f12a2f0a7dbae9ccb41fa39 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
|
||||||
|
Date: Tue, 26 Jul 2022 09:08:26 +0200
|
||||||
|
Subject: [PATCH] ethmonitor/ovsmonitor/pgsql: remove ignored attrd_updater
|
||||||
|
"-q" parameter
|
||||||
|
|
||||||
|
attrd_updater in 2.1.3 no longer ignores the -q parameter, which makes
|
||||||
|
these agents break. It never did anything in attrd_updater, and is
|
||||||
|
probably left-over from copy/paste crm_attribute code that got changed
|
||||||
|
to attrd_updater.
|
||||||
|
---
|
||||||
|
heartbeat/ethmonitor | 2 +-
|
||||||
|
heartbeat/ovsmonitor | 2 +-
|
||||||
|
heartbeat/pgsql | 8 ++++----
|
||||||
|
3 files changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/heartbeat/ethmonitor b/heartbeat/ethmonitor
|
||||||
|
index ba8574131..451738a0b 100755
|
||||||
|
--- a/heartbeat/ethmonitor
|
||||||
|
+++ b/heartbeat/ethmonitor
|
||||||
|
@@ -464,7 +464,7 @@ END
|
||||||
|
|
||||||
|
set_cib_value() {
|
||||||
|
local score=`expr $1 \* $OCF_RESKEY_multiplier`
|
||||||
|
- attrd_updater -n $ATTRNAME -v $score -q
|
||||||
|
+ attrd_updater -n $ATTRNAME -v $score
|
||||||
|
local rc=$?
|
||||||
|
case $rc in
|
||||||
|
0) ocf_log debug "attrd_updater: Updated $ATTRNAME = $score" ;;
|
||||||
|
diff --git a/heartbeat/ovsmonitor b/heartbeat/ovsmonitor
|
||||||
|
index 872ce86eb..6765da4b9 100755
|
||||||
|
--- a/heartbeat/ovsmonitor
|
||||||
|
+++ b/heartbeat/ovsmonitor
|
||||||
|
@@ -355,7 +355,7 @@ END
|
||||||
|
|
||||||
|
set_cib_value() {
|
||||||
|
local score=`expr $1 \* $OCF_RESKEY_multiplier`
|
||||||
|
- attrd_updater -n $ATTRNAME -v $score -q
|
||||||
|
+ attrd_updater -n $ATTRNAME -v $score
|
||||||
|
local rc=$?
|
||||||
|
case $rc in
|
||||||
|
0) ocf_log debug "attrd_updater: Updated $ATTRNAME = $score" ;;
|
||||||
|
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
|
||||||
|
index 94aceb324..e93d66855 100755
|
||||||
|
--- a/heartbeat/pgsql
|
||||||
|
+++ b/heartbeat/pgsql
|
||||||
|
@@ -808,7 +808,7 @@ pgsql_real_stop() {
|
||||||
|
local stop_escalate
|
||||||
|
|
||||||
|
if ocf_is_true ${OCF_RESKEY_check_wal_receiver}; then
|
||||||
|
- attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -D -q
|
||||||
|
+ attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -D
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! pgsql_status
|
||||||
|
@@ -937,16 +937,16 @@ pgsql_wal_receiver_status() {
|
||||||
|
receiver_parent_pids=`ps -ef | tr -s " " | grep "[w]al\s*receiver" | cut -d " " -f 3`
|
||||||
|
|
||||||
|
if echo "$receiver_parent_pids" | grep -q -w "$PID" ; then
|
||||||
|
- attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -v "normal" -q
|
||||||
|
+ attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -v "normal"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $pgsql_real_monitor_status -eq "$OCF_RUNNING_MASTER" ]; then
|
||||||
|
- attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -v "normal (master)" -q
|
||||||
|
+ attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -v "normal (master)"
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
- attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -v "ERROR" -q
|
||||||
|
+ attrd_updater -n "$PGSQL_WAL_RECEIVER_STATUS_ATTR" -v "ERROR"
|
||||||
|
ocf_log warn "wal receiver process is not running"
|
||||||
|
return 1
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
diff --color -uNr a/heartbeat/aliyun-vpc-move-ip b/heartbeat/aliyun-vpc-move-ip
|
||||||
|
--- a/heartbeat/aliyun-vpc-move-ip 2021-08-19 09:37:57.000000000 +0200
|
||||||
|
+++ b/heartbeat/aliyun-vpc-move-ip 2021-08-25 13:38:26.786626079 +0200
|
||||||
|
@@ -17,7 +17,7 @@
|
||||||
|
OCF_RESKEY_interface_default="eth0"
|
||||||
|
OCF_RESKEY_profile_default="default"
|
||||||
|
OCF_RESKEY_endpoint_default="vpc.aliyuncs.com"
|
||||||
|
-OCF_RESKEY_aliyuncli_default="detect"
|
||||||
|
+OCF_RESKEY_aliyuncli_default="/usr/lib/fence-agents/support/aliyun/bin/aliyuncli"
|
||||||
|
|
||||||
|
|
||||||
|
: ${OCF_RESKEY_address=${OCF_RESKEY_address_default}}
|
@ -0,0 +1,48 @@
|
|||||||
|
diff --color -uNr a/heartbeat/awseip b/heartbeat/awseip
|
||||||
|
--- a/heartbeat/awseip 2020-12-03 14:31:17.000000000 +0100
|
||||||
|
+++ b/heartbeat/awseip 2021-02-15 16:47:36.624610378 +0100
|
||||||
|
@@ -43,7 +43,7 @@
|
||||||
|
#
|
||||||
|
# Defaults
|
||||||
|
#
|
||||||
|
-OCF_RESKEY_awscli_default="/usr/bin/aws"
|
||||||
|
+OCF_RESKEY_awscli_default="/usr/lib/fence-agents/support/awscli/bin/aws"
|
||||||
|
OCF_RESKEY_profile_default="default"
|
||||||
|
OCF_RESKEY_api_delay_default="3"
|
||||||
|
|
||||||
|
diff --color -uNr a/heartbeat/awsvip b/heartbeat/awsvip
|
||||||
|
--- a/heartbeat/awsvip 2020-12-03 14:31:17.000000000 +0100
|
||||||
|
+++ b/heartbeat/awsvip 2021-02-15 16:47:48.960632484 +0100
|
||||||
|
@@ -42,7 +42,7 @@
|
||||||
|
#
|
||||||
|
# Defaults
|
||||||
|
#
|
||||||
|
-OCF_RESKEY_awscli_default="/usr/bin/aws"
|
||||||
|
+OCF_RESKEY_awscli_default="/usr/lib/fence-agents/support/awscli/bin/aws"
|
||||||
|
OCF_RESKEY_profile_default="default"
|
||||||
|
OCF_RESKEY_api_delay_default="3"
|
||||||
|
|
||||||
|
diff --color -uNr a/heartbeat/aws-vpc-move-ip b/heartbeat/aws-vpc-move-ip
|
||||||
|
--- a/heartbeat/aws-vpc-move-ip 2020-12-03 14:31:17.000000000 +0100
|
||||||
|
+++ b/heartbeat/aws-vpc-move-ip 2021-02-15 16:47:55.484644118 +0100
|
||||||
|
@@ -35,7 +35,7 @@
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
-OCF_RESKEY_awscli_default="/usr/bin/aws"
|
||||||
|
+OCF_RESKEY_awscli_default="/usr/lib/fence-agents/support/awscli/bin/aws"
|
||||||
|
OCF_RESKEY_profile_default="default"
|
||||||
|
OCF_RESKEY_region_default=""
|
||||||
|
OCF_RESKEY_ip_default=""
|
||||||
|
diff --color -uNr a/heartbeat/aws-vpc-route53.in b/heartbeat/aws-vpc-route53.in
|
||||||
|
--- a/heartbeat/aws-vpc-route53.in 2020-12-03 14:31:17.000000000 +0100
|
||||||
|
+++ b/heartbeat/aws-vpc-route53.in 2021-02-15 16:47:59.808651828 +0100
|
||||||
|
@@ -45,7 +45,7 @@
|
||||||
|
. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
|
||||||
|
# Defaults
|
||||||
|
-OCF_RESKEY_awscli_default="/usr/bin/aws"
|
||||||
|
+OCF_RESKEY_awscli_default="/usr/lib/fence-agents/support/awscli/bin/aws"
|
||||||
|
OCF_RESKEY_profile_default="default"
|
||||||
|
OCF_RESKEY_hostedzoneid_default=""
|
||||||
|
OCF_RESKEY_fullname_default=""
|
@ -0,0 +1,33 @@
|
|||||||
|
diff --color -uNr a/heartbeat/gcp-pd-move.in b/heartbeat/gcp-pd-move.in
|
||||||
|
--- a/heartbeat/gcp-pd-move.in 2021-08-19 09:37:57.000000000 +0200
|
||||||
|
+++ b/heartbeat/gcp-pd-move.in 2021-08-25 13:50:54.461732967 +0200
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
from ocf import logger
|
||||||
|
|
||||||
|
try:
|
||||||
|
+ sys.path.insert(0, '/usr/lib/fence-agents/support/google')
|
||||||
|
import googleapiclient.discovery
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
diff --color -uNr a/heartbeat/gcp-vpc-move-route.in b/heartbeat/gcp-vpc-move-route.in
|
||||||
|
--- a/heartbeat/gcp-vpc-move-route.in 2021-08-19 09:37:57.000000000 +0200
|
||||||
|
+++ b/heartbeat/gcp-vpc-move-route.in 2021-08-25 13:51:17.489797999 +0200
|
||||||
|
@@ -45,6 +45,7 @@
|
||||||
|
from ocf import *
|
||||||
|
|
||||||
|
try:
|
||||||
|
+ sys.path.insert(0, '/usr/lib/fence-agents/support/google')
|
||||||
|
import googleapiclient.discovery
|
||||||
|
import pyroute2
|
||||||
|
try:
|
||||||
|
diff --color -uNr a/heartbeat/gcp-vpc-move-vip.in b/heartbeat/gcp-vpc-move-vip.in
|
||||||
|
--- a/heartbeat/gcp-vpc-move-vip.in 2021-08-19 09:37:57.000000000 +0200
|
||||||
|
+++ b/heartbeat/gcp-vpc-move-vip.in 2021-08-25 13:51:35.012847487 +0200
|
||||||
|
@@ -29,6 +29,7 @@
|
||||||
|
from ocf import *
|
||||||
|
|
||||||
|
try:
|
||||||
|
+ sys.path.insert(0, '/usr/lib/fence-agents/support/google')
|
||||||
|
import googleapiclient.discovery
|
||||||
|
try:
|
||||||
|
from google.oauth2.service_account import Credentials as ServiceAccountCredentials
|
@ -0,0 +1,787 @@
|
|||||||
|
diff --color -uNr a/doc/man/Makefile.am b/doc/man/Makefile.am
|
||||||
|
--- a/doc/man/Makefile.am 2021-08-25 09:51:53.037906134 +0200
|
||||||
|
+++ b/doc/man/Makefile.am 2021-08-25 09:48:44.578408475 +0200
|
||||||
|
@@ -97,6 +97,8 @@
|
||||||
|
ocf_heartbeat_ManageRAID.7 \
|
||||||
|
ocf_heartbeat_ManageVE.7 \
|
||||||
|
ocf_heartbeat_NodeUtilization.7 \
|
||||||
|
+ ocf_heartbeat_nova-compute-wait.7 \
|
||||||
|
+ ocf_heartbeat_NovaEvacuate.7 \
|
||||||
|
ocf_heartbeat_Pure-FTPd.7 \
|
||||||
|
ocf_heartbeat_Raid1.7 \
|
||||||
|
ocf_heartbeat_Route.7 \
|
||||||
|
diff --color -uNr a/heartbeat/Makefile.am b/heartbeat/Makefile.am
|
||||||
|
--- a/heartbeat/Makefile.am 2021-08-25 09:51:53.038906137 +0200
|
||||||
|
+++ b/heartbeat/Makefile.am 2021-08-25 09:48:44.588408501 +0200
|
||||||
|
@@ -29,6 +29,8 @@
|
||||||
|
|
||||||
|
ocfdir = $(OCF_RA_DIR_PREFIX)/heartbeat
|
||||||
|
|
||||||
|
+ospdir = $(OCF_RA_DIR_PREFIX)/openstack
|
||||||
|
+
|
||||||
|
dtddir = $(datadir)/$(PACKAGE_NAME)
|
||||||
|
dtd_DATA = ra-api-1.dtd metadata.rng
|
||||||
|
|
||||||
|
@@ -50,6 +52,9 @@
|
||||||
|
send_ua_SOURCES = send_ua.c IPv6addr_utils.c
|
||||||
|
send_ua_LDADD = $(LIBNETLIBS)
|
||||||
|
|
||||||
|
+osp_SCRIPTS = nova-compute-wait \
|
||||||
|
+ NovaEvacuate
|
||||||
|
+
|
||||||
|
ocf_SCRIPTS = AoEtarget \
|
||||||
|
AudibleAlarm \
|
||||||
|
ClusterMon \
|
||||||
|
diff --color -uNr a/heartbeat/nova-compute-wait b/heartbeat/nova-compute-wait
|
||||||
|
--- a/heartbeat/nova-compute-wait 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ b/heartbeat/nova-compute-wait 2021-08-25 09:50:14.626646141 +0200
|
||||||
|
@@ -0,0 +1,345 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+#
|
||||||
|
+#
|
||||||
|
+# nova-compute-wait agent manages compute daemons.
|
||||||
|
+#
|
||||||
|
+# Copyright (c) 2015
|
||||||
|
+#
|
||||||
|
+# 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_ACTION=$1}
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+
|
||||||
|
+meta_data() {
|
||||||
|
+ cat <<END
|
||||||
|
+<?xml version="1.0"?>
|
||||||
|
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||||
|
+<resource-agent name="nova-compute-wait" version="1.0">
|
||||||
|
+<version>1.0</version>
|
||||||
|
+
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+OpenStack Nova Compute Server.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">OpenStack Nova Compute Server</shortdesc>
|
||||||
|
+
|
||||||
|
+<parameters>
|
||||||
|
+
|
||||||
|
+<parameter name="auth_url" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Deprecated option not in use
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Deprecated</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="username" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Deprecated option not in use
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Deprecated</shortdesc>
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="password" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Deprecated option not in use
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Deprecated</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="tenant_name" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Deprecated option not in use
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Deprecated</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="domain" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+DNS domain in which hosts live, useful when the cluster uses short names and nova uses FQDN
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">DNS domain</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="endpoint_type" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Deprecated option not in use
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Deprecated</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="no_shared_storage" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Deprecated option not in use
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Deprecated</shortdesc>
|
||||||
|
+<content type="boolean" default="0" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="evacuation_delay" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+How long to wait for nova to finish evacuating instances elsewhere
|
||||||
|
+before starting nova-compute. Only used when the agent detects
|
||||||
|
+evacuations might be in progress.
|
||||||
|
+
|
||||||
|
+You may need to increase the start timeout when increasing this value.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Delay to allow evacuations time to complete</shortdesc>
|
||||||
|
+<content type="integer" default="120" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+</parameters>
|
||||||
|
+
|
||||||
|
+<actions>
|
||||||
|
+<action name="start" timeout="600" />
|
||||||
|
+<action name="stop" timeout="300" />
|
||||||
|
+<action name="monitor" timeout="20" interval="10" depth="0"/>
|
||||||
|
+<action name="validate-all" timeout="20" />
|
||||||
|
+<action name="meta-data" timeout="5" />
|
||||||
|
+</actions>
|
||||||
|
+</resource-agent>
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+
|
||||||
|
+# don't exit on TERM, to test that lrmd makes sure that we do exit
|
||||||
|
+trap sigterm_handler TERM
|
||||||
|
+sigterm_handler() {
|
||||||
|
+ ocf_log info "They use TERM to bring us down. No such luck."
|
||||||
|
+ return
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+nova_usage() {
|
||||||
|
+ cat <<END
|
||||||
|
+usage: $0 {start|stop|monitor|validate-all|meta-data}
|
||||||
|
+
|
||||||
|
+Expects to have a fully populated OCF RA-compliant environment set.
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+nova_start() {
|
||||||
|
+ build_unfence_overlay
|
||||||
|
+
|
||||||
|
+ state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | sed -e 's/.*value=//' | tr -d '"' )
|
||||||
|
+ if [ "x$state" = x ]; then
|
||||||
|
+ : never been fenced
|
||||||
|
+
|
||||||
|
+ elif [ "x$state" = xno ]; then
|
||||||
|
+ : has been evacuated, however it could have been 1s ago
|
||||||
|
+ ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to complete"
|
||||||
|
+ sleep ${OCF_RESKEY_evacuation_delay}
|
||||||
|
+
|
||||||
|
+ else
|
||||||
|
+ while [ "x$state" != "xno" ]; do
|
||||||
|
+ ocf_log info "Waiting for pending evacuations from ${NOVA_HOST}"
|
||||||
|
+ state=$(attrd_updater -p -n evacuate -N ${NOVA_HOST} | sed -e 's/.*value=//' | tr -d '"' )
|
||||||
|
+ sleep 5
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ ocf_log info "Pausing to give evacuations from ${NOVA_HOST} time to complete"
|
||||||
|
+ sleep ${OCF_RESKEY_evacuation_delay}
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ touch "$statefile"
|
||||||
|
+
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+nova_stop() {
|
||||||
|
+ rm -f "$statefile"
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+nova_monitor() {
|
||||||
|
+ if [ ! -f "$statefile" ]; then
|
||||||
|
+ return $OCF_NOT_RUNNING
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+nova_notify() {
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+build_unfence_overlay() {
|
||||||
|
+ fence_options=""
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_auth_url}" ]; then
|
||||||
|
+ candidates=$(/usr/sbin/stonith_admin -l ${NOVA_HOST})
|
||||||
|
+ for candidate in ${candidates}; do
|
||||||
|
+ pcs stonith show $d | grep -q fence_compute
|
||||||
|
+ if [ $? = 0 ]; then
|
||||||
|
+ ocf_log info "Unfencing nova based on: $candidate"
|
||||||
|
+ fence_auth=$(pcs stonith show $candidate | grep Attributes: | sed -e s/Attributes:// -e s/-/_/g -e 's/[^ ]\+=/OCF_RESKEY_\0/g' -e s/passwd/password/g)
|
||||||
|
+ eval "export $fence_auth"
|
||||||
|
+ break
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # Copied from NovaEvacuate
|
||||||
|
+ if [ -z "${OCF_RESKEY_auth_url}" ]; then
|
||||||
|
+ ocf_exit_reason "auth_url not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -k ${OCF_RESKEY_auth_url}"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_username}" ]; then
|
||||||
|
+ ocf_exit_reason "username not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -l ${OCF_RESKEY_username}"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_password}" ]; then
|
||||||
|
+ ocf_exit_reason "password not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -p ${OCF_RESKEY_password}"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_tenant_name}" ]; then
|
||||||
|
+ ocf_exit_reason "tenant_name not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_domain}" ]; then
|
||||||
|
+ fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_region_name}" ]; then
|
||||||
|
+ fence_options="${fence_options} \
|
||||||
|
+ --region-name ${OCF_RESKEY_region_name}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_insecure}" ]; then
|
||||||
|
+ if ocf_is_true "${OCF_RESKEY_insecure}"; then
|
||||||
|
+ fence_options="${fence_options} --insecure"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_no_shared_storage}" ]; then
|
||||||
|
+ if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
|
||||||
|
+ fence_options="${fence_options} --no-shared-storage"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_endpoint_type}" ]; then
|
||||||
|
+ case ${OCF_RESKEY_endpoint_type} in
|
||||||
|
+ adminURL|publicURL|internalURL)
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type}" \
|
||||||
|
+ "not valid. Use adminURL or publicURL or internalURL"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ mkdir -p /run/systemd/system/openstack-nova-compute.service.d
|
||||||
|
+ cat<<EOF>/run/systemd/system/openstack-nova-compute.service.d/unfence-20.conf
|
||||||
|
+[Service]
|
||||||
|
+ExecStartPost=/sbin/fence_compute ${fence_options} -o on -n ${NOVA_HOST}
|
||||||
|
+EOF
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+nova_validate() {
|
||||||
|
+ rc=$OCF_SUCCESS
|
||||||
|
+
|
||||||
|
+ check_binary crudini
|
||||||
|
+ check_binary nova-compute
|
||||||
|
+ check_binary fence_compute
|
||||||
|
+
|
||||||
|
+ if [ ! -f /etc/nova/nova.conf ]; then
|
||||||
|
+ ocf_exit_reason "/etc/nova/nova.conf not found"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # Is the state directory writable?
|
||||||
|
+ state_dir=$(dirname $statefile)
|
||||||
|
+ touch "$state_dir/$$"
|
||||||
|
+ if [ $? != 0 ]; then
|
||||||
|
+ ocf_exit_reason "Invalid state directory: $state_dir"
|
||||||
|
+ return $OCF_ERR_ARGS
|
||||||
|
+ fi
|
||||||
|
+ rm -f "$state_dir/$$"
|
||||||
|
+
|
||||||
|
+ NOVA_HOST=$(crudini --get /etc/nova/nova.conf DEFAULT host 2>/dev/null)
|
||||||
|
+ if [ $? = 1 ]; then
|
||||||
|
+ short_host=$(uname -n | awk -F. '{print $1}')
|
||||||
|
+ if [ "x${OCF_RESKEY_domain}" != x ]; then
|
||||||
|
+ NOVA_HOST=${short_host}.${OCF_RESKEY_domain}
|
||||||
|
+ else
|
||||||
|
+ NOVA_HOST=$(uname -n)
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ $rc != $OCF_SUCCESS ]; then
|
||||||
|
+ exit $rc
|
||||||
|
+ fi
|
||||||
|
+ return $rc
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+statefile="${HA_RSCTMP}/${OCF_RESOURCE_INSTANCE}.active"
|
||||||
|
+
|
||||||
|
+: ${OCF_RESKEY_evacuation_delay=120}
|
||||||
|
+case $__OCF_ACTION in
|
||||||
|
+meta-data) meta_data
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+usage|help) nova_usage
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+
|
||||||
|
+case $__OCF_ACTION in
|
||||||
|
+start) nova_validate; nova_start;;
|
||||||
|
+stop) nova_stop;;
|
||||||
|
+monitor) nova_validate; nova_monitor;;
|
||||||
|
+notify) nova_notify;;
|
||||||
|
+validate-all) exit $OCF_SUCCESS;;
|
||||||
|
+*) nova_usage
|
||||||
|
+ exit $OCF_ERR_UNIMPLEMENTED
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+rc=$?
|
||||||
|
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
|
||||||
|
+exit $rc
|
||||||
|
+
|
||||||
|
diff --color -uNr a/heartbeat/NovaEvacuate b/heartbeat/NovaEvacuate
|
||||||
|
--- a/heartbeat/NovaEvacuate 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
+++ b/heartbeat/NovaEvacuate 2021-08-25 09:50:23.780670326 +0200
|
||||||
|
@@ -0,0 +1,400 @@
|
||||||
|
+#!/bin/bash
|
||||||
|
+#
|
||||||
|
+# Copyright 2015 Red Hat, Inc.
|
||||||
|
+#
|
||||||
|
+# Description: Manages evacuation of nodes running nova-compute
|
||||||
|
+#
|
||||||
|
+# Authors: Andrew Beekhof
|
||||||
|
+#
|
||||||
|
+# Support: openstack@lists.openstack.org
|
||||||
|
+# License: Apache Software License (ASL) 2.0
|
||||||
|
+#
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+# Initialization:
|
||||||
|
+
|
||||||
|
+###
|
||||||
|
+: ${OCF_FUNCTIONS_DIR=${OCF_ROOT}/lib/heartbeat}
|
||||||
|
+. ${OCF_FUNCTIONS_DIR}/ocf-shellfuncs
|
||||||
|
+###
|
||||||
|
+
|
||||||
|
+: ${__OCF_ACTION=$1}
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+
|
||||||
|
+meta_data() {
|
||||||
|
+ cat <<END
|
||||||
|
+<?xml version="1.0"?>
|
||||||
|
+<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||||
|
+<resource-agent name="NovaEvacuate" version="1.0">
|
||||||
|
+<version>1.0</version>
|
||||||
|
+
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Facility for tacking a list of compute nodes and reliably evacuating the ones that fence_evacuate has flagged.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Evacuator for OpenStack Nova Compute Server</shortdesc>
|
||||||
|
+
|
||||||
|
+<parameters>
|
||||||
|
+
|
||||||
|
+<parameter name="auth_url" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Authorization URL for connecting to keystone in admin context
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Authorization URL</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="username" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Username for connecting to keystone in admin context
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Username</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="password" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Password for connecting to keystone in admin context
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Password</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="tenant_name" unique="0" required="1">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Tenant name for connecting to keystone in admin context.
|
||||||
|
+Note that with Keystone V3 tenant names are only unique within a domain.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Tenant name</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="domain" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+DNS domain in which hosts live, useful when the cluster uses short names and nova uses FQDN
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">DNS domain</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="endpoint_type" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Nova API location (internal, public or admin URL)
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Nova API location (internal, public or admin URL)</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="region_name" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Region name for connecting to nova.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Region name</shortdesc>
|
||||||
|
+<content type="string" default="" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="insecure" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Explicitly allow client to perform "insecure" TLS (https) requests.
|
||||||
|
+The server's certificate will not be verified against any certificate authorities.
|
||||||
|
+This option should be used with caution.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Allow insecure TLS requests</shortdesc>
|
||||||
|
+<content type="boolean" default="0" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="no_shared_storage" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Indicate that nova storage for instances is not shared across compute
|
||||||
|
+nodes. This must match the reality of how nova storage is configured!
|
||||||
|
+Otherwise VMs could end up in error state upon evacuation. When
|
||||||
|
+storage is non-shared, instances on dead hypervisors will be rebuilt
|
||||||
|
+from their original image or volume, so anything on ephemeral storage
|
||||||
|
+will be lost.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Disable shared storage recovery for instances</shortdesc>
|
||||||
|
+<content type="boolean" default="0" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="verbose" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Enable extra logging from the evacuation process
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Enable debug logging</shortdesc>
|
||||||
|
+<content type="boolean" default="0" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+<parameter name="evacuate_delay" unique="0" required="0">
|
||||||
|
+<longdesc lang="en">
|
||||||
|
+Allows delaying the nova evacuate API call, e.g. to give a storage array time to clean
|
||||||
|
+up eventual locks/leases.
|
||||||
|
+</longdesc>
|
||||||
|
+<shortdesc lang="en">Nova evacuate delay</shortdesc>
|
||||||
|
+<content type="integer" default="0" />
|
||||||
|
+</parameter>
|
||||||
|
+
|
||||||
|
+</parameters>
|
||||||
|
+
|
||||||
|
+<actions>
|
||||||
|
+<action name="start" timeout="20" />
|
||||||
|
+<action name="stop" timeout="20" />
|
||||||
|
+<action name="monitor" timeout="600" interval="10" depth="0"/>
|
||||||
|
+<action name="validate-all" timeout="20" />
|
||||||
|
+<action name="meta-data" timeout="5" />
|
||||||
|
+</actions>
|
||||||
|
+</resource-agent>
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+#######################################################################
|
||||||
|
+
|
||||||
|
+# don't exit on TERM, to test that lrmd makes sure that we do exit
|
||||||
|
+trap sigterm_handler TERM
|
||||||
|
+sigterm_handler() {
|
||||||
|
+ ocf_log info "They use TERM to bring us down. No such luck."
|
||||||
|
+ return
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+evacuate_usage() {
|
||||||
|
+ cat <<END
|
||||||
|
+usage: $0 {start|stop|monitor|validate-all|meta-data}
|
||||||
|
+
|
||||||
|
+Expects to have a fully populated OCF RA-compliant environment set.
|
||||||
|
+END
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+evacuate_stop() {
|
||||||
|
+ rm -f "$statefile"
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+evacuate_start() {
|
||||||
|
+ touch "$statefile"
|
||||||
|
+ # Do not invole monitor here so that the start timeout can be low
|
||||||
|
+ return $?
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+update_evacuation() {
|
||||||
|
+ attrd_updater -p -n evacuate -Q -N ${1} -U ${2}
|
||||||
|
+ arc=$?
|
||||||
|
+ if [ ${arc} != 0 ]; then
|
||||||
|
+ ocf_log warn "Can not set evacuation state of ${1} to ${2}: ${arc}"
|
||||||
|
+ fi
|
||||||
|
+ return ${arc}
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+handle_evacuations() {
|
||||||
|
+ while [ $# -gt 0 ]; do
|
||||||
|
+ node=$1
|
||||||
|
+ state=$2
|
||||||
|
+ shift; shift;
|
||||||
|
+ need_evacuate=0
|
||||||
|
+
|
||||||
|
+ case $state in
|
||||||
|
+ "")
|
||||||
|
+ ;;
|
||||||
|
+ no)
|
||||||
|
+ ocf_log debug "$node is either fine or already handled"
|
||||||
|
+ ;;
|
||||||
|
+ yes) need_evacuate=1
|
||||||
|
+ ;;
|
||||||
|
+ *@*)
|
||||||
|
+ where=$(echo $state | awk -F@ '{print $1}')
|
||||||
|
+ when=$(echo $state | awk -F@ '{print $2}')
|
||||||
|
+ now=$(date +%s)
|
||||||
|
+
|
||||||
|
+ if [ $(($now - $when)) -gt 60 ]; then
|
||||||
|
+ ocf_log info "Processing partial evacuation of $node by" \
|
||||||
|
+ "$where at $when"
|
||||||
|
+ need_evacuate=1
|
||||||
|
+ else
|
||||||
|
+ # Give some time for any in-flight evacuations to either
|
||||||
|
+ # complete or fail Nova won't react well if there are two
|
||||||
|
+ # overlapping requests
|
||||||
|
+ ocf_log info "Deferring processing partial evacuation of" \
|
||||||
|
+ "$node by $where at $when"
|
||||||
|
+ fi
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+
|
||||||
|
+ if [ $need_evacuate = 1 ]; then
|
||||||
|
+ fence_agent="fence_compute"
|
||||||
|
+
|
||||||
|
+ if have_binary fence_evacuate; then
|
||||||
|
+ fence_agent="fence_evacuate"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ ${OCF_RESKEY_evacuate_delay} != 0 ]; then
|
||||||
|
+ ocf_log info "Delaying nova evacuate by $OCF_RESKEY_evacuate_delay seconds"
|
||||||
|
+ sleep ${OCF_RESKEY_evacuate_delay}
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ ocf_log notice "Initiating evacuation of $node with $fence_agent"
|
||||||
|
+ $fence_agent ${fence_options} -o status -n ${node}
|
||||||
|
+ if [ $? = 1 ]; then
|
||||||
|
+ ocf_log info "Nova does not know about ${node}"
|
||||||
|
+ # Dont mark as no because perhaps nova is unavailable right now
|
||||||
|
+ continue
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ update_evacuation ${node} "$(uname -n)@$(date +%s)"
|
||||||
|
+ if [ $? != 0 ]; then
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ $fence_agent ${fence_options} -o off -n $node
|
||||||
|
+ rc=$?
|
||||||
|
+
|
||||||
|
+ if [ $rc = 0 ]; then
|
||||||
|
+ update_evacuation ${node} no
|
||||||
|
+ ocf_log notice "Completed evacuation of $node"
|
||||||
|
+ else
|
||||||
|
+ ocf_log warn "Evacuation of $node failed: $rc"
|
||||||
|
+ update_evacuation ${node} yes
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+ done
|
||||||
|
+
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+evacuate_monitor() {
|
||||||
|
+ if [ ! -f "$statefile" ]; then
|
||||||
|
+ return $OCF_NOT_RUNNING
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ handle_evacuations $(
|
||||||
|
+ attrd_updater -n evacuate -A \
|
||||||
|
+ 2> >(grep -v "attribute does not exist" 1>&2) |
|
||||||
|
+ sed 's/ value=""/ value="no"/' |
|
||||||
|
+ tr '="' ' ' |
|
||||||
|
+ awk '{print $4" "$6}'
|
||||||
|
+ )
|
||||||
|
+ return $OCF_SUCCESS
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+evacuate_validate() {
|
||||||
|
+ rc=$OCF_SUCCESS
|
||||||
|
+ fence_options=""
|
||||||
|
+
|
||||||
|
+ if ! have_binary fence_evacuate; then
|
||||||
|
+ check_binary fence_compute
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ # Is the state directory writable?
|
||||||
|
+ state_dir=$(dirname $statefile)
|
||||||
|
+ touch "$state_dir/$$"
|
||||||
|
+ if [ $? != 0 ]; then
|
||||||
|
+ ocf_exit_reason "Invalid state directory: $state_dir"
|
||||||
|
+ return $OCF_ERR_ARGS
|
||||||
|
+ fi
|
||||||
|
+ rm -f "$state_dir/$$"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_auth_url}" ]; then
|
||||||
|
+ ocf_exit_reason "auth_url not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -k ${OCF_RESKEY_auth_url}"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_username}" ]; then
|
||||||
|
+ ocf_exit_reason "username not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -l ${OCF_RESKEY_username}"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_password}" ]; then
|
||||||
|
+ ocf_exit_reason "password not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -p ${OCF_RESKEY_password}"
|
||||||
|
+
|
||||||
|
+ if [ -z "${OCF_RESKEY_tenant_name}" ]; then
|
||||||
|
+ ocf_exit_reason "tenant_name not configured"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ fence_options="${fence_options} -t ${OCF_RESKEY_tenant_name}"
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_domain}" ]; then
|
||||||
|
+ fence_options="${fence_options} -d ${OCF_RESKEY_domain}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_region_name}" ]; then
|
||||||
|
+ fence_options="${fence_options} \
|
||||||
|
+ --region-name ${OCF_RESKEY_region_name}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_insecure}" ]; then
|
||||||
|
+ if ocf_is_true "${OCF_RESKEY_insecure}"; then
|
||||||
|
+ fence_options="${fence_options} --insecure"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_no_shared_storage}" ]; then
|
||||||
|
+ if ocf_is_true "${OCF_RESKEY_no_shared_storage}"; then
|
||||||
|
+ fence_options="${fence_options} --no-shared-storage"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_verbose}" ]; then
|
||||||
|
+ if ocf_is_true "${OCF_RESKEY_verbose}"; then
|
||||||
|
+ fence_options="${fence_options} --verbose"
|
||||||
|
+ fi
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ -n "${OCF_RESKEY_endpoint_type}" ]; then
|
||||||
|
+ case ${OCF_RESKEY_endpoint_type} in
|
||||||
|
+ adminURL|publicURL|internalURL)
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ ocf_exit_reason "endpoint_type ${OCF_RESKEY_endpoint_type}" \
|
||||||
|
+ "not valid. Use adminURL or publicURL or internalURL"
|
||||||
|
+ exit $OCF_ERR_CONFIGURED
|
||||||
|
+ ;;
|
||||||
|
+ esac
|
||||||
|
+ fence_options="${fence_options} -e ${OCF_RESKEY_endpoint_type}"
|
||||||
|
+ fi
|
||||||
|
+
|
||||||
|
+ if [ $rc != $OCF_SUCCESS ]; then
|
||||||
|
+ exit $rc
|
||||||
|
+ fi
|
||||||
|
+ return $rc
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+statefile="${HA_RSCTMP}/${OCF_RESOURCE_INSTANCE}.active"
|
||||||
|
+
|
||||||
|
+case $__OCF_ACTION in
|
||||||
|
+ start)
|
||||||
|
+ evacuate_validate
|
||||||
|
+ evacuate_start
|
||||||
|
+ ;;
|
||||||
|
+ stop)
|
||||||
|
+ evacuate_stop
|
||||||
|
+ ;;
|
||||||
|
+ monitor)
|
||||||
|
+ evacuate_validate
|
||||||
|
+ evacuate_monitor
|
||||||
|
+ ;;
|
||||||
|
+ meta-data)
|
||||||
|
+ meta_data
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+ usage|help)
|
||||||
|
+ evacuate_usage
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+ validate-all)
|
||||||
|
+ exit $OCF_SUCCESS
|
||||||
|
+ ;;
|
||||||
|
+ *)
|
||||||
|
+ evacuate_usage
|
||||||
|
+ exit $OCF_ERR_UNIMPLEMENTED
|
||||||
|
+ ;;
|
||||||
|
+esac
|
||||||
|
+rc=$?
|
||||||
|
+ocf_log debug "${OCF_RESOURCE_INSTANCE} $__OCF_ACTION : $rc"
|
||||||
|
+exit $rc
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue