- all agents: dont check notify/promotable settings during

validate-action

  Resolves: rhbz#2157872
This commit is contained in:
Oyvind Albrigtsen 2023-01-25 13:31:48 +01:00
parent 43220e7a1b
commit 8521775809
2 changed files with 92 additions and 49 deletions

View File

@ -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 <oalbrigt@redhat.com> From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Wed, 11 Jan 2023 13:22:24 +0100 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 during resource creation (validate-all) and make it create the directory if
it doesnt exist it doesnt exist
@ -76,39 +76,108 @@ index c10777fa9..2307a9e67 100755
ocf_log debug "$dir does not exist" 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 <oalbrigt@redhat.com> From: Oyvind Albrigtsen <oalbrigt@redhat.com>
Date: Wed, 11 Jan 2023 13:25:57 +0100 Date: Wed, 11 Jan 2023 13:25:57 +0100
Subject: [PATCH 2/3] pgsql: dont run promotable checks during validate-all Subject: [PATCH 2/2] pgsql: dont run promotable and file checks that could be
action on shared storage during validate-all action
--- ---
heartbeat/pgsql | 5 +++-- heartbeat/pgsql | 53 +++++++++++++++++++++++++++++--------------------
1 file changed, 3 insertions(+), 2 deletions(-) 1 file changed, 32 insertions(+), 21 deletions(-)
diff --git a/heartbeat/pgsql b/heartbeat/pgsql diff --git a/heartbeat/pgsql b/heartbeat/pgsql
index aa8a13a84..a99946af5 100755 index aa8a13a84..532063ac5 100755
--- a/heartbeat/pgsql --- a/heartbeat/pgsql
+++ b/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
fi fi
- if is_replication; then - getent passwd $OCF_RESKEY_pgdba >/dev/null 2>&1
+ if [ "$OCF_CHECK_LEVEL" -eq 10 ] && is_replication; then - if [ ! $? -eq 0 ]; then
REP_MODE_CONF=${OCF_RESKEY_tmpdir}/rep_mode.conf - ocf_exit_reason "User $OCF_RESKEY_pgdba doesn't exist";
PGSQL_LOCK=${OCF_RESKEY_tmpdir}/PGSQL.lock - return $OCF_ERR_INSTALLED;
XLOG_NOTE_FILE=${OCF_RESKEY_tmpdir}/xlog_note - fi
@@ -2002,7 +2002,7 @@ pgsql_validate_all() { -
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
fi fi
- if [ "$OCF_RESKEY_rep_mode" = "slave" ]; then - if [ -n "$OCF_RESKEY_monitor_user" -a ! -n "$OCF_RESKEY_monitor_password" ]
+ if [ "$OCF_CHECK_LEVEL" -eq 10 ] && [ "$OCF_RESKEY_rep_mode" = "slave" ]; then - then
if ocf_is_ms; then - ocf_exit_reason "monitor password can't be empty"
ocf_exit_reason "Replication(rep_mode=slave) does not support Master/Slave configuration." - return $OCF_ERR_CONFIGURED
return $OCF_ERR_CONFIGURED - fi
@@ -2163,6 +2163,7 @@ case "$1" in -
- 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;; exit $OCF_SUCCESS;;
esac esac
@ -116,29 +185,3 @@ index aa8a13a84..a99946af5 100755
pgsql_validate_all pgsql_validate_all
rc=$? rc=$?
From 5c68e3315414071b22b95e909b0beaa7a90191bc Mon Sep 17 00:00:00 2001
From: Oyvind Albrigtsen <oalbrigt@redhat.com>
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"

View File

@ -45,7 +45,7 @@
Name: resource-agents Name: resource-agents
Summary: Open Source HA Reusable Cluster Resource Scripts Summary: Open Source HA Reusable Cluster Resource Scripts
Version: 4.10.0 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+ License: GPLv2+ and LGPLv2+
URL: https://github.com/ClusterLabs/resource-agents URL: https://github.com/ClusterLabs/resource-agents
Source0: %{upstream_prefix}-%{upstream_version}.tar.gz 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 %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm
%changelog %changelog
* Tue Jan 24 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.10.0-33 * Wed Jan 25 2023 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.10.0-34
- all agents: dont check notify/promotable settings during - all agents: dont check notify/promotable settings during
validate-action validate-action