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

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