From b735d64cdde85940fc27e31f05b5a0e14a09c4b0 Mon Sep 17 00:00:00 2001 From: Oyvind Albrigtsen Date: Tue, 3 Jan 2023 14:00:00 +0100 Subject: [PATCH] - all agents: dont check notify/promotable settings during validate-action Resolves: rhbz#2157872 --- ...-ras-validate-all-OCF_CHECK_LEVEL-10.patch | 137 ++++++++++++++++++ resource-agents.spec | 10 +- 2 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 bz2157872-all-ras-validate-all-OCF_CHECK_LEVEL-10.patch diff --git a/bz2157872-all-ras-validate-all-OCF_CHECK_LEVEL-10.patch b/bz2157872-all-ras-validate-all-OCF_CHECK_LEVEL-10.patch new file mode 100644 index 0000000..85f5f48 --- /dev/null +++ b/bz2157872-all-ras-validate-all-OCF_CHECK_LEVEL-10.patch @@ -0,0 +1,137 @@ +From bf89ad06d5da5c05533c80a37a37c8dbbcd123aa Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 8 Dec 2022 15:40:07 +0100 +Subject: [PATCH] galera/mpathpersist/sg_persist/IPsrcaddr: only check notify + and promotable when OCF_CHECK_LEVEL=10 + +Pacemaker has started running validate-all action before creating the +resource. It doesnt provide notify/promotable settings while doing so, +so this patch moves these checks to OCF_CHECK_LEVEL 10 and runs the +validate action at OCF_CHECK_LEVEL 10 in the start-action. +--- + heartbeat/IPsrcaddr | 13 ++++++++----- + heartbeat/galera.in | 9 ++++++--- + heartbeat/mpathpersist.in | 13 +++++++++---- + heartbeat/sg_persist.in | 13 +++++++++---- + 4 files changed, 32 insertions(+), 16 deletions(-) + +diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr +index 1bd41a930..66e2ad8cd 100755 +--- a/heartbeat/IPsrcaddr ++++ b/heartbeat/IPsrcaddr +@@ -510,11 +510,13 @@ srca_validate_all() { + fi + + # We should serve this IP address of course +- if ip_status "$ipaddress"; then +- : +- else +- ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address" +- return $OCF_ERR_INSTALLED ++ if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then ++ if ip_status "$ipaddress"; then ++ : ++ else ++ ocf_exit_reason "We are not serving [$ipaddress], hence can not make it a preferred source address" ++ return $OCF_ERR_INSTALLED ++ fi + fi + return $OCF_SUCCESS + } +@@ -540,6 +542,7 @@ esac + + ipaddress="$OCF_RESKEY_ipaddress" + ++[ "$__OCF_ACTION" != "validate-all" ] && OCF_CHECK_LEVEL=10 + srca_validate_all + rc=$? + if [ $rc -ne $OCF_SUCCESS ]; then +diff --git a/heartbeat/galera.in b/heartbeat/galera.in +index cd2fee7c0..6aed3e4b6 100755 +--- a/heartbeat/galera.in ++++ b/heartbeat/galera.in +@@ -1015,9 +1015,11 @@ galera_stop() + + galera_validate() + { +- if ! ocf_is_ms; then +- ocf_exit_reason "Galera must be configured as a multistate Master/Slave resource." +- return $OCF_ERR_CONFIGURED ++ if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then ++ if ! ocf_is_ms; then ++ ocf_exit_reason "Galera must be configured as a multistate Master/Slave resource." ++ return $OCF_ERR_CONFIGURED ++ fi + fi + + if [ -z "$OCF_RESKEY_wsrep_cluster_address" ]; then +@@ -1035,6 +1037,7 @@ case "$1" in + exit $OCF_SUCCESS;; + esac + ++[ "$__OCF_ACTION" = "start" ] && OCF_CHECK_LEVEL=10 + galera_validate + rc=$? + LSB_STATUS_STOPPED=3 +diff --git a/heartbeat/mpathpersist.in b/heartbeat/mpathpersist.in +index 0e2c2a4a0..8a46b9930 100644 +--- a/heartbeat/mpathpersist.in ++++ b/heartbeat/mpathpersist.in +@@ -630,10 +630,11 @@ mpathpersist_action_notify() { + } + + mpathpersist_action_validate_all () { +- +- if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then +- ocf_log err "Master options misconfigured." +- exit $OCF_ERR_CONFIGURED ++ if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then ++ if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then ++ ocf_log err "Master options misconfigured." ++ exit $OCF_ERR_CONFIGURED ++ fi + fi + + return $OCF_SUCCESS +@@ -659,6 +660,10 @@ case $ACTION in + start|promote|monitor|stop|demote) + ocf_log debug "$RESOURCE: starting action \"$ACTION\"" + mpathpersist_init ++ if [ "$__OCF_ACTION" = "start" ]; then ++ OCF_CHECK_LEVEL=10 ++ mpathpersist_action_validate_all ++ fi + mpathpersist_action_$ACTION + exit $? + ;; +diff --git a/heartbeat/sg_persist.in b/heartbeat/sg_persist.in +index 16048ea6f..620c02f4a 100644 +--- a/heartbeat/sg_persist.in ++++ b/heartbeat/sg_persist.in +@@ -643,10 +643,11 @@ sg_persist_action_notify() { + } + + sg_persist_action_validate_all () { +- +- if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then +- ocf_log err "Master options misconfigured." +- exit $OCF_ERR_CONFIGURED ++ if [ "$OCF_CHECK_LEVEL" -eq 10 ]; then ++ if [ "$OCF_RESKEY_CRM_meta_master_max" != "1" ] && [ "$RESERVATION_TYPE" != "7" ] && [ "$RESERVATION_TYPE" != "8" ]; then ++ ocf_log err "Master options misconfigured." ++ exit $OCF_ERR_CONFIGURED ++ fi + fi + + return $OCF_SUCCESS +@@ -672,6 +673,10 @@ case $ACTION in + start|promote|monitor|stop|demote) + ocf_log debug "$RESOURCE: starting action \"$ACTION\"" + sg_persist_init ++ if [ "$__OCF_ACTION" = "start" ]; then ++ OCF_CHECK_LEVEL=10 ++ sg_persist_action_validate_all ++ fi + sg_persist_action_$ACTION + exit $? + ;; diff --git a/resource-agents.spec b/resource-agents.spec index af36e9b..0dc8b14 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: 28%{?rcver:%{rcver}}%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist} +Release: 29%{?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 @@ -88,6 +88,7 @@ Patch35: bz2134411-IPsrcaddr-proto-metric-scope-default-route-fixes.patch Patch36: bz2142002-Filesystem-add-support-for-Amazon-EFS.patch Patch37: bz2127121-nfsserver-nfsv4_only-parameter.patch Patch38: bz2145260-mysql-common-return-error-if-kill-fails.patch +Patch39: bz2157872-all-ras-validate-all-OCF_CHECK_LEVEL-10.patch # bundled ha-cloud-support libs Patch500: ha-cloud-support-aws.patch @@ -250,6 +251,7 @@ exit 1 %patch36 -p1 %patch37 -p1 %patch38 -p1 +%patch39 -p1 # bundled ha-cloud-support libs %patch500 -p1 @@ -571,6 +573,12 @@ rm -rf %{buildroot}/usr/share/doc/resource-agents %{_usr}/lib/ocf/lib/heartbeat/OCF_*.pm %changelog +* Tue Jan 3 2023 Oyvind Albrigtsen - 4.10.0-29 +- all agents: dont check notify/promotable settings during + validate-action + + Resolves: rhbz#2157872 + * Thu Nov 24 2022 Oyvind Albrigtsen - 4.10.0-28 - mysql-common: return error in stop-action if kill fails to stop the process, so the node can get fenced