Skip to content

Commit 6d0f63c

Browse files
committed
Feature: Add reload feature for trace_ra to prevent resource restarts
1 parent 496e9a4 commit 6d0f63c

3 files changed

Lines changed: 47 additions & 0 deletions

File tree

heartbeat/IPaddr2

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,13 +471,25 @@ Consider the resource failed if the interface has status DOWN or LOWERLAYERDOWN.
471471
<shortdesc lang="en">Consider the resource failed if the interface has status DOWN or LOWERLAYERDOWN</shortdesc>
472472
<content type="string" default="${OCF_RESKEY_check_link_status_default}"/>
473473
</parameter>
474+
475+
<parameter name="trace_ra">
476+
<longdesc lang="en">
477+
Set to 1 to turn on resource agent tracing (expect large output)
478+
The trace output will be saved to trace_file, if set, or by default to
479+
$HA_VARLIB/trace_ra/&lt;type&gt;/&lt;id&gt;.&lt;action&gt;.&lt;timestamp&gt;
480+
e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08
481+
</longdesc>
482+
<shortdesc lang="en">Set to 1 to turn on resource agent tracing (expect large output)</shortdesc>
483+
<content type="integer"/>
484+
</parameter>
474485
</parameters>
475486
476487
<actions>
477488
<action name="start" timeout="20s" />
478489
<action name="stop" timeout="20s" />
479490
<action name="status" depth="0" timeout="20s" interval="10s" />
480491
<action name="monitor" depth="0" timeout="20s" interval="10s" />
492+
<action name="reload" timeout="20s" />
481493
<action name="meta-data" timeout="5s" />
482494
<action name="validate-all" timeout="20s" />
483495
</actions>
@@ -1269,6 +1281,11 @@ ip_monitor() {
12691281
esac
12701282
}
12711283

1284+
ip_reload() {
1285+
ocf_trace_reload
1286+
return $OCF_SUCCESS
1287+
}
1288+
12721289
# make sure that we have something to send ARPs with
12731290
set_send_arp_program() {
12741291
ARP_SENDER=send_arp
@@ -1420,6 +1437,8 @@ status) ip_status=`ip_served`
14201437
;;
14211438
monitor) ip_monitor
14221439
;;
1440+
reload) ip_reload
1441+
;;
14231442
validate-all) ;;
14241443
*) ip_usage
14251444
exit $OCF_ERR_UNIMPLEMENTED

heartbeat/anything

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ anything_monitor() {
193193
fi
194194
}
195195

196+
anything_reload() {
197+
ocf_trace_reload
198+
return $OCF_SUCCESS
199+
}
200+
196201
# FIXME: Attributes special meaning to the resource id
197202
process="$OCF_RESOURCE_INSTANCE"
198203
binfile="$OCF_RESKEY_binfile"
@@ -308,11 +313,23 @@ before sending kill -SIGKILL. Defaults to 2/3 of the stop operation timeout.
308313
<shortdesc lang="en">Seconds to wait after having sent SIGTERM before sending SIGKILL in stop operation</shortdesc>
309314
<content type="string" default="${OCF_RESKEY_stop_timeout_default}"/>
310315
</parameter>
316+
317+
<parameter name="trace_ra">
318+
<longdesc lang="en">
319+
Set to 1 to turn on resource agent tracing (expect large output)
320+
The trace output will be saved to trace_file, if set, or by default to
321+
$HA_VARLIB/trace_ra/&lt;type&gt;/&lt;id&gt;.&lt;action&gt;.&lt;timestamp&gt;
322+
e.g. $HA_VARLIB/trace_ra/oracle/db.start.2012-11-27.08:37:08
323+
</longdesc>
324+
<shortdesc lang="en">Set to 1 to turn on resource agent tracing (expect large output)</shortdesc>
325+
<content type="integer"/>
326+
</parameter>
311327
</parameters>
312328
<actions>
313329
<action name="start" timeout="20s" />
314330
<action name="stop" timeout="20s" />
315331
<action name="monitor" depth="0" timeout="20s" interval="10s" />
332+
<action name="reload" timeout="20s" />
316333
<action name="meta-data" timeout="5s" />
317334
<action name="validate-all" timeout="5s" />
318335
</actions>
@@ -334,6 +351,9 @@ case "$1" in
334351
monitor)
335352
anything_monitor
336353
;;
354+
reload)
355+
anything_reload
356+
;;
337357
validate-all)
338358
anything_validate
339359
;;

heartbeat/ocf-shellfuncs.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,6 +1137,14 @@ ocf_stop_trace() {
11371137
set +x
11381138
}
11391139

1140+
ocf_trace_reload() {
1141+
if ocf_is_true "$OCF_RESKEY_trace_ra"; then
1142+
ocf_start_trace
1143+
else
1144+
ocf_stop_trace
1145+
fi
1146+
}
1147+
11401148
# Helper functions to map from nodename/bundle-name and physical hostname
11411149
# list_index_for_word "node0 node1 node2 node3 node4 node5" node4 --> 5
11421150
# list_word_at_index "NA host1 host2 host3 host4 host5" 3 --> host2

0 commit comments

Comments
 (0)