Skip to content

Commit 36eb27a

Browse files
committed
Route: Allow specifying a routing metric value
The Route resource did not previously support setting a routing metric (i.e. a priority which the newly created route will carry). This is a common requirement, and is already supported in agents such as IPsrcaddr and IPaddr2.
1 parent fefb54b commit 36eb27a

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

heartbeat/Route

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@
3535
OCF_RESKEY_device_default=""
3636
OCF_RESKEY_gateway_default=""
3737
OCF_RESKEY_source_default=""
38+
OCF_RESKEY_metric_default=""
3839
OCF_RESKEY_table_default=""
3940
OCF_RESKEY_family_default="detect"
4041

4142
: ${OCF_RESKEY_device=${OCF_RESKEY_device_default}}
4243
: ${OCF_RESKEY_gateway=${OCF_RESKEY_gateway_default}}
4344
: ${OCF_RESKEY_source=${OCF_RESKEY_source_default}}
45+
: ${OCF_RESKEY_metric=${OCF_RESKEY_metric_default}}
4446
: ${OCF_RESKEY_table=${OCF_RESKEY_table_default}}
4547
: ${OCF_RESKEY_family=${OCF_RESKEY_family_default}}
4648

@@ -57,7 +59,8 @@ meta_data() {
5759
Enables and disables network routes.
5860
5961
Supports host and net routes, routes via a gateway address,
60-
and routes using specific source addresses.
62+
routes using specific source addresses and having a specific
63+
routing metric (priority).
6164
6265
This resource agent is useful if a node's routing table
6366
needs to be manipulated based on node role assignment.
@@ -124,6 +127,14 @@ The source IP address to be configured for the route.
124127
<content type="string" default="${OCF_RESKEY_source_default}" />
125128
</parameter>
126129
130+
<parameter name="metric" unique="0">
131+
<longdesc lang="en">
132+
The routing metric to be configured for the route.
133+
</longdesc>
134+
<shortdesc lang="en">Routing metric</shortdesc>
135+
<content type="string" default="${OCF_RESKEY_metric_default}" />
136+
</parameter>
137+
127138
<parameter name="table" unique="0">
128139
<longdesc lang="en">
129140
The routing table to be configured for the route.
@@ -172,6 +183,9 @@ create_route_spec() {
172183
if [ -n "${OCF_RESKEY_source}" ]; then
173184
route_spec="${route_spec} src ${OCF_RESKEY_source}"
174185
fi
186+
if [ -n "${OCF_RESKEY_metric}" ]; then
187+
route_spec="${route_spec} metric ${OCF_RESKEY_metric}"
188+
fi
175189
if [ -n "${OCF_RESKEY_table}" ]; then
176190
route_spec="${route_spec} table ${OCF_RESKEY_table}"
177191
fi

0 commit comments

Comments
 (0)