diff --git a/backport-IPaddr2-Fix-bringing-up-device.patch b/backport-IPaddr2-Fix-bringing-up-device.patch index 6c27996608414a735e9811e27255e81177222d97..e17d2917fce897177db052ca982c945d1e3219f5 100644 --- a/backport-IPaddr2-Fix-bringing-up-device.patch +++ b/backport-IPaddr2-Fix-bringing-up-device.patch @@ -1,55 +1,26 @@ -From 82045adbe11db0288bfe27d34f59e85948483f34 Mon Sep 17 00:00:00 2001 -From: edmund-haefele -Date: Tue, 13 Aug 2024 09:22:37 +0000 -Subject: [PATCH] powervs-subnet: Modify gathering of Apikey, calculation of - timeout. +From 4af605b8df2437481431f7478fa53238b73a1d92 Mon Sep 17 00:00:00 2001 +From: Alex Hermann +Date: Fri, 26 Jul 2024 17:12:06 +0200 +Subject: [PATCH] IPaddr2: Fix bringing up device +The `dev` keyword is sometimes required. --- - heartbeat/powervs-subnet.in | 13 ++++++++----- - 1 file changed, 8 insertions(+), 5 deletions(-) + heartbeat/IPaddr2 | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) -diff --git a/heartbeat/powervs-subnet.in b/heartbeat/powervs-subnet.in -index 3d86ae7c9..ec59d5b07 100755 ---- a/heartbeat/powervs-subnet.in -+++ b/heartbeat/powervs-subnet.in -@@ -24,6 +24,7 @@ +diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 +index fb061609..c53356a9 100755 +--- a/heartbeat/IPaddr2 ++++ b/heartbeat/IPaddr2 +@@ -712,7 +712,7 @@ add_interface () { + ocf_run $cmd || return $OCF_ERR_GENERIC - import ipaddress - import json -+import math - import os - import re - import socket -@@ -175,8 +176,7 @@ class nmcli: + msg="Bringing device $iface up" +- cmd="$IP2UTIL link set $iface up" ++ cmd="$IP2UTIL link set dev $iface up" + ocf_log info "$msg" + ocf_run $cmd || return $OCF_ERR_GENERIC - ocf.logger.debug(f"wait_for_nic: args: mac: {mac}, timeout: {timeout} s") - mac_address = mac.upper() -- retries = (timeout // cls._WAIT_FOR_NIC_SLEEP) - 1 -- -+ retries = math.ceil((timeout * 0.95) / cls._WAIT_FOR_NIC_SLEEP) - 1 - for attempt in range(1, retries + 1): - try: - ocf.logger.debug( -@@ -363,8 +363,11 @@ class PowerCloudAPI: - try: - keys = json.loads(f.read()) - # data seems to be in json format -- # return the value of the item with the key 'apikey' -- api_key = keys.get("apikey", keys) -+ # return the value of the item with the key 'Apikey' -+ # backward compatibility: In the past, the key name was 'apikey' -+ api_key = keys.get("Apikey", "") -+ if not api_key: -+ api_key = keys.get("apikey", "") - except ValueError: - # data is text, return as is - api_key = f.read().strip() -@@ -979,7 +982,7 @@ def main(): - "powervs-subnet", - shortdesc="Manages moving a Power Virtual Server subnet", - longdesc=agent_description, -- version=1.01, -+ version=1.02, - ) - - agent.add_parameter( +-- +2.25.1 + diff --git a/backport-findif.sh-ignore-unreachable-blackhole-and-prohibit-.patch b/backport-findif.sh-ignore-unreachable-blackhole-and-prohibit-.patch new file mode 100644 index 0000000000000000000000000000000000000000..37393acf003f2bf9a63bb2a0d0527e2ff8c89549 --- /dev/null +++ b/backport-findif.sh-ignore-unreachable-blackhole-and-prohibit-.patch @@ -0,0 +1,28 @@ +From f561e272e9b7fe94ba598b70c6d2f44d034446ed Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Wed, 14 Aug 2024 12:05:54 +0200 +Subject: [PATCH] findif.sh: ignore unreachable, blackhole, and prohibit routes + +--- + heartbeat/findif.sh | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/findif.sh b/heartbeat/findif.sh +index ca5d1a5c..7b817f75 100644 +--- a/heartbeat/findif.sh ++++ b/heartbeat/findif.sh +@@ -218,9 +218,9 @@ findif() + fi + if [ -n "$nic" ] ; then + # NIC supports more than two. +- routematch=$(ip -o -f $family route list match $match $proto $scope | grep "dev $nic " | sed -e 's,^\([0-9.]\+\) ,\1/32 ,;s,^\([0-9a-f:]\+\) ,\1/128 ,' | sort -t/ -k2,2nr) ++ routematch=$(ip -o -f $family route list match $match $proto $scope | grep -v "^\(unreachable\|prohibit\|blackhole\)" | grep "dev $nic " | sed -e 's,^\([0-9.]\+\) ,\1/32 ,;s,^\([0-9a-f:]\+\) ,\1/128 ,' | sort -t/ -k2,2nr) + else +- routematch=$(ip -o -f $family route list match $match $proto $scope | sed -e 's,^\([0-9.]\+\) ,\1/32 ,;s,^\([0-9a-f:]\+\) ,\1/128 ,' | sort -t/ -k2,2nr) ++ routematch=$(ip -o -f $family route list match $match $proto $scope | grep -v "^\(unreachable\|prohibit\|blackhole\)" | sed -e 's,^\([0-9.]\+\) ,\1/32 ,;s,^\([0-9a-f:]\+\) ,\1/128 ,' | sort -t/ -k2,2nr) + fi + if [ "$family" = "inet6" ]; then + routematch=$(echo "$routematch" | grep -v "^default") +-- +2.25.1 + diff --git a/backport-powervs-subnet-Modify-gathering-of-Apikey-calculatio.patch b/backport-powervs-subnet-Modify-gathering-of-Apikey-calculatio.patch new file mode 100644 index 0000000000000000000000000000000000000000..6c27996608414a735e9811e27255e81177222d97 --- /dev/null +++ b/backport-powervs-subnet-Modify-gathering-of-Apikey-calculatio.patch @@ -0,0 +1,55 @@ +From 82045adbe11db0288bfe27d34f59e85948483f34 Mon Sep 17 00:00:00 2001 +From: edmund-haefele +Date: Tue, 13 Aug 2024 09:22:37 +0000 +Subject: [PATCH] powervs-subnet: Modify gathering of Apikey, calculation of + timeout. + +--- + heartbeat/powervs-subnet.in | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/heartbeat/powervs-subnet.in b/heartbeat/powervs-subnet.in +index 3d86ae7c9..ec59d5b07 100755 +--- a/heartbeat/powervs-subnet.in ++++ b/heartbeat/powervs-subnet.in +@@ -24,6 +24,7 @@ + + import ipaddress + import json ++import math + import os + import re + import socket +@@ -175,8 +176,7 @@ class nmcli: + + ocf.logger.debug(f"wait_for_nic: args: mac: {mac}, timeout: {timeout} s") + mac_address = mac.upper() +- retries = (timeout // cls._WAIT_FOR_NIC_SLEEP) - 1 +- ++ retries = math.ceil((timeout * 0.95) / cls._WAIT_FOR_NIC_SLEEP) - 1 + for attempt in range(1, retries + 1): + try: + ocf.logger.debug( +@@ -363,8 +363,11 @@ class PowerCloudAPI: + try: + keys = json.loads(f.read()) + # data seems to be in json format +- # return the value of the item with the key 'apikey' +- api_key = keys.get("apikey", keys) ++ # return the value of the item with the key 'Apikey' ++ # backward compatibility: In the past, the key name was 'apikey' ++ api_key = keys.get("Apikey", "") ++ if not api_key: ++ api_key = keys.get("apikey", "") + except ValueError: + # data is text, return as is + api_key = f.read().strip() +@@ -979,7 +982,7 @@ def main(): + "powervs-subnet", + shortdesc="Manages moving a Power Virtual Server subnet", + longdesc=agent_description, +- version=1.01, ++ version=1.02, + ) + + agent.add_parameter( diff --git a/resource-agents.spec b/resource-agents.spec index 0c352b01de67772ec0a67510084eef9bfa8f7ebc..85ebb9d6e9467c9d6440b9e0e485748d74a6c0ff 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,13 +1,15 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.15.1 -Release: 2 +Release: 3 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: https://github.com/ClusterLabs/resource-agents/archive/v%{version}.tar.gz 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 Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} @@ -106,6 +108,10 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* 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 + * Mon Aug 19 2024 zhangxingrong - 4.15.1-2 - IPaddr2: Fix bringing up device - azure-lb: fix spelling of adresses to addresses