Blame SOURCES/bz2157873-4-exportfs-pgsql-validate-all-fixes.patch

ce420b
From 8388aca6aa13e4bef7c29261ac35cf3fb747fcb6 Mon Sep 17 00:00:00 2001
38e446
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
38e446
Date: Wed, 11 Jan 2023 13:22:24 +0100
38e446
Subject: [PATCH 1/2] exportfs: move testdir() to start-action to avoid failing
38e446
 during resource creation (validate-all) and make it create the directory if
38e446
 it doesnt exist
38e446
38e446
---
ce420b
 heartbeat/exportfs | 27 +++++++++++++++------------
ce420b
 1 file changed, 15 insertions(+), 12 deletions(-)
38e446
38e446
diff --git a/heartbeat/exportfs b/heartbeat/exportfs
ce420b
index c10777fa9..2307a9e67 100755
38e446
--- a/heartbeat/exportfs
38e446
+++ b/heartbeat/exportfs
38e446
@@ -301,6 +301,16 @@ exportfs_monitor ()
38e446
 	fi
38e446
 }
38e446
 
38e446
+testdir() {
38e446
+	if [ ! -d $1 ]; then
38e446
+		mkdir -p "$1"
38e446
+		if [ $? -ne 0 ]; then
38e446
+			ocf_exit_reason "Unable to create directory $1"
38e446
+			return 1
38e446
+		fi
38e446
+	fi
38e446
+	return 0
38e446
+}
38e446
 export_one() {
38e446
 	local dir=$1
38e446
 	local opts sep
38e446
@@ -331,6 +341,10 @@ export_one() {
38e446
 }
38e446
 exportfs_start ()
38e446
 {
38e446
+	if ! forall testdir; then
38e446
+		return $OCF_ERR_INSTALLED
38e446
+	fi
38e446
+
38e446
 	if exportfs_monitor; then
38e446
 		ocf_log debug "already exported"
38e446
 		return $OCF_SUCCESS
38e446
@@ -428,14 +442,6 @@ exportfs_stop ()
38e446
 	fi
38e446
 }
38e446
 
38e446
-testdir() {
38e446
-	if [ ! -d $1 ]; then
38e446
-		ocf_is_probe ||
38e446
-			ocf_log err "$1 does not exist or is not a directory"
38e446
-		return 1
38e446
-	fi
38e446
-	return 0
38e446
-}
38e446
 exportfs_validate_all ()
38e446
 {
38e446
 	if echo "$OCF_RESKEY_fsid" | grep -q -F ','; then
38e446
@@ -447,9 +453,6 @@ exportfs_validate_all ()
38e446
 		ocf_exit_reason "use integer fsid when exporting multiple directories"
38e446
 		return $OCF_ERR_CONFIGURED
38e446
 	fi
38e446
-	if ! forall testdir; then
38e446
-		return $OCF_ERR_INSTALLED
38e446
-	fi
38e446
 }
38e446
 
38e446
 for dir in $OCF_RESKEY_directory; do
ce420b
@@ -466,7 +469,7 @@ for dir in $OCF_RESKEY_directory; do
ce420b
 		fi
ce420b
 	else
ce420b
 		case "$__OCF_ACTION" in
ce420b
-			stop|monitor)
ce420b
+			stop|monitor|validate-all)
ce420b
 				canonicalized_dir="$dir"
ce420b
 				ocf_log debug "$dir does not exist"
ce420b
 				;;
38e446
ce420b
From a0b67ba60e5589c17a0ff4c296ec4235edb59bfd Mon Sep 17 00:00:00 2001
38e446
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
38e446
Date: Wed, 11 Jan 2023 13:25:57 +0100
38e446
Subject: [PATCH 2/2] pgsql: dont run promotable checks during validate-all
38e446
 action
38e446
38e446
---
38e446
 heartbeat/pgsql | 5 +++--
38e446
 1 file changed, 3 insertions(+), 2 deletions(-)
38e446
38e446
diff --git a/heartbeat/pgsql b/heartbeat/pgsql
38e446
index aa8a13a84..a99946af5 100755
38e446
--- a/heartbeat/pgsql
38e446
+++ b/heartbeat/pgsql
38e446
@@ -1937,7 +1937,7 @@ pgsql_validate_all() {
38e446
         fi
38e446
     fi
38e446
 
38e446
-    if is_replication; then
38e446
+    if [ "$OCF_CHECK_LEVEL" -eq 10 ] && is_replication; then
38e446
         REP_MODE_CONF=${OCF_RESKEY_tmpdir}/rep_mode.conf
38e446
         PGSQL_LOCK=${OCF_RESKEY_tmpdir}/PGSQL.lock
38e446
         XLOG_NOTE_FILE=${OCF_RESKEY_tmpdir}/xlog_note
38e446
@@ -2002,7 +2002,7 @@ pgsql_validate_all() {
38e446
         fi
38e446
     fi
38e446
 
38e446
-    if [ "$OCF_RESKEY_rep_mode" = "slave" ]; then
38e446
+    if [ "$OCF_CHECK_LEVEL" -eq 10 ] && [ "$OCF_RESKEY_rep_mode" = "slave" ]; then
38e446
         if ocf_is_ms; then
38e446
             ocf_exit_reason "Replication(rep_mode=slave) does not support Master/Slave configuration."
38e446
             return $OCF_ERR_CONFIGURED
38e446
@@ -2163,6 +2163,7 @@ case "$1" in
38e446
                 exit $OCF_SUCCESS;;
38e446
 esac
38e446
 
38e446
+[ "$__OCF_ACTION" != "validate-all" ] && OCF_CHECK_LEVEL=10
38e446
 pgsql_validate_all
38e446
 rc=$?
38e446