diff --git a/add_nic_detect_on_ipaddr2.patch b/add_nic_detect_on_ipaddr2.patch new file mode 100644 index 0000000000000000000000000000000000000000..71ce75a0bcd0a51dc9a387ac011640249da7c763 --- /dev/null +++ b/add_nic_detect_on_ipaddr2.patch @@ -0,0 +1,93 @@ +From 3f79b8de2c03fa678bbf0a639270d3651376ea22 Mon Sep 17 00:00:00 2001 +From: bizhiyuan +Date: Thu, 8 Dec 2022 13:41:50 +0800 +Subject: [PATCH] add_nic_detect_on_ipaddr2 + +--- + heartbeat/IPaddr2 | 63 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 63 insertions(+) + +diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 +index 8817d98..6788cd5 100755 +--- a/heartbeat/IPaddr2 ++++ b/heartbeat/IPaddr2 +@@ -669,6 +669,53 @@ remove_conflicting_loopback() { + delete_route "$ipaddr" "$ifname" + } + ++nic_monitor() { ++ grep -r bonding /etc/modprobe.d/ | grep "$NIC" | grep ^[^#] ++ if [ "$?" -eq 0 ];then ++ BB=`ls /etc/sysconfig/network-scripts/ifcfg-*` ++ bb_n=0 ++ bb_m=0 ++ for AA in $BB;do ++ cat $AA | grep "$NIC" | grep "MASTER" | grep ^[^#] ++ if [ "$?" -eq 0 ];then ++ let bb_n=$bb_n+1 ++ NIC_n=`echo $AA |awk -F- '{print $3}'` ++ ifconfig $NIC_n | grep "UP" ++ rc=$? ++ if [ "$rc" -ge 1 ];then ++ let bb_m=$bb_m+1 ++ else ++ nic_status=`ethtool "$NIC_n" | grep "Link detected" | awk -F": " '{print $2}'` ++ case "$nic_status" in ++ *no) ++ let bb_m=$bb_m+1;; ++ esac ++ fi ++ fi ++ done ++ if [ "$bb_n" = "$bb_m" ];then ++ return $OCF_ERR_GENERIC ++ else ++ return $OCF_SUCCESS ++ fi ++ ++ else ++ ifconfig $NIC | grep "UP" ++ rc=$? ++ if [ "$rc" -ge 1 ];then ++ return $OCF_ERR_GENERIC ++ else ++ nic_status=`ethtool "$NIC" | grep "Link detected" | awk -F": " '{print $2}'` ++ case "$nic_status" in ++ *yes) ++ return $OCF_SUCCESS;; ++ *no) ++ return $OCF_ERR_GENERIC;; ++ esac ++ fi ++ fi ++} ++ + # + # On Linux systems the (hidden) loopback interface may + # need to be restored if it has been taken down previously +@@ -1071,6 +1118,22 @@ ip_monitor() { + # interface health maybe via a daemon like FailSafe etc... + + local ip_status=`ip_served` ++ case "$OCF_CHECK_LEVEL" in ++ 0) ++ ;; ++ 10) ++ nic_monitor ++ if [ $? -ne 0 ] ; ++ then ++ ocf_exit_reason $OCF_ERR_GENERIC ++ fi ++ ;; ++ *) ++ ocf_exit_reason "unsupported monitor level $OCF_CHECK_LEVEL" ++ return $OCF_ERR_CONFIGURED ++ ;; ++ esac ++ + case $ip_status in + ok) + run_arp_sender refresh +-- +2.27.0 + diff --git a/resource-agents.spec b/resource-agents.spec index 3a7d32b7d26d80f2b527f31736f65828a37b06ca..63b50ca7f8e0746e039f989c63ce367b2d9ea920 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,11 +1,12 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.2.0 -Release: 4 +Release: 5 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: https://github.com/ClusterLabs/resource-agents/archive/v4.2.0.tar.gz Patch0000: fix-failed-to-parse-pid-from-pid-file.patch +Patch0001: add_nic_detect_on_ipaddr2.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} BuildRequires: automake autoconf pkgconfig gcc perl-interpreter perl-generators python3-devel @@ -101,6 +102,9 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* Thu Dec 8 2022 bizhiyuan - 4.2.0-5 +- add nic detect in IPaddr2 scripts + * Wed Aug 25 2021 caodongxia - 4.2.0-4 - Fix failed to parse pid from pid-file