From 36eb27ac64a7d297b29d6bc424d32adf5275e90b Mon Sep 17 00:00:00 2001 From: Tim Small Date: Mon, 26 May 2025 08:23:42 +0100 Subject: [PATCH] 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. --- heartbeat/Route | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/heartbeat/Route b/heartbeat/Route index 7db41d0ae9..bfbed0234b 100755 --- a/heartbeat/Route +++ b/heartbeat/Route @@ -35,12 +35,14 @@ OCF_RESKEY_device_default="" OCF_RESKEY_gateway_default="" OCF_RESKEY_source_default="" +OCF_RESKEY_metric_default="" OCF_RESKEY_table_default="" OCF_RESKEY_family_default="detect" : ${OCF_RESKEY_device=${OCF_RESKEY_device_default}} : ${OCF_RESKEY_gateway=${OCF_RESKEY_gateway_default}} : ${OCF_RESKEY_source=${OCF_RESKEY_source_default}} +: ${OCF_RESKEY_metric=${OCF_RESKEY_metric_default}} : ${OCF_RESKEY_table=${OCF_RESKEY_table_default}} : ${OCF_RESKEY_family=${OCF_RESKEY_family_default}} @@ -57,7 +59,8 @@ meta_data() { Enables and disables network routes. Supports host and net routes, routes via a gateway address, -and routes using specific source addresses. +routes using specific source addresses and having a specific +routing metric (priority). This resource agent is useful if a node's routing table needs to be manipulated based on node role assignment. @@ -124,6 +127,14 @@ The source IP address to be configured for the route. + + +The routing metric to be configured for the route. + +Routing metric + + + The routing table to be configured for the route. @@ -172,6 +183,9 @@ create_route_spec() { if [ -n "${OCF_RESKEY_source}" ]; then route_spec="${route_spec} src ${OCF_RESKEY_source}" fi + if [ -n "${OCF_RESKEY_metric}" ]; then + route_spec="${route_spec} metric ${OCF_RESKEY_metric}" + fi if [ -n "${OCF_RESKEY_table}" ]; then route_spec="${route_spec} table ${OCF_RESKEY_table}" fi