diff --git a/SOURCES/powerpc-utils-1.3.8-fix_boot-time_bonding_interface_cleanup_and_avoid_use_ifcfg.patch b/SOURCES/powerpc-utils-1.3.8-fix_boot-time_bonding_interface_cleanup_and_avoid_use_ifcfg.patch new file mode 100644 index 0000000..b25aeb7 --- /dev/null +++ b/SOURCES/powerpc-utils-1.3.8-fix_boot-time_bonding_interface_cleanup_and_avoid_use_ifcfg.patch @@ -0,0 +1,96 @@ +commit bfabc531021ee9cfc4c8dd83803e9daf7e45d91e +Author: Mingming Cao +Date: Thu Jan 28 12:49:07 2021 -0800 + + Fix boot-time bonding interface cleanup and avoid use ifcfg + + This patch fix three issues + 1) Avoid cleanup bond interface at the boot time when there is no HNV exists + + 2) Using nmcli instead of ifconfig file to check bond configuration as it + has been officially deprecated. This makes HNV configure bonding + indpendant of where bonding cfg file located. + + 3) At the time of calling ofpathname to look up for devicename, wait + for sys fs device ready. Otherwise the OS may in the middle of device + renaming. + + Signed-off-by: Mingming Cao + +diff --git a/scripts/hcnmgr b/scripts/hcnmgr +index a76505e..e4b56d6 100644 +--- a/scripts/hcnmgr ++++ b/scripts/hcnmgr +@@ -241,7 +241,10 @@ get_dev_hcn() { + # Let's retry a few times. + while [ $wait != 0 ]; do + if DEVNAME=$(ofpathname -l "$(echo "$1" | sed -e "s/\/proc\/device-tree//")" 2>/dev/null); then +- break ++ if [ -e /sys/class/net/"$DEVNAME" ]; then ++ hcnlog DEBUG "ofpathname waiting for /sys/class/net device $DEVNAME ready" ++ break ++ fi + fi + + hcnlog DEBUG "ofpathname return $?, devname is $DEVNAME rety counter $wait" +@@ -278,9 +281,7 @@ do_config_vdevice() { + BOND_PATH=$BOND_BASEPATH/$BONDNAME/bonding + + hcnlog DEBUG "Check if there is bond $BONDNAME with hcn id $HCNID" +- +- hcnlog DEBUG "ifconfig file $IFCONFIG_PATH/ifconfig-$BONDNAME" +- if [ ! -e "$IFCONFIG_PATH/ifcfg-$BONDNAME" ]; then ++ if ! nmcli -f NAME con show --active | grep -q "$BONDNAME\s"; then + hcnlog INFO "nmcli con add type bond con-name $BONDNAME ifname $BONDNAME" + nmcli con add type bond con-name "$BONDNAME" ifname "$BONDNAME" + +@@ -375,7 +376,10 @@ rmhcn() { + fi + + hcnlog INFO "rmhcn: delete bond $BONDNAME and slaves " +- nmcli -f NAME con show | grep "$BONDNAME" | xargs sudo nmcli con delete ++ for connection in $(nmcli -f NAME con show | grep "$BONDNAME"); do ++ hcnlog INFO "Delete bonding connection $connection" ++ nmcli con delete "$connection" ++ done + hcnlog DEBUG "rmhcn: exit" + return $E_SUCCESS + } +@@ -576,19 +580,24 @@ scanhcn() { + fi + + # Next clean up dead connections left from orgitinal LPAR after inactive miration +- +- # list of all HCN ids +- ids="${HcnIds[*]}" +- # After inactive migration, LPAR may have old bonding connections +- # with network device on original LPAR +- # clean up dead bonding connections +- for connection in $(nmcli -f NAME con show | grep "${ids// /\\|}"); do +- dev=$(echo "$connection" | cut -d '-' -f 2) +- if [[ $dev != "NAME" && ! -e /sys/class/net/"$dev" ]]; then +- hcnlog INFO "Delete dead bonding connection $connection" +- nmcli con delete "$connection" +- fi +- done ++ # Only do this when the HNV ID array is not empty ++ ++ if [[ ${HcnIds[[@]} ]]; then ++ hcnlog INFO "hcnscan finished. Found HNV devices on this LPAR" ++ ++ # list of all HCN ids ++ ids="${HcnIds[*]}" ++ # After inactive migration, LPAR may have old bonding connections ++ # with network device on original LPAR ++ # clean up dead bonding connections ++ for connection in $(nmcli -f NAME con show | grep "${ids// /\\|}"); do ++ dev=$(echo "$connection" | cut -d '-' -f 2) ++ if [[ $dev != "NAME" && ! -e /sys/class/net/"$dev" ]]; then ++ hcnlog INFO "Delete dead bonding connection $connection" ++ nmcli con delete "$connection" ++ fi ++ done ++ fi + + hcnlog DEBUG "scanhcn: scan for hybrid virtual network finished" + } diff --git a/SPECS/powerpc-utils.spec b/SPECS/powerpc-utils.spec index b4a9896..6fcd13c 100644 --- a/SPECS/powerpc-utils.spec +++ b/SPECS/powerpc-utils.spec @@ -1,6 +1,6 @@ Name: powerpc-utils Version: 1.3.8 -Release: 4%{?dist} +Release: 5%{?dist} Summary: PERL-based scripts for maintaining and servicing PowerPC systems Group: System Environment/Base @@ -37,6 +37,7 @@ Patch9: 0002-sys_ident--skip-length-field-from-search.patch Patch10: powerpc-utils-1.3.8-f1ec5f04fdac3e87c3c85c2d85f79339d916e864.patch Patch11: powerpc-utils-1.3.8-4b2d10942e2d964ecc1fe58c9460c34993ff10be.patch Patch12: powerpc-utils-1.3.8-e51995667279164a6c8ce4c3ba0217fffda22d6d.patch +Patch13: powerpc-utils-1.3.8-fix_boot-time_bonding_interface_cleanup_and_avoid_use_ifcfg.patch %description PERL-based scripts for maintaining and servicing PowerPC systems. @@ -210,6 +211,9 @@ systemctl daemon-reload >/dev/null 2>&1 || : %{_mandir}/man8/drmgr.8* %changelog +* Wed Feb 03 2021 Than Ngo - 1.3.8-5 +- Resolves: #1924150, Fix boot-time bonding interface cleanup and avoid use ifcfg + * Mon Dec 21 2020 Than Ngo - 1.3.8-4 - Resolves: #1909526, additional patches to support Linux Hybrid Network Virtualization - Resolves: #1909135, move commands that dont depend on perl to core subpackage