From f68ab82cfb922c628e1220e5c91c7d16cc6551cd Mon Sep 17 00:00:00 2001 From: Reshma Vijayan Date: Fri, 10 Apr 2026 10:35:17 +0530 Subject: [PATCH 1/3] Feature: Add reload support for trace_ra to prevent resource restarts Note: This implementation was developed with the assistance of Claude AI. --- heartbeat/IPaddr2 | 19 +++++++++++++++++++ heartbeat/anything | 20 ++++++++++++++++++++ heartbeat/ocf-shellfuncs.in | 8 ++++++++ 3 files changed, 47 insertions(+) diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 index e9c1cdb740..d00f97fe02 100755 --- a/heartbeat/IPaddr2 +++ b/heartbeat/IPaddr2 @@ -471,6 +471,17 @@ Consider the resource failed if the interface has status DOWN or LOWERLAYERDOWN. Consider the resource failed if the interface has status DOWN or LOWERLAYERDOWN + + + +Set to 1 to turn on resource agent tracing (expect large output) +The trace output will be saved to trace_file, if set, or by default to +$HA_VARLIB/trace_ra/<type>/<id>.<action>.<timestamp> +e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 + +Set to 1 to turn on resource agent tracing (expect large output) + + @@ -478,6 +489,7 @@ Consider the resource failed if the interface has status DOWN or LOWERLAYERDOWN. + @@ -1269,6 +1281,11 @@ ip_monitor() { esac } +ip_reload() { + ocf_trace_reload + return $OCF_SUCCESS +} + # make sure that we have something to send ARPs with set_send_arp_program() { ARP_SENDER=send_arp @@ -1420,6 +1437,8 @@ status) ip_status=`ip_served` ;; monitor) ip_monitor ;; +reload) ip_reload + ;; validate-all) ;; *) ip_usage exit $OCF_ERR_UNIMPLEMENTED diff --git a/heartbeat/anything b/heartbeat/anything index 137a612634..3d3d5ff49b 100755 --- a/heartbeat/anything +++ b/heartbeat/anything @@ -193,6 +193,11 @@ anything_monitor() { fi } +anything_reload() { + ocf_trace_reload + return $OCF_SUCCESS +} + # FIXME: Attributes special meaning to the resource id process="$OCF_RESOURCE_INSTANCE" binfile="$OCF_RESKEY_binfile" @@ -308,11 +313,23 @@ before sending kill -SIGKILL. Defaults to 2/3 of the stop operation timeout. Seconds to wait after having sent SIGTERM before sending SIGKILL in stop operation + + + +Set to 1 to turn on resource agent tracing (expect large output) +The trace output will be saved to trace_file, if set, or by default to +$HA_VARLIB/trace_ra/<type>/<id>.<action>.<timestamp> +e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 + +Set to 1 to turn on resource agent tracing (expect large output) + + + @@ -334,6 +351,9 @@ case "$1" in monitor) anything_monitor ;; + reload) + anything_reload + ;; validate-all) anything_validate ;; diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in index ae64df1741..359add846c 100644 --- a/heartbeat/ocf-shellfuncs.in +++ b/heartbeat/ocf-shellfuncs.in @@ -1137,6 +1137,14 @@ ocf_stop_trace() { set +x } +ocf_trace_reload() { + if ocf_is_true "$OCF_RESKEY_trace_ra"; then + ocf_start_trace + else + ocf_stop_trace + fi +} + # Helper functions to map from nodename/bundle-name and physical hostname # list_index_for_word "node0 node1 node2 node3 node4 node5" node4 --> 5 # list_word_at_index "NA host1 host2 host3 host4 host5" 3 --> host2 From 59a3b952cb6fd6cef9c922ef24ce3b76cfa485f5 Mon Sep 17 00:00:00 2001 From: Reshma Vijayan Date: Fri, 10 Apr 2026 11:35:31 +0530 Subject: [PATCH 2/3] Refactor: Simplify reload action implementation Based on upstream maintainer feedback, simplify the architecture by: - Removing ocf_trace_reload helper function from ocf-shellfuncs - Removing agent-specific reload functions (ip_reload, anything_reload) - Making reload action return OCF_SUCCESS directly - Changing trace_ra parameter type from integer to boolean This achieves the same zero-downtime trace configuration updates with a cleaner, more straightforward implementation. Co-Authored-By: Claude Sonnet 4.5 --- heartbeat/IPaddr2 | 9 ++------- heartbeat/anything | 9 ++------- heartbeat/ocf-shellfuncs.in | 8 -------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 index d00f97fe02..1a3cd3d489 100755 --- a/heartbeat/IPaddr2 +++ b/heartbeat/IPaddr2 @@ -480,7 +480,7 @@ $HA_VARLIB/trace_ra/<type>/<id>.<action>.<timestamp> e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 Set to 1 to turn on resource agent tracing (expect large output) - + @@ -1281,11 +1281,6 @@ ip_monitor() { esac } -ip_reload() { - ocf_trace_reload - return $OCF_SUCCESS -} - # make sure that we have something to send ARPs with set_send_arp_program() { ARP_SENDER=send_arp @@ -1437,7 +1432,7 @@ status) ip_status=`ip_served` ;; monitor) ip_monitor ;; -reload) ip_reload +reload) exit $OCF_SUCCESS ;; validate-all) ;; *) ip_usage diff --git a/heartbeat/anything b/heartbeat/anything index 3d3d5ff49b..662a300712 100755 --- a/heartbeat/anything +++ b/heartbeat/anything @@ -193,11 +193,6 @@ anything_monitor() { fi } -anything_reload() { - ocf_trace_reload - return $OCF_SUCCESS -} - # FIXME: Attributes special meaning to the resource id process="$OCF_RESOURCE_INSTANCE" binfile="$OCF_RESKEY_binfile" @@ -322,7 +317,7 @@ $HA_VARLIB/trace_ra/<type>/<id>.<action>.<timestamp> e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 Set to 1 to turn on resource agent tracing (expect large output) - + @@ -352,7 +347,7 @@ case "$1" in anything_monitor ;; reload) - anything_reload + exit $OCF_SUCCESS ;; validate-all) anything_validate diff --git a/heartbeat/ocf-shellfuncs.in b/heartbeat/ocf-shellfuncs.in index 359add846c..ae64df1741 100644 --- a/heartbeat/ocf-shellfuncs.in +++ b/heartbeat/ocf-shellfuncs.in @@ -1137,14 +1137,6 @@ ocf_stop_trace() { set +x } -ocf_trace_reload() { - if ocf_is_true "$OCF_RESKEY_trace_ra"; then - ocf_start_trace - else - ocf_stop_trace - fi -} - # Helper functions to map from nodename/bundle-name and physical hostname # list_index_for_word "node0 node1 node2 node3 node4 node5" node4 --> 5 # list_word_at_index "NA host1 host2 host3 host4 host5" 3 --> host2 From c66429092209709cfe00d4e1984793dec5ccb966 Mon Sep 17 00:00:00 2001 From: Reshma Vijayan Date: Fri, 10 Apr 2026 12:48:06 +0530 Subject: [PATCH 3/3] Feature: Make reload action backward compatible using crm_feature_set check --- heartbeat/IPaddr2 | 12 ++++++++++-- heartbeat/anything | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 index 1a3cd3d489..ecb170fd66 100755 --- a/heartbeat/IPaddr2 +++ b/heartbeat/IPaddr2 @@ -147,6 +147,14 @@ IPADDR2_CIP_IPTABLES=$IPTABLES ####################################################################### meta_data() { + local reloadable_attr="" + local reload_action="" + ocf_version_cmp "${OCF_RESKEY_crm_feature_set:-3.10.0}" "3.10.0" + local res=$? + if [ $res -eq 0 ] || [ $res -eq 2 ]; then + reloadable_attr=' reloadable="1"' + reload_action='' + fi cat < @@ -472,7 +480,7 @@ Consider the resource failed if the interface has status DOWN or LOWERLAYERDOWN. - + Set to 1 to turn on resource agent tracing (expect large output) The trace output will be saved to trace_file, if set, or by default to @@ -489,7 +497,7 @@ e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 - +${reload_action} diff --git a/heartbeat/anything b/heartbeat/anything index 662a300712..8374acd33d 100755 --- a/heartbeat/anything +++ b/heartbeat/anything @@ -233,6 +233,14 @@ anything_validate() { } anything_meta() { +local reloadable_attr="" +local reload_action="" +ocf_version_cmp "${OCF_RESKEY_crm_feature_set:-3.10.0}" "3.10.0" +local res=$? +if [ $res -eq 0 ] || [ $res -eq 2 ]; then + reloadable_attr=' reloadable="1"' + reload_action='' +fi cat < @@ -309,7 +317,7 @@ before sending kill -SIGKILL. Defaults to 2/3 of the stop operation timeout. - + Set to 1 to turn on resource agent tracing (expect large output) The trace output will be saved to trace_file, if set, or by default to @@ -324,7 +332,7 @@ e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08 - +${reload_action}