diff --git a/bz2157873-4-exportfs-pgsql-validate-all-fixes.patch b/bz2157873-4-exportfs-pgsql-validate-all-fixes.patch index 5f57803..d09352d 100644 --- a/bz2157873-4-exportfs-pgsql-validate-all-fixes.patch +++ b/bz2157873-4-exportfs-pgsql-validate-all-fixes.patch @@ -1,4 +1,4 @@ -From 8388aca6aa13e4bef7c29261ac35cf3fb747fcb6 Mon Sep 17 00:00:00 2001 +From 81f9e1a04dfd2274ccb906310b4f191485e342ab Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Wed, 11 Jan 2023 13:22:24 +0100 Subject: [PATCH 1/2] exportfs: move testdir() to start-action to avoid failing @@ -76,39 +76,108 @@ index c10777fa9..2307a9e67 100755 ocf_log debug "$dir does not exist" ;; -From a0b67ba60e5589c17a0ff4c296ec4235edb59bfd Mon Sep 17 00:00:00 2001 +From 8ee41af82cda35149f8e0cfede6a8ddef3e221e1 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Wed, 11 Jan 2023 13:25:57 +0100 -Subject: [PATCH 2/2] pgsql: dont run promotable checks during validate-all - action +Subject: [PATCH 2/2] pgsql: dont run promotable and file checks that could be + on shared storage during validate-all action --- - heartbeat/pgsql | 5 +++-- - 1 file changed, 3 insertions(+), 2 deletions(-) + heartbeat/pgsql | 53 +++++++++++++++++++++++++++++-------------------- + 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/heartbeat/pgsql b/heartbeat/pgsql -index aa8a13a84..a99946af5 100755 +index aa8a13a84..532063ac5 100755 --- a/heartbeat/pgsql +++ b/heartbeat/pgsql -@@ -1937,7 +1937,7 @@ pgsql_validate_all() { +@@ -1835,7 +1835,7 @@ check_config() { + + if [ ! -f "$1" ]; then + if ocf_is_probe; then +- ocf_log info "Configuration file is $1 not readable during probe." ++ ocf_log info "Unable to read $1 during probe." + rc=1 + else + ocf_exit_reason "Configuration file $1 doesn't exist" +@@ -1846,8 +1846,7 @@ check_config() { + return $rc + } + +-# Validate most critical parameters +-pgsql_validate_all() { ++validate_ocf_check_level_10() { + local version + local check_config_rc + local rep_mode_string +@@ -1883,12 +1882,6 @@ pgsql_validate_all() { fi fi -- if is_replication; then -+ if [ "$OCF_CHECK_LEVEL" -eq 10 ] && is_replication; then - REP_MODE_CONF=${OCF_RESKEY_tmpdir}/rep_mode.conf - PGSQL_LOCK=${OCF_RESKEY_tmpdir}/PGSQL.lock - XLOG_NOTE_FILE=${OCF_RESKEY_tmpdir}/xlog_note -@@ -2002,7 +2002,7 @@ pgsql_validate_all() { +- getent passwd $OCF_RESKEY_pgdba >/dev/null 2>&1 +- if [ ! $? -eq 0 ]; then +- ocf_exit_reason "User $OCF_RESKEY_pgdba doesn't exist"; +- return $OCF_ERR_INSTALLED; +- fi +- + if ocf_is_probe; then + ocf_log info "Don't check $OCF_RESKEY_pgdata during probe" + else +@@ -1898,18 +1891,6 @@ pgsql_validate_all() { fi fi -- if [ "$OCF_RESKEY_rep_mode" = "slave" ]; then -+ if [ "$OCF_CHECK_LEVEL" -eq 10 ] && [ "$OCF_RESKEY_rep_mode" = "slave" ]; then - if ocf_is_ms; then - ocf_exit_reason "Replication(rep_mode=slave) does not support Master/Slave configuration." - return $OCF_ERR_CONFIGURED -@@ -2163,6 +2163,7 @@ case "$1" in +- if [ -n "$OCF_RESKEY_monitor_user" -a ! -n "$OCF_RESKEY_monitor_password" ] +- then +- ocf_exit_reason "monitor password can't be empty" +- return $OCF_ERR_CONFIGURED +- fi +- +- if [ ! -n "$OCF_RESKEY_monitor_user" -a -n "$OCF_RESKEY_monitor_password" ] +- then +- ocf_exit_reason "monitor_user has to be set if monitor_password is set" +- return $OCF_ERR_CONFIGURED +- fi +- + if is_replication || [ "$OCF_RESKEY_rep_mode" = "slave" ]; then + if [ `printf "$version\n9.1" | sort -n | head -1` != "9.1" ]; then + ocf_exit_reason "Replication mode needs PostgreSQL 9.1 or higher." +@@ -2027,6 +2008,35 @@ pgsql_validate_all() { + return $OCF_SUCCESS + } + ++# Validate most critical parameters ++pgsql_validate_all() { ++ local rc ++ ++ getent passwd $OCF_RESKEY_pgdba >/dev/null 2>&1 ++ if [ ! $? -eq 0 ]; then ++ ocf_exit_reason "User $OCF_RESKEY_pgdba doesn't exist"; ++ return $OCF_ERR_INSTALLED; ++ fi ++ ++ if [ -n "$OCF_RESKEY_monitor_user" ] && [ -z "$OCF_RESKEY_monitor_password" ]; then ++ ocf_exit_reason "monitor password can't be empty" ++ return $OCF_ERR_CONFIGURED ++ fi ++ ++ if [ -z "$OCF_RESKEY_monitor_user" ] && [ -n "$OCF_RESKEY_monitor_password" ]; then ++ ocf_exit_reason "monitor_user has to be set if monitor_password is set" ++ return $OCF_ERR_CONFIGURED ++ fi ++ ++ if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then ++ validate_ocf_check_level_10 ++ rc=$? ++ [ $rc -ne "$OCF_SUCCESS" ] && exit $rc ++ fi ++ ++ return $OCF_SUCCESS ++} ++ + + # + # Check if we need to create a log file +@@ -2163,6 +2173,7 @@ case "$1" in exit $OCF_SUCCESS;; esac diff --git a/resource-agents.spec b/resource-agents.spec index e730965..7613def 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -69,7 +69,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.9.0 -Release: 39%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 40%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents %if 0%{?fedora} || 0%{?centos_version} || 0%{?rhel} @@ -938,7 +938,7 @@ ccs_update_schema > /dev/null 2>&1 ||: %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog -* Tue Jan 17 2023 Oyvind Albrigtsen - 4.9.0-39 +* Tue Jan 17 2023 Oyvind Albrigtsen - 4.9.0-40 - all agents: dont check notify/promotable settings during validate-action