Blame SOURCES/bz2157873-1-all-ras-validate-all-OCF_CHECK_LEVEL-10.patch

28ec26
From bf89ad06d5da5c05533c80a37a37c8dbbcd123aa Mon Sep 17 00:00:00 2001
28ec26
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
28ec26
Date: Thu, 8 Dec 2022 15:40:07 +0100
28ec26
Subject: [PATCH] galera/mpathpersist/sg_persist/IPsrcaddr: only check notify
28ec26
 and promotable when OCF_CHECK_LEVEL=10
28ec26
28ec26
Pacemaker has started running validate-all action before creating the
28ec26
resource. It doesnt provide notify/promotable settings while doing so,
28ec26
so this patch moves these checks to OCF_CHECK_LEVEL 10 and runs the
28ec26
validate action at OCF_CHECK_LEVEL 10 in the start-action.
28ec26
---
28ec26
 heartbeat/IPsrcaddr       | 13 ++++++++-----
28ec26
 heartbeat/galera.in       |  9 ++++++---
28ec26
 heartbeat/mpathpersist.in | 13 +++++++++----
28ec26
 heartbeat/sg_persist.in   | 13 +++++++++----
28ec26
 4 files changed, 32 insertions(+), 16 deletions(-)
28ec26
28ec26
diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr
28ec26
index 1bd41a930..66e2ad8cd 100755
28ec26
--- a/heartbeat/IPsrcaddr
28ec26
+++ b/heartbeat/IPsrcaddr
28ec26
@@ -510,11 +510,13 @@ srca_validate_all() {
28ec26
 	fi
28ec26
 
28ec26
 #	We should serve this IP address of course
28ec26
-	if ip_status "$ipaddress"; then
28ec26
-	  :
28ec26
-	else
28ec26
-	  ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
28ec26
-	  return $OCF_ERR_INSTALLED
28ec26
+	if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
28ec26
+		if ip_status "$ipaddress"; then
28ec26
+			:
28ec26
+		else
28ec26
+			ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address"
28ec26
+			return $OCF_ERR_INSTALLED
28ec26
+		fi
28ec26
 	fi
28ec26
 	return $OCF_SUCCESS
28ec26
 }
28ec26
@@ -540,6 +542,7 @@ esac
28ec26
 
28ec26
 ipaddress="$OCF_RESKEY_ipaddress"
28ec26
 
28ec26
+[ "$__OCF_ACTION" != "validate-all" ] && OCF_CHECK_LEVEL=10
28ec26
 srca_validate_all
28ec26
 rc=$?
28ec26
 if [ $rc -ne $OCF_SUCCESS ]; then
28ec26
diff --git a/heartbeat/galera.in b/heartbeat/galera.in
28ec26
index cd2fee7c0..6aed3e4b6 100755
28ec26
--- a/heartbeat/galera.in
28ec26
+++ b/heartbeat/galera.in
28ec26
@@ -1015,9 +1015,11 @@ galera_stop()
28ec26
 
28ec26
 galera_validate()
28ec26
 {
28ec26
-    if ! ocf_is_ms; then
28ec26
-        ocf_exit_reason "Galera must be configured as a multistate Master/Slave resource."
28ec26
-        return $OCF_ERR_CONFIGURED
28ec26
+    if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
28ec26
+        if ! ocf_is_ms; then
28ec26
+            ocf_exit_reason "Galera must be configured as a multistate Master/Slave resource."
28ec26
+            return $OCF_ERR_CONFIGURED
28ec26
+        fi
28ec26
     fi
28ec26
 
28ec26
     if [ -z "$OCF_RESKEY_wsrep_cluster_address" ]; then
28ec26
@@ -1035,6 +1037,7 @@ case "$1" in
28ec26
         exit $OCF_SUCCESS;;
28ec26
 esac
28ec26
 
28ec26
+[ "$__OCF_ACTION" = "start" ] && OCF_CHECK_LEVEL=10
28ec26
 galera_validate
28ec26
 rc=$?
28ec26
 LSB_STATUS_STOPPED=3
28ec26
diff --git a/heartbeat/mpathpersist.in b/heartbeat/mpathpersist.in
28ec26
index 0e2c2a4a0..8a46b9930 100644
28ec26
--- a/heartbeat/mpathpersist.in
28ec26
+++ b/heartbeat/mpathpersist.in
28ec26
@@ -630,10 +630,11 @@ mpathpersist_action_notify() {
28ec26
 }
28ec26
 
28ec26
 mpathpersist_action_validate_all () {
28ec26
-
28ec26
-    if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE"  != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
28ec26
-        ocf_log err "Master options misconfigured."
28ec26
-        exit $OCF_ERR_CONFIGURED
28ec26
+    if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
28ec26
+        if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE"  != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
28ec26
+            ocf_log err "Master options misconfigured."
28ec26
+            exit $OCF_ERR_CONFIGURED
28ec26
+        fi
28ec26
     fi
28ec26
 
28ec26
     return $OCF_SUCCESS
28ec26
@@ -659,6 +660,10 @@ case $ACTION in
28ec26
     start|promote|monitor|stop|demote)
28ec26
         ocf_log debug "$RESOURCE: starting action \"$ACTION\""
28ec26
         mpathpersist_init
28ec26
+        if [ "$__OCF_ACTION" = "start" ]; then
28ec26
+            OCF_CHECK_LEVEL=10
28ec26
+            mpathpersist_action_validate_all
28ec26
+        fi
28ec26
         mpathpersist_action_$ACTION
28ec26
         exit $?
28ec26
         ;;
28ec26
diff --git a/heartbeat/sg_persist.in b/heartbeat/sg_persist.in
28ec26
index 16048ea6f..620c02f4a 100644
28ec26
--- a/heartbeat/sg_persist.in
28ec26
+++ b/heartbeat/sg_persist.in
28ec26
@@ -643,10 +643,11 @@ sg_persist_action_notify() {
28ec26
 }
28ec26
 
28ec26
 sg_persist_action_validate_all () {
28ec26
-
28ec26
-    if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE"  != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
28ec26
-        ocf_log err "Master options misconfigured."
28ec26
-        exit $OCF_ERR_CONFIGURED
28ec26
+    if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then
28ec26
+        if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE"  != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then
28ec26
+            ocf_log err "Master options misconfigured."
28ec26
+            exit $OCF_ERR_CONFIGURED
28ec26
+        fi
28ec26
     fi
28ec26
 
28ec26
     return $OCF_SUCCESS
28ec26
@@ -672,6 +673,10 @@ case $ACTION in
28ec26
     start|promote|monitor|stop|demote)
28ec26
         ocf_log debug "$RESOURCE: starting action \"$ACTION\""
28ec26
         sg_persist_init
28ec26
+        if [ "$__OCF_ACTION" = "start" ]; then
28ec26
+            OCF_CHECK_LEVEL=10
28ec26
+            sg_persist_action_validate_all
28ec26
+        fi
28ec26
         sg_persist_action_$ACTION
28ec26
         exit $?
28ec26
         ;;