From 2bea64e066cdf8abfe3d8ef00f8041d91b9a80b4 Mon Sep 17 00:00:00 2001 From: Fabiano Mercer Date: Mon, 9 Jan 2023 18:13:26 -0300 Subject: [PATCH] Add logs to debug RTNETLINK errors Problem: in a rare situation the add_interface may fail with RTNETLINK error. Add logs to help the investigation to check the device link status and IP address configured. Test plan ( Debian only ) PASS Fresh install of AIO-SX PASS Fresh install of AIO-DX Closes-Bug: #2002346 Signed-off-by: Fabiano Mercer Change-Id: Ice92d54cf87c0b58ff0d1917b2c4b61a277fb961 --- ...2-add-logs-to-debug-RTNETLINK-errors.patch | 52 +++++++++++++++++++ .../debian/patches/series | 1 + 2 files changed, 53 insertions(+) create mode 100644 base/cluster-resource-agents/debian/patches/ipaddr2-add-logs-to-debug-RTNETLINK-errors.patch diff --git a/base/cluster-resource-agents/debian/patches/ipaddr2-add-logs-to-debug-RTNETLINK-errors.patch b/base/cluster-resource-agents/debian/patches/ipaddr2-add-logs-to-debug-RTNETLINK-errors.patch new file mode 100644 index 000000000..c69d1943c --- /dev/null +++ b/base/cluster-resource-agents/debian/patches/ipaddr2-add-logs-to-debug-RTNETLINK-errors.patch @@ -0,0 +1,52 @@ +From d5f1d87d8016e907cc2d849a1cd648f4fe9d4325 Mon Sep 17 00:00:00 2001 +From: Fabiano Mercer +Date: Wed, 11 Jan 2023 09:41:01 -0300 +Subject: [PATCH] ipaddr2 add logs to debug RTNETLINK errors + +Log link state and IP address of device if add_interface fails +Log the IP address deletion from device + +Signed-off-by: Fabiano Mercer +--- + heartbeat/IPaddr2 | 11 +++++++++-- + 1 file changed, 9 insertions(+), 2 deletions(-) + +diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 +index 814f722..9a06c82 100755 +--- a/heartbeat/IPaddr2 ++++ b/heartbeat/IPaddr2 +@@ -616,6 +616,7 @@ delete_interface () { + netmask="$3" + + CMD="$IP2UTIL -f $FAMILY addr delete $ipaddr/$netmask dev $iface" ++ ocf_log info "Deleting ${FAMILY} address ${ipaddr}/${netmask} from device ${iface}" + + ocf_run $CMD || return $OCF_ERR_GENERIC + +@@ -685,7 +686,13 @@ add_interface () { + fi + + ocf_log info "$msg" +- ocf_run $cmd || return $OCF_ERR_GENERIC ++ ocf_run ${cmd} ++ rc=$? ++ if [ ${rc} -ne 0 ]; then ++ DEVICE_IPS=$(${IP2UTIL} addr show dev ${iface}) ++ ocf_log warn "'${IP2UTIL} addr add' returned: ${rc}. IPs of ${iface}: ${DEVICE_IPS}" ++ return ${OCF_ERR_GENERIC} ++ fi + + msg="Bringing device $iface up" + cmd="$IP2UTIL link set $iface up" +@@ -1136,7 +1143,7 @@ ip_stop() { + + if [ "$ip_del_if" = "yes" ]; then + delete_interface $OCF_RESKEY_ip $NIC $NETMASK +- if [ $? -ne 0 ]; then ++ if [ $? -ne ${OCF_SUCCESS} ]; then + ocf_exit_reason "Unable to remove IP [${OCF_RESKEY_ip} from interface [ $NIC ]" + exit $OCF_ERR_GENERIC + fi +-- +2.17.1 + diff --git a/base/cluster-resource-agents/debian/patches/series b/base/cluster-resource-agents/debian/patches/series index fa9eaecca..51fede3b5 100644 --- a/base/cluster-resource-agents/debian/patches/series +++ b/base/cluster-resource-agents/debian/patches/series @@ -12,3 +12,4 @@ ipaddr2_if_down.patch ipaddr2_ignore_lo_if_state.patch ipaddr2-avoid-failing-svc-if-down.patch ipaddr2-use-host-scope-for-addresses-on-loopback.patch +ipaddr2-add-logs-to-debug-RTNETLINK-errors.patch