From 8521775809f0b886db4bd408373fbd165d7e619d Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Wed, 25 Jan 2023 13:31:48 +0100 Subject: [PATCH] - all agents: dont check notify/promotable settings during validate-action Resolves: rhbz#2157872 --- ...-4-exportfs-pgsql-validate-all-fixes.patch | 137 ++++++++++++------ resource-agents.spec | 4 +- 2 files changed, 92 insertions(+), 49 deletions(-) diff --git a/bz2157872-4-exportfs-pgsql-validate-all-fixes.patch b/bz2157872-4-exportfs-pgsql-validate-all-fixes.patch index 6d06da4..d09352d 100644 --- a/bz2157872-4-exportfs-pgsql-validate-all-fixes.patch +++ b/bz2157872-4-exportfs-pgsql-validate-all-fixes.patch @@ -1,7 +1,7 @@ -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/3] exportfs: move testdir() to start-action to avoid failing +Subject: [PATCH 1/2] exportfs: move testdir() to start-action to avoid failing during resource creation (validate-all) and make it create the directory if it doesnt exist @@ -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/3] 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 @@ -116,29 +185,3 @@ index aa8a13a84..a99946af5 100755 pgsql_validate_all rc=$? - -From 5c68e3315414071b22b95e909b0beaa7a90191bc Mon Sep 17 00:00:00 2001 -From: Oyvind Albrigtsen -Date: Mon, 23 Jan 2023 12:55:35 +0100 -Subject: [PATCH 3/3] pgsql: dont fail validate-all action if config file isnt - available (could be on shared storage) - ---- - heartbeat/pgsql | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/heartbeat/pgsql b/heartbeat/pgsql -index a99946af5..626c1f737 100755 ---- a/heartbeat/pgsql -+++ b/heartbeat/pgsql -@@ -1835,7 +1835,9 @@ 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 -+ elif [ "$OCF_CHECK_LEVEL" -lt 10 ]; then - rc=1 - else - ocf_exit_reason "Configuration file $1 doesn't exist" diff --git a/resource-agents.spec b/resource-agents.spec index 5be7de5..2b72748 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -45,7 +45,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.10.0 -Release: 33%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 34%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: %{upstream_prefix}-%{upstream_version}.tar.gz @@ -581,7 +581,7 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog -* Tue Jan 24 2023 Oyvind Albrigtsen - 4.10.0-33 +* Wed Jan 25 2023 Oyvind Albrigtsen - 4.10.0-34 - all agents: dont check notify/promotable settings during validate-action