- pgsqlms: use monitor_user and monitor_password for monitor operations

Includes fixes for stop operation failure when incorrect
  monitor_user/monitor_password is specified

  Resolves: RHEL-150841
This commit is contained in:
Arslan Ahmad 2026-06-01 16:54:16 +05:30
parent d4fd4d91a1
commit d03f438a32
2 changed files with 46 additions and 12 deletions

View File

@ -1,4 +1,4 @@
From 4890009e6837df6f2cdfcf25d766e146fb8d1cfd Mon Sep 17 00:00:00 2001
From 79b066f02a6ed94ada3bca2fb22a7f3036f52071 Mon Sep 17 00:00:00 2001
From: Arslan Ahmad <arslan.ahmad97@googlemail.com>
Date: Thu, 14 May 2026 18:37:05 +0530
Subject: [PATCH] pgsqlms: Use monitor_user and monitor_password for monitor
@ -9,11 +9,11 @@ when no monitor_password is provided.
Signed-off-by: Arslan Ahmad <arslan.ahmad97@googlemail.com>
---
script/pgsqlms | 54 +++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 49 insertions(+), 5 deletions(-)
script/pgsqlms | 74 ++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 66 insertions(+), 8 deletions(-)
diff --git a/script/pgsqlms b/script/pgsqlms
index 5ddd67a..0779cc1 100755
diff --git a/heartbeat/pgsqlms b/heartbeat/pgsqlms
index 5ddd67a..889580c 100755
--- a/heartbeat/pgsqlms
+++ b/heartbeat/pgsqlms
@@ -46,6 +46,8 @@ my %OCF_NOTIFY_ENV = ocf_notify_env() if $__OCF_ACTION eq 'notify';
@ -133,3 +133,37 @@ index 5ddd67a..0779cc1 100755
<parameter name="bindir" unique="0" required="0">
<longdesc lang="en">
Path to the directory storing the PostgreSQL binaries. The agent
@@ -1535,6 +1579,7 @@ sub pgsql_stop {
my $rc;
my $state;
my $pidfile = "$datadir/postmaster.pid";
+ my $pgisready_rc;
# Add 60s to the timeout or use a 24h timeout fallback to make sure
# Pacemaker will give up before us and take decisions
my $timeout = ( _get_action_timeout() || 60*60*24 ) + 60;
@@ -1548,9 +1593,22 @@ sub pgsql_stop {
return $OCF_SUCCESS;
}
elsif ( $rc != $OCF_SUCCESS and $rc != $OCF_RUNNING_MASTER ) {
- ocf_exit_reason( 'Unexpected state for instance "%s" (returned %d)',
- $OCF_RESOURCE_INSTANCE, $rc );
- return $OCF_ERR_GENERIC;
+ ocf_log( 'debug', 'pgsql_stop: monitor failed (rc=%d), checking with pg_isready', $rc );
+
+ $pgisready_rc = _pg_isready();
+ if ( $pgisready_rc == 0 or $pgisready_rc == 1 ) {
+ ocf_log( 'info', 'Instance "%s" is running (pg_isready=%d), proceeding with stop despite monitor failure',
+ $OCF_RESOURCE_INSTANCE, $pgisready_rc );
+ }
+ elsif ( $pgisready_rc == 2 ) {
+ ocf_log( 'debug', 'pgsql_stop: pg_isready indicates instance is not listening' );
+ return _confirm_stopped();
+ }
+ else {
+ ocf_exit_reason( 'Unexpected state for instance "%s" (monitor returned %d, pg_isready returned %d)',
+ $OCF_RESOURCE_INSTANCE, $rc, $pgisready_rc );
+ return $OCF_ERR_GENERIC;
+ }
}
#

View File

@ -45,7 +45,7 @@
Name: resource-agents
Summary: Open Source HA Reusable Cluster Resource Scripts
Version: 4.16.0
Release: 64%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
Release: 65%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
License: GPL-2.0-or-later AND LGPL-2.1-or-later
URL: https://github.com/ClusterLabs/resource-agents
Source0: %{upstream_prefix}-%{upstream_version}.tar.gz
@ -721,6 +721,12 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents
%{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm
%changelog
* Mon Jun 01 2026 Arslan Ahmad <arahmad@redhat.com> - 4.16.0-65
- pgsqlms: use monitor_user for monitor-calls and use .pgpass when
monitor_password is not specified
Resolves: RHEL-150841
* Thu May 28 2026 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-64
- iSCSILogicalUnit: add block size override and backstore type selection
@ -732,12 +738,6 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents
Resolves: RHEL-176288
* Thu May 21 2026 Arslan Ahmad <arahmad@redhat.com> - 4.16.0-62
- pgsqlms: use monitor_user for monitor-calls and use .pgpass when
monitor_password is not specified
Resolves: RHEL-150841
* Wed May 20 2026 Oyvind Albrigtsen <oalbrigt@redhat.com> - 4.16.0-61
- podman-etcd: fix port 2380 binding race
- podman-etcd: fix machine deletion deadlock