From 76d75299e8cdbd1f1b5f83b875f4f15f2b88cb6e Mon Sep 17 00:00:00 2001 From: liupei Date: Mon, 21 Oct 2024 14:17:46 +0800 Subject: [PATCH] powervs-subnet: Modify gathering of Apikey, calculation of timeout & IPsrcaddr: specify dev for default route, as e.g. fe80:: routes can be present on multiple interfaces (cherry picked from commit e25efdab5b2dfb9bbc0ff83a0087c0aceaa4996d) --- ...y-dev-for-default-route-as-e.g.-fe80.patch | 39 +++++++++++ ...dd-optional-argument-route_table-196.patch | 70 +++++++++++++++++++ resource-agents.spec | 8 ++- 3 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 backport-IPsrcaddr-specify-dev-for-default-route-as-e.g.-fe80.patch create mode 100644 backport-powervs-subnet-Add-optional-argument-route_table-196.patch diff --git a/backport-IPsrcaddr-specify-dev-for-default-route-as-e.g.-fe80.patch b/backport-IPsrcaddr-specify-dev-for-default-route-as-e.g.-fe80.patch new file mode 100644 index 0000000..d63b2aa --- /dev/null +++ b/backport-IPsrcaddr-specify-dev-for-default-route-as-e.g.-fe80.patch @@ -0,0 +1,39 @@ +From f23ae9c1e9ff9a44a053c7c2378975ac5b807478 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Thu, 29 Aug 2024 16:24:02 +0200 +Subject: [PATCH 02/17] IPsrcaddr: specify dev for default route, as e.g. + fe80:: routes can be present on multiple interfaces + +--- + heartbeat/IPsrcaddr | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/heartbeat/IPsrcaddr b/heartbeat/IPsrcaddr +index 1c87d5b7..58d89a28 100755 +--- a/heartbeat/IPsrcaddr ++++ b/heartbeat/IPsrcaddr +@@ -278,8 +278,8 @@ srca_start() { + errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $PROTO src $1 $METRIC $PREF' failed" + + if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] || [ "$OCF_RESKEY_destination" = "::/0" ]; then +- $CMDCHANGE $ROUTE_WO_SRC $PROTO src $1 || \ +- errorexit "command '$CMDCHANGE $ROUTE_WO_SRC $PROTO src $1' failed" ++ $CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE $PROTO src $1 || \ ++ errorexit "command '$CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE $PROTO src $1' failed" + fi + rc=$? + fi +@@ -322,8 +322,8 @@ srca_stop() { + errorexit "command 'ip route replace $TABLE $NETWORK dev $INTERFACE $OPTS $METRIC $PREF' failed" + + if [ "$OCF_RESKEY_destination" = "0.0.0.0/0" ] || [ "$OCF_RESKEY_destination" = "::/0" ]; then +- $CMDCHANGE $ROUTE_WO_SRC proto static || \ +- errorexit "command '$CMDCHANGE $ROUTE_WO_SRC proto static' failed" ++ $CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE proto static || \ ++ errorexit "command '$CMDCHANGE $ROUTE_WO_SRC dev $INTERFACE proto static' failed" + fi + + return $? +-- +2.33.1.windows.1 + diff --git a/backport-powervs-subnet-Add-optional-argument-route_table-196.patch b/backport-powervs-subnet-Add-optional-argument-route_table-196.patch new file mode 100644 index 0000000..5a02597 --- /dev/null +++ b/backport-powervs-subnet-Add-optional-argument-route_table-196.patch @@ -0,0 +1,70 @@ +From 0f701bc874873f1426a6e60b1d96633445ea0631 Mon Sep 17 00:00:00 2001 +From: ehaefele <30649454+ehaefele@users.noreply.github.com> +Date: Wed, 21 Aug 2024 09:37:08 +0200 +Subject: [PATCH 01/17] powervs-subnet: Add optional argument route_table + (#1966) + +--- + heartbeat/powervs-subnet.in | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/heartbeat/powervs-subnet.in b/heartbeat/powervs-subnet.in +index ec59d5b0..08762306 100755 +--- a/heartbeat/powervs-subnet.in ++++ b/heartbeat/powervs-subnet.in +@@ -63,7 +63,7 @@ class nmcli: + CONN_PREFIX = "VIP_" + DEV_PREFIX = "env" + ROUTING_PRIO = 50 +- ROUTING_TABLE = 500 ++ ROUTING_TABLE = ocf.get_parameter("route_table", 500) + _WAIT_FOR_NIC_SLEEP = 3 + + def __init__(self): +@@ -804,7 +804,7 @@ def start_action( + nic, ip_address, mac, gateway = ws.subnet_add() + + ocf.logger.debug( +- f"start_action: add nmcli connection: nic: {nic}, ip: {ip_address}, mac: {mac}, gateway: {gateway}, jumbo: {ws.jumbo}" ++ f"start_action: add nmcli connection: nic: {nic}, ip: {ip_address}, mac: {mac}, gateway: {gateway}, jumbo: {ws.jumbo}, table {nmcli.ROUTING_TABLE}" + ) + + conn_name = f"{nmcli.CONN_PREFIX}{nic}" +@@ -931,7 +931,7 @@ def validate_all_action( + + res_options = locals() + +- # The class instantation validates the resource agent options and that the instance exists ++ # The class instantiation validates the resource agent options and that the instance exists + try: + # Check instance in local workspace + _ = PowerCloudAPI(**res_options, use_remote_workspace=False) +@@ -982,7 +982,7 @@ def main(): + "powervs-subnet", + shortdesc="Manages moving a Power Virtual Server subnet", + longdesc=agent_description, +- version=1.02, ++ version=1.03, + ) + + agent.add_parameter( +@@ -1083,6 +1083,16 @@ def main(): + default="false", + ) + ++ agent.add_parameter( ++ "route_table", ++ shortdesc="route table ID", ++ longdesc="ID of the route table for the interface. Default is 500.", ++ content_type="string", ++ required=False, ++ default="500", ++ ) ++ ++ + agent.add_action("start", timeout=900, handler=start_action) + agent.add_action("stop", timeout=450, handler=stop_action) + agent.add_action( +-- +2.33.1.windows.1 + diff --git a/resource-agents.spec b/resource-agents.spec index 85ebb9d..0ee1009 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,7 +1,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.15.1 -Release: 3 +Release: 4 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: https://github.com/ClusterLabs/resource-agents/archive/v%{version}.tar.gz @@ -10,6 +10,8 @@ Patch0: backport-IPaddr2-Fix-bringing-up-device.patch Patch1: backport-azure-lb-fix-spelling-of-adresses-to-addresses.patch Patch2: backport-powervs-subnet-Modify-gathering-of-Apikey-calculatio.patch Patch3: backport-findif.sh-ignore-unreachable-blackhole-and-prohibit-.patch +Patch4: backport-powervs-subnet-Add-optional-argument-route_table-196.patch +Patch5: backport-IPsrcaddr-specify-dev-for-default-route-as-e.g.-fe80.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} @@ -108,6 +110,10 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* Mon Oct 21 2024 liupei - 4.15.1-4 +- powervs-subnet: Add optional argument route_table +- IPsrcaddr: specify dev for default route, as e.g. fe80:: routes can be present on multiple interfaces + * Fri Oct 18 2024 bizhiyuan - 4.15.1-3 - powervs-subnet: Modify gathering of Apikey, calculation of timeout - findif.sh: ignore unreachable, blackhole, and prohibit routes -- Gitee