Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package powerpc-utils for openSUSE:Factory checked in at 2022-02-18 23:02:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/powerpc-utils (Old) and /work/SRC/openSUSE:Factory/.powerpc-utils.new.1958 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "powerpc-utils" Fri Feb 18 23:02:39 2022 rev:125 rq:955643 version:1.3.9 Changes: -------- --- /work/SRC/openSUSE:Factory/powerpc-utils/powerpc-utils.changes 2022-02-17 00:30:52.409429753 +0100 +++ /work/SRC/openSUSE:Factory/.powerpc-utils.new.1958/powerpc-utils.changes 2022-02-18 23:02:50.865413288 +0100 @@ -1,0 +2,43 @@ +Thu Feb 17 11:35:41 UTC 2022 - Michal Suchanek <msucha...@suse.com> + +- lparstat: report LPAR name from lparcfg (bsc#1187716 ltc#193451). + + lparstat-report-LPAR-name-from-lparcfg.patch + +------------------------------------------------------------------- +Thu Feb 17 11:32:16 UTC 2022 - Michal Suchanek <msucha...@suse.com> + +- Update HNV implementation (bsc#1195404 ltc#196259). + + 0001-Validate-connection-manager-and-add-option-to-trace-.patch + + 0002-Factor-out-NetworkManager-nmcli-code.patch + * 0003-Add-new-wicked-functions-from-suse-to-manage-bonding.patch + + 0004-Support-wicked-HNV-using-new-wicked-functions-for-bo.patch + + 0005-hcnmgr-maintain-hcnid-state-for-later-cleanup.patch + + 0006-Add-hcn-init.service.suse.patch + - 0001-Validate-connection-manager.patch + - 0002-factor-out-NetworkManager-nmcli-code.patch + - 0004-Support-wicked-HNV-using-new-wicked-interfaces-for.patch + - 0005-Set-modprobe-bonding-max_bonds-0-option.patch + - 0006-cleanup-hcnmgr-distro-and-service-detection.patch + - 0007-Remove-wicked-ifup-calls-that-just-run-into-timeouts.patch + - 0008-add-note-about-comma-in-hcnmgr-BONDOPTIONS.patch + - 0009-Fix-to-call-wicked-ifreload-directly.patch + - 0010-Fix-incorrect-parameters-to-suse_ifcfg_bond_create.patch + - 0011-Fix-comment-about-setting-primary.patch + - 0012-Description-and-indenting-corrections.patch + - 0013-adjust-sourcing-path-of-the-functions.suse-library.patch + - 0014-Enable-the-network-service-checks.patch + - 0015-add-hcn-init.service.suse-service-covering-wicked.patch + - 0016-functions.suse-fix-suse-wlist-utility-functions.patch + - 0017-functions.suse-don-t-implicitly-set-primary-to-1st-s.patch + - 0018-hcnmgr-add-x-option-to-trace-hcnmgr-script-execution.patch + - 0019-check-platform-service-after-getopts-parsing.patch + - 0020-call-less-intrusive-ifdown-ifup-in-rmdev_wicked.patch + - 0021-call-ifup-instead-ifreload-in-config_vdevice_wicked.patch + - 0022-split-scanhcn-function-into-nm-wicked-variants.patch + - 0023-hcnmgr-merged-scanhcn_wicked-id-fix-and-comments.patch + - 0024-Fix-race-with-udev-renaming-and-hcn-configure.patch + - 0025-hcnmgr-remove-ifcfg-file-dump-from-scanhcn_wicked.patch + - 0026-hcnmgr-move-sourcing-functions.suse-to-wicked-case.patch + - 0027-hcnmgr-extend-suse-os-release-match.patch + +------------------------------------------------------------------- Old: ---- 0001-Validate-connection-manager.patch 0002-factor-out-NetworkManager-nmcli-code.patch 0004-Support-wicked-HNV-using-new-wicked-interfaces-for.patch 0005-Set-modprobe-bonding-max_bonds-0-option.patch 0006-cleanup-hcnmgr-distro-and-service-detection.patch 0007-Remove-wicked-ifup-calls-that-just-run-into-timeouts.patch 0008-add-note-about-comma-in-hcnmgr-BONDOPTIONS.patch 0009-Fix-to-call-wicked-ifreload-directly.patch 0010-Fix-incorrect-parameters-to-suse_ifcfg_bond_create.patch 0011-Fix-comment-about-setting-primary.patch 0012-Description-and-indenting-corrections.patch 0013-adjust-sourcing-path-of-the-functions.suse-library.patch 0014-Enable-the-network-service-checks.patch 0015-add-hcn-init.service.suse-service-covering-wicked.patch 0016-functions.suse-fix-suse-wlist-utility-functions.patch 0017-functions.suse-don-t-implicitly-set-primary-to-1st-s.patch 0018-hcnmgr-add-x-option-to-trace-hcnmgr-script-execution.patch 0019-check-platform-service-after-getopts-parsing.patch 0020-call-less-intrusive-ifdown-ifup-in-rmdev_wicked.patch 0021-call-ifup-instead-ifreload-in-config_vdevice_wicked.patch 0022-split-scanhcn-function-into-nm-wicked-variants.patch 0023-hcnmgr-merged-scanhcn_wicked-id-fix-and-comments.patch 0024-Fix-race-with-udev-renaming-and-hcn-configure.patch 0025-hcnmgr-remove-ifcfg-file-dump-from-scanhcn_wicked.patch 0026-hcnmgr-move-sourcing-functions.suse-to-wicked-case.patch 0027-hcnmgr-extend-suse-os-release-match.patch New: ---- 0001-Validate-connection-manager-and-add-option-to-trace-.patch 0002-Factor-out-NetworkManager-nmcli-code.patch 0004-Support-wicked-HNV-using-new-wicked-functions-for-bo.patch 0005-hcnmgr-maintain-hcnid-state-for-later-cleanup.patch 0006-Add-hcn-init.service.suse.patch lparstat-report-LPAR-name-from-lparcfg.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ powerpc-utils.spec ++++++ --- /var/tmp/diff_new_pack.faYfNq/_old 2022-02-18 23:02:51.573413233 +0100 +++ /var/tmp/diff_new_pack.faYfNq/_new 2022-02-18 23:02:51.581413233 +0100 @@ -37,33 +37,13 @@ Patch11: lparstat-Fix-reported-online-memory-in-legacy-format.patch Patch12: errinjct-sanitize-devspec-output-of-a-newline-if-one.patch Patch14: fix_kexec_service_name_for_suse.patch -Patch15: 0001-Validate-connection-manager.patch -Patch16: 0002-factor-out-NetworkManager-nmcli-code.patch +Patch15: 0001-Validate-connection-manager-and-add-option-to-trace-.patch +Patch16: 0002-Factor-out-NetworkManager-nmcli-code.patch Patch17: 0003-Add-new-wicked-functions-from-suse-to-manage-bonding.patch -Patch18: 0004-Support-wicked-HNV-using-new-wicked-interfaces-for.patch -Patch19: 0005-Set-modprobe-bonding-max_bonds-0-option.patch -Patch20: 0006-cleanup-hcnmgr-distro-and-service-detection.patch -Patch21: 0007-Remove-wicked-ifup-calls-that-just-run-into-timeouts.patch -Patch22: 0008-add-note-about-comma-in-hcnmgr-BONDOPTIONS.patch -Patch23: 0009-Fix-to-call-wicked-ifreload-directly.patch -Patch24: 0010-Fix-incorrect-parameters-to-suse_ifcfg_bond_create.patch -Patch25: 0011-Fix-comment-about-setting-primary.patch -Patch26: 0012-Description-and-indenting-corrections.patch -Patch27: 0013-adjust-sourcing-path-of-the-functions.suse-library.patch -Patch28: 0014-Enable-the-network-service-checks.patch -Patch29: 0015-add-hcn-init.service.suse-service-covering-wicked.patch -Patch30: 0016-functions.suse-fix-suse-wlist-utility-functions.patch -Patch31: 0017-functions.suse-don-t-implicitly-set-primary-to-1st-s.patch -Patch32: 0018-hcnmgr-add-x-option-to-trace-hcnmgr-script-execution.patch -Patch33: 0019-check-platform-service-after-getopts-parsing.patch -Patch34: 0020-call-less-intrusive-ifdown-ifup-in-rmdev_wicked.patch -Patch35: 0021-call-ifup-instead-ifreload-in-config_vdevice_wicked.patch -Patch36: 0022-split-scanhcn-function-into-nm-wicked-variants.patch -Patch37: 0023-hcnmgr-merged-scanhcn_wicked-id-fix-and-comments.patch -Patch38: 0024-Fix-race-with-udev-renaming-and-hcn-configure.patch -Patch39: 0025-hcnmgr-remove-ifcfg-file-dump-from-scanhcn_wicked.patch -Patch40: 0026-hcnmgr-move-sourcing-functions.suse-to-wicked-case.patch -Patch41: 0027-hcnmgr-extend-suse-os-release-match.patch +Patch18: 0004-Support-wicked-HNV-using-new-wicked-functions-for-bo.patch +Patch19: 0005-hcnmgr-maintain-hcnid-state-for-later-cleanup.patch +Patch20: 0006-Add-hcn-init.service.suse.patch +Patch21: lparstat-report-LPAR-name-from-lparcfg.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libnuma-devel ++++++ 0001-Validate-connection-manager-and-add-option-to-trace-.patch ++++++ >From 00f9c425c811e6f9aeb46e4242cfa1f46f3245e1 Mon Sep 17 00:00:00 2001 From: Mingming Cao <m...@linux.vnet.ibm.com> Date: Tue, 15 Feb 2022 23:29:12 -0800 Subject: [PATCH 1/6] Validate connection manager and add option to trace hcnmgr Check and validate what OS is on the system and what type of connection manager is used: Wicked or NetworkManager This patch also add -x option to trace hcnmgr script execution Last, check platform/service after getopts parsing Signed-off-by: Mingming Cao <m...@linux.vnet.ibm.com> Signed-off-by: Marius Tomaschewski <m...@suse.com> --- scripts/hcnmgr | 116 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 24 deletions(-) diff --git a/scripts/hcnmgr b/scripts/hcnmgr index 870f544..7a11bd9 100644 --- a/scripts/hcnmgr +++ b/scripts/hcnmgr @@ -24,12 +24,14 @@ FEATURES="vnic" PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin BOND_BASEPATH="/sys/class/net" +BOND_MODPROBE_OPTS="max_bonds=0" BONDOPTIONS="mode=1,miimon=100,fail_over_mac=2" IFCONFIG_PATH="/etc/sysconfig/network-scripts" PSERIES_PLATFORM=$(dirname "$0")/pseries_platform DT_PATH="/proc/device-tree" HCNMGR="hcnmgr" HCNCMD="" +HCNTRACE="" LOG_FILE="/var/log/hcnmgr" HCN_LOGGING_LEVEL=DEBUG HCNID=0 @@ -39,6 +41,9 @@ MODE="" PHYSLOC="" DEVPATH="" VIO_TYPE="" +DISTRO="" +SERVICE="" + # Usage statements usage() { @@ -63,6 +68,7 @@ usage() { echo "" echo "Optional arguments." echo " -s scan device-tree and configure HCN" + echo " -x trace hcnmgr script execution" echo " -V Display version information and exit" echo " -h Display this help information and exit" echo "" @@ -83,7 +89,7 @@ E_BUSY=16 # Device busy E_ENODEV=19 # Failed get device name E_NOMODULE=5 # Failed to load bonding module E_INVAL_DEV=6 # Vdevice not supported -E_ENETUNREACH=101 # No network management command nmcli +E_ENETUNREACH=101 # No supported network service enabled or management command not found # # err @@ -93,6 +99,7 @@ E_ENETUNREACH=101 # No network management command nmcli err() { local e_mesg local eno=$1 + local msg=$2 case $eno in "$E_INVAL") @@ -114,7 +121,7 @@ err() { e_mesg="$HCNCMD:error code $eno, Failed to load bonding module" ;; "$E_ENETUNREACH") - e_mesg="$HCNCMD:error code $eno, nmcli command not installed" + e_mesg="$HCNCMD:error code $eno, ${msg:-No supported network service enabled or management command not found}" ;; *) e_mesg="$HCNCMD:error code $eno" @@ -627,6 +634,61 @@ scanhcn() { hcnlog DEBUG "scanhcn: scan for hybrid virtual network finished" } +# function check_network_service +# Check what connection manager is used +# On SUSE, it's wicked.sevice (SLES) or NetworkManager.service (SLED) +# with the network.service alias pointing to the enabled service. +# +check_network_service() { + + DISTRO="Unknown" + if test -f /etc/os-release; then + DISTRO=$(grep -oP '(?<=^ID=).+' /etc/os-release | tr -d '"') + fi + + #Validate distro service CLI packages is installed to manage networking + case $DISTRO in + sles|sled|*suse*) + SERVICE=$(systemctl show -P Id network.service 2>/dev/null) + case $SERVICE in + wicked.service) + source /usr/lib/powerpc-utils/functions.suse || \ + err $E_EPERM "Unable to source SUSE function library" + + if ! wicked --version >/dev/null 2>&1; then + err $E_ENETUNREACH "wicked management command not installed" + fi + # hcn-init.service starts before wicked + ;; + NetworkManager.service) + if ! nmcli --version >/dev/null 2>&1; then + err $E_ENETUNREACH "nmcli management command not installed" + fi + # hcn-init.service starts after network manager + if ! systemctl is-active -q "$SERVICE" ; then + err $E_ENETUNREACH "NetworkManager.service not active" + fi + ;; + *) + err $E_ENETUNREACH "HNV is only supported on wicked and NetworkManager" + ;; + esac + ;; + *) + if ! nmcli --version >/dev/null 2>&1; then + err $E_ENETUNREACH "HNV is only supported on NetworkManager" + fi + + # Assume it's NetworkManager.service -- at least the cli is available + SERVICE=NetworkManager.service + if ! systemctl is-active -q "$SERVICE" ; then + err $E_ENETUNREACH "NetworkManager.service not active" + fi + ;; + esac + + hcnlog INFO " LPAR is running OS $DISTRO with network service ${SERVICE%.service}" +} # # Main @@ -642,29 +704,8 @@ echo "=======================$NOW============================" HCNCMD=$(basename "$0") hcnlog DEBUG "$HCNCMD enter" -#Validate this tool is running on powerpc platform -. "$PSERIES_PLATFORM" -if [ "$platform" != "$PLATFORM_PSERIES_LPAR" ]; then - hcnlog INFO "HNV is only supported on PowerVM LPAR" - hcnlog INFO "$HCNCMD exit" - exit 0 -fi - -#Validate NMCLI packages is install to manage networking -if ! nmcli --version >/dev/null 2>&1; then - err $E_ENETUNREACH -fi - -#Validate bonding module is loaded -if ! lsmod | grep -q bonding; then - hcnlog DEBUG "HCNMGR: Bonding module not loaded, load module ..." - if ! modprobe bonding; then - err $E_NOMODULE - fi -fi - #getops for help and version -while getopts "sVhd:" arg; do +while getopts "sxVhd:" arg; do case "$arg" in V) show_version @@ -677,6 +718,9 @@ while getopts "sVhd:" arg; do s) HCNCMD="hcnscan" ;; + x) + HCNTRACE="-x" + ;; d) hcnlog DEBUG "HMC pass log level at $OPTARG" hcnlog DEBUG "$HCNCMD is always log at $HCN_LOGGING_LEVEL level" @@ -691,6 +735,30 @@ done #Log this scripts command line to syslog hcnlog INFO "$HCNCMD $*" +#Enable bash -x or -vx call trace if requested +if [ "X$HCNTRACE" != "X" ] ; then + set "$HCNTRACE" +fi + +#Validate this tool is running on powerpc platform +. "$PSERIES_PLATFORM" +if [ "$platform" != "$PLATFORM_PSERIES_LPAR" ]; then + hcnlog INFO "HNV is only supported on PowerVM LPAR" + hcnlog INFO "$HCNCMD exit" + exit 0 +fi + +#Init the distribution and the network service +check_network_service + +#Validate bonding module is loaded +if ! lsmod | grep -q bonding; then + hcnlog DEBUG "HCNMGR: Bonding module not loaded, load module ..." + if ! modprobe bonding $BOND_MODPROBE_OPTS; then + err $E_NOMODULE + fi +fi + #Parse the DRC_INDEX and HCN_ID from the arguments for param in "$@"; do if [[ $param =~ ^DRC_INDEX=(.+)$ ]]; then -- 2.34.1 ++++++ 0002-Factor-out-NetworkManager-nmcli-code.patch ++++++ >From 4a6a1972829a8430a40c81cd2fcd48981de56f86 Mon Sep 17 00:00:00 2001 From: Mingming Cao <m...@linux.vnet.ibm.com> Date: Tue, 15 Feb 2022 23:59:43 -0800 Subject: [PATCH 2/6] Factor out NetworkManager nmcli code Move nmcli code to corresponding hcn command/functions for networkmanager Signed-off-by: Mingming Cao <m...@linux.vnet.ibm.com> Signed-off-by: Marius Tomaschewski <m...@suse.com> --- scripts/hcnmgr | 192 ++++++++++++++++++++++++++++++++++--------------- 1 file changed, 135 insertions(+), 57 deletions(-) diff --git a/scripts/hcnmgr b/scripts/hcnmgr index 7a11bd9..1551724 100644 --- a/scripts/hcnmgr +++ b/scripts/hcnmgr @@ -282,13 +282,13 @@ get_dev_hcn() { } # -# function do_config_vdevice +# function do_config_vdevice_nm # configure or create HCN (active-backup bonding) # add device as bonding slave # # On enter, the vdevice name, mode, hcnid and drcindex are set -# -do_config_vdevice() { +# Based on Network Manager nmcli +do_config_vdevice_nm() { hcnlog DEBUG "do_config_vdevice: enter" BONDNAME=bond$HCNID @@ -359,14 +359,22 @@ do_config_vdevice() { return $E_SUCCESS } +do_config_vdevice() { + case $SERVICE in + NetworkManager.service) + do_config_vdevice_nm + ;; + esac +} + # -# function cfghcn +# function cfghcn_nm # Given device DRC_INDEX, configure or create HCN (active-backup bonding) # add device as bonding slave # # $1 DRC_INDEX of the hybrid network device # -cfghcn() { +cfghcn_nm() { local retry=3 hcnlog DEBUG "cfghcn: enter $1" @@ -392,6 +400,33 @@ cfghcn() { return $E_SUCCESS } + + +# function cfghcn +# Given device DRC_INDEX, configure or create HCN (active-backup bonding) +# add device as bonding slave +# +# $1 DRC_INDEX of the hybrid network device +# +cfghcn() { + hcnlog DEBUG "cfghcn: enter $1" + + case $SERVICE in + NetworkManager.service) + cfghcn_nm $1 + ;; + esac + + hcnlog DEBUG "cfghcn: exit" + return $E_SUCCESS +} + +rmhcn_nm() { + for connection in $(nmcli -f NAME con show | grep "$BONDNAME"); do + hcnlog INFO "Delete bonding connection $connection" + nmcli con delete "$connection" + done +} # # function rmhcn # Given HCNID, remove HCN @@ -410,14 +445,24 @@ rmhcn() { fi hcnlog INFO "rmhcn: delete bond $BONDNAME and slaves " - for connection in $(nmcli -f NAME con show | grep "$BONDNAME"); do - hcnlog INFO "Delete bonding connection $connection" - nmcli con delete "$connection" - done + case $SERVICE in + NetworkManager.service) + rmhcn_nm + ;; + esac hcnlog DEBUG "rmhcn: exit" return $E_SUCCESS } +qrydev_nm() { + if ! nmcli -f DEVICE con show --active | grep -q "$DEVNAME"; then + hcnlog DEBUG "network connection $BONDNAME-$DEVNAME is inactive or nonexist" + hcnlog DEBUG "HCNID $HCNID devname $DEVNAME mode $MODE physloc $PHYSLOC DEVPATH $DEVPATH" + hcnlog DEBUG "qryhcn: exit" + # In this case, tell HMC to do rmdev and okay to migrate + return $E_SUCCESS + fi +} # #function qrydev # Called by HMC right before migration, to see if it is safe to @@ -445,13 +490,11 @@ qrydev() { BOND_PATH=$BOND_BASEPATH/$BONDNAME/bonding hcnlog DEBUG "check if the network interface for this SR_IOV is not up, return success" - if ! nmcli -f DEVICE con show --active | grep -q "$DEVNAME"; then - hcnlog DEBUG "network connection $BONDNAME-$DEVNAME is inactive or nonexist" - hcnlog DEBUG "HCNID $HCNID devname $DEVNAME mode $MODE physloc $PHYSLOC DEVPATH $DEVPATH" - hcnlog DEBUG "qryhcn: exit" - # In this case, tell HMC to do rmdev and okay to migrate - return $E_SUCCESS - fi + case $SERVICE in + NetworkManager.service) + qrydev_nm + ;; + esac hcnlog DEBUG "check if there is bond for this $HCNID" if [ ! -d "$BOND_PATH" ]; then @@ -484,8 +527,14 @@ qrydev() { # show_hcnstatus() { hcnlog DEBUG "log connection and device status to $LOG_FILE" - nmcli connection show >>$LOG_FILE - nmcli device status >>$LOG_FILE + + case $SERVICE in + NetworkManager.service) + nmcli connection show >>$LOG_FILE + nmcli device status >>$LOG_FILE + ;; + esac + ip addr show >>$LOG_FILE } @@ -498,6 +547,13 @@ check_eth() { nmcli -f DEVICE con show | grep -q "$1" } +rmdev_nm() { + hcnlog DEBUG "rmdev_nm: enter" + if check_eth "$DEVNAME"; then + hcnlog INFO "rmdev: delete $BONDNAME-$DEVNAME connection" + nmcli con delete "$BONDNAME-$DEVNAME" + fi +} # #function rmdev # this is called at pre-migration time, remove sr-iov from HCN @@ -515,16 +571,42 @@ rmdev() { if [[ $HCNID != "$2" ]]; then hcnlog WARN "rmdev: mismatch drc index $1 HCNID $2" fi - if check_eth "$DEVNAME"; then - hcnlog INFO "rmdev: delete $BONDNAME-$DEVNAME connection" - nmcli con delete "$BONDNAME-$DEVNAME" - fi + + case $SERVICE in + NetworkManager.service) + rmdev_nm + ;; + esac + hcnlog DEBUG "rmdev: exit" return $E_SUCCESS } +scanhcn_cleanup_old_hnv_nm() { + # After online from inactive migration, destination + # LPAR may have same mvf devname but associated with different + # bonding than from source LPAR + # clean up expired bonding SR_IOV connections + + + for cfg in $(ls $IFCONFIG_PATH | grep "$DEVNAME" | grep "bond"); do + hid=$(echo "$cfg" | sed -e 's/ifcfg-//' | cut -d '-' -f 1 | sed -e 's/bond//') + if [ -e "$IFCONFIG_PATH/ifcfg-$DEVNAME" ]; then + rm "$IFCONFIG_PATH/ifcfg-$DEVNAME" + fi + if [[ $hid != "" && $hid != "$HCNID" ]] ; then + hcnlog INFO "Delete dead bonding slave ifcfg file $IFCONFIG_PATH/$cfg" + rm $IFCONFIG_PATH/"$cfg" + + if nmcli -f NAME con show | grep -q "bond$hid-$DEVNAME\s"; then + hcnlog INFO "Delete dead bonding connection $connection" + nmcli con delete "bond$hid-$DEVNAME" + fi + fi + done +} # -# function scanhcn +# function scanhcn_nm # HMC supports adding migratable sr-iov when LPAR is inactive. This allows LPAR # can be migrated when inactive with SR_IOV VFS. It will set the # migratable sr-iov device and it's backup vdevice vnic or veth with @@ -540,8 +622,8 @@ rmdev() { # For each matching primary and backup virtual device with same ibm property # ibm,hcn-id, if the hybrid network has not been created, create HCN # (active-backup bonding) for them. -#s -scanhcn() { +# +scanhcn_nm() { local HcnIds=() hcnlog DEBUG "scanhcn: on boot scan for hybrid virtual network starts" @@ -556,27 +638,11 @@ scanhcn() { [ -d "$dev" ] || continue if [ -e "$dev"/ibm,hcn-id ] && get_dev_hcn "$dev"; then hcnlog DEBUG "scanhcn found sr-iov device with hcnid " - - # After online from inactive migration, destination - # LPAR may have same mvf devname but associated with different - # bonding than from source LPAR - # clean up expired bonding SR_IOV connections - - for cfg in $(ls $IFCONFIG_PATH | grep "$DEVNAME" | grep "bond"); do - hid=$(echo "$cfg" | sed -e 's/ifcfg-//' | cut -d '-' -f 1 | sed -e 's/bond//') - if [ -e "$IFCONFIG_PATH/ifcfg-$DEVNAME" ]; then - rm "$IFCONFIG_PATH/ifcfg-$DEVNAME" - fi - if [[ $hid != "" && $hid != "$HCNID" ]] ; then - hcnlog INFO "Delete dead bonding slave ifcfg file $IFCONFIG_PATH/$cfg" - rm $IFCONFIG_PATH/"$cfg" - if nmcli -f NAME con show | grep -q "bond$hid-$DEVNAME\s"; then - hcnlog INFO "Delete dead bonding connection $connection" - nmcli con delete "bond$hid-$DEVNAME" - fi - fi - done - + case $SERVICE in + NetworkManager.service) + scanhcn_cleanup_old_hnv_nm + ;; + esac hcnlog INFO "scanhcn configure HCN and sr-iov device" do_config_vdevice # Save found HCN ids in array HcnIds @@ -621,19 +687,31 @@ scanhcn() { # 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 - + case $SERVICE in + NetworkManager.service) + # 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 + ;; + esac hcnlog DEBUG "scanhcn: scan for hybrid virtual network finished" } + +scanhcn() { + case $SERVICE in + NetworkManager.service) + scanhcn_nm + ;; + esac +} + # function check_network_service # Check what connection manager is used # On SUSE, it's wicked.sevice (SLES) or NetworkManager.service (SLED) -- 2.34.1 ++++++ 0003-Add-new-wicked-functions-from-suse-to-manage-bonding.patch ++++++ --- /var/tmp/diff_new_pack.faYfNq/_old 2022-02-18 23:02:51.629413229 +0100 +++ /var/tmp/diff_new_pack.faYfNq/_new 2022-02-18 23:02:51.629413229 +0100 @@ -1,28 +1,27 @@ -From aeaf71efb4a761892f566f996d70d60e4233958e Mon Sep 17 00:00:00 2001 +From df3577154f55a542613779596d26369e7a0d74b8 Mon Sep 17 00:00:00 2001 From: Mingming Cao <m...@linux.vnet.ibm.com> -Date: Thu, 13 Jan 2022 06:22:46 -0800 -Subject: [PATCH 03/27] Add new wicked functions from suse to manage bonding - interfaces +Date: Wed, 16 Feb 2022 00:16:52 -0800 +Subject: [PATCH 3/6] Add new wicked functions from suse to manage bonding suse specific hcnmgr utilities to manipulate suse ifcfg files as supported by yast2 network. -Signed-off-by: Marius Tomaschewski <m...@suse.com> +Signed-off-by: Marius Tomaschewski <m...@suse.com> --- - scripts/functions.suse | 400 +++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 400 insertions(+) + scripts/functions.suse | 386 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 386 insertions(+) create mode 100644 scripts/functions.suse diff --git a/scripts/functions.suse b/scripts/functions.suse new file mode 100644 -index 0000000..4001bb8 +index 0000000..06696dd --- /dev/null +++ b/scripts/functions.suse -@@ -0,0 +1,400 @@ +@@ -0,0 +1,386 @@ +#! /bin/bash +# ^^^^^^^^^ +# -+# Copyright (c) 2021 SUSE LLC ++# Copyright (c) 2022 SUSE LLC +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License @@ -40,28 +39,29 @@ +# Authors: +# Marius Tomaschewski <m...@suse.com> +# -+# suse specific hcnmgr utilities to manipulate suse ifcfg files -+# as supported by yast2 network. ++# Bash function library for hcnmgr providing utilities to manipulate ++# suse ifcfg config files as supported by yast2 network and wicked. +# ++### + +suse_ifcfg_config_dir="/etc/sysconfig/network" + +suse_wlist_find() +{ -+ local item want="$1" ; shift -+ for item in $* ; do -+ [ X"$want" = X"$item" ] && return 0 -+ done -+ return 1 ++ local item want="$1" ; shift ++ for item in "$@" ; do ++ [ X"$want" = X"$item" ] && return 0 ++ done ++ return 1 +} +suse_wlist_uniq() +{ + local item list=() -+ for item in $* ; do -+ suse_wlist_find "$item" "$list" && continue ++ for item in "$@" ; do ++ suse_wlist_find "$item" "${list[@]}" && continue + list+=("$item") -+ done -+ echo "${list[*]}" ++ done ++ echo "${list[@]}" +} +suse_ifcfg_unquote() +{ @@ -135,10 +135,6 @@ + if [ X"${options[*]}" = X ] ; then + # default options as used by the hcnmgr + options=(mode=active-backup miimon=100 fail_over_mac=follow) -+ # set 1st slave as primary to inherit the mac from (by default) -+ if [ X"${slaves[0]}" != X ] ; then -+ options+=("primary=${slaves[0]}") -+ fi + fi + + echo "STARTMODE='auto'" @@ -347,7 +343,7 @@ + [ X"$file" != X ] && rm -f -- "$file" + + # TODO: cleanup interfaces on top of the bond -+ # _if_ the hnv setup permit to use them ++ # _if_ the hnv setup permit to use them + # e.g.: brX { bondX }, brN { bondX.N } +} + @@ -388,8 +384,6 @@ + if [ X"$primary" != X ] ; then + if suse_wlist_find "$primary" "${nslaves[*]}" ; then + noptions+=("primary=$primary") -+ elif [ X"${nslaves[0]}" != X ] ; then -+ noptions+=("primary=${nslaves[0]}") + fi + fi + fi @@ -410,15 +404,6 @@ + return 1 +} + -+wicked_reload() -+{ -+ if [ $# -eq 0 ] ; then -+ rcnetwork reload -+ elif systemctl_is_active wicked.service ; then -+ wicked ifreload -- "$@" -+ fi -+} -+ -- 2.34.1 ++++++ 0004-Support-wicked-HNV-using-new-wicked-functions-for-bo.patch ++++++ >From 2a692e0e726f574a2bd92ed0a99403bb7aa2c3ae Mon Sep 17 00:00:00 2001 From: Mingming Cao <m...@linux.vnet.ibm.com> Date: Wed, 16 Feb 2022 00:31:23 -0800 Subject: [PATCH 4/6] Support wicked HNV using new wicked functions for bonding first: Add wicked support hnv command functions second: fixed offline remove HNV Added scanhcn_wicked() to be able to reconfigure HNV at the end of scan. When lpar has been shut down, and an old HNV can be removed, the virtual device can be added to a new HNV, the configration changes then. This requires to reconfigure all bonds. Third, udev renaming racing with hcncfg and wicked ifup, here we improved wicked cfghcn function by always waiting for udev events complete before search for device to get the device-ready device names Last: post LPM migration the new sr_iov should be set as primary, it currently calling wicked ifup after the ifcfg file modified to make the sr_iov as primary device. However the kernel is not noticed, we added a workaround here to directly update via sysfs Signed-off-by: Marius Tomaschewski <m...@suse.com> Signed-off-by: Mingming Cao <m...@linux.vnet.ibm.com> --- scripts/hcnmgr | 234 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 233 insertions(+), 1 deletion(-) diff --git a/scripts/hcnmgr b/scripts/hcnmgr index 1551724..c617960 100644 --- a/scripts/hcnmgr +++ b/scripts/hcnmgr @@ -359,11 +359,68 @@ do_config_vdevice_nm() { return $E_SUCCESS } +# function do_config_vdevice_wicked +# configure or create HCN (active-backup bonding) +# add device as bonding slave +# +# On enter, the vdevice name, mode, hcnid and drcindex are set +# +do_config_vdevice_wicked() { + hcnlog DEBUG "do_config_vdevice: enter" + + BONDNAME=bond$HCNID + BOND_PATH=$BOND_BASEPATH/$BONDNAME/bonding + + hcnlog DEBUG "Check if there is bond $BONDNAME with hcn id $HCNID" + + if ! suse_ifcfg_is_bond_master "$BONDNAME"; then + hcnlog INFO "create bonding for $BONDNAME with bond.options $BONDOPTIONS " + # Note: wicked needs spaces in BONDING_MODULE_OPTS as comma is + # used/reserved to separate multiple arp_ip_targets, thus + # this could result in invalid options...: + suse_ifcfg_bond_create "$BONDNAME" "" "${BONDOPTIONS//,/ }" + fi + + # Add device to the bond + hcnlog INFO "suse_ifcfg_bond_add_slave $BONDNAME $DEVNAME" + if ! suse_ifcfg_bond_add_slave "$BONDNAME" "$DEVNAME"; then + hcnlog DEBUG "enslave $DEVNAME failed" + return $E_ENODEV + fi + + # if the device is primary, adjust it in the config + if [[ $MODE == "primary" ]]; then + hcnlog INFO "Change bonding primary slave to $DEVNAME" + suse_ifcfg_bond_set_primary "$BONDNAME" "$DEVNAME" + fi + + # Prepare configuration while hcn-init.service run, but do not try + # to apply when the wicked.service aka network.service is active. + # The network.service start at boot (or next one) will apply it. + if systemctl is-active -q wicked.service ; then + # Apply the config changes to wicked + hcnlog DEBUG "Bring up the $BONDNAME interface" + wicked ifup "$BONDNAME" + + # workaround: make sure the primary gets applied + # so kernel reselect it as primary + if [[ $MODE == "primary" ]]; then + echo "$DEVNAME" > "$BOND_PATH/primary" + fi + fi + + hcnlog DEBUG "do_config_vdevice: exit" + return $E_SUCCESS +} + do_config_vdevice() { case $SERVICE in NetworkManager.service) do_config_vdevice_nm ;; + wicked.service) + do_config_vdevice_wicked + ;; esac } @@ -401,7 +458,29 @@ cfghcn_nm() { return $E_SUCCESS } +# +# function cfghcn_wicked +# Given device DRC_INDEX, configure or create HCN (active-backup bonding) +# add device as bonding slave +# +# $1 DRC_INDEX of the hybrid network device +# +cfghcn_wicked() { + hcnlog DEBUG "cfghcn wicked: enter $1" + + hcnlog DEBUG "cfg_hcn wicked: wait for udev events complete, udevadm settle" + udevadm settle + search_dev "$1" + + hcnlog DEBUG "cfg_hcn: calling do_confi_vdevice to enslave $DEVNAME to HNV" + do_config_vdevice + + hcnlog DEBUG "cfghcn wicked: exit" + return $E_SUCCESS +} + +# # function cfghcn # Given device DRC_INDEX, configure or create HCN (active-backup bonding) # add device as bonding slave @@ -415,6 +494,9 @@ cfghcn() { NetworkManager.service) cfghcn_nm $1 ;; + wicked.service) + cfghcn_wicked $1 + ;; esac hcnlog DEBUG "cfghcn: exit" @@ -427,6 +509,13 @@ rmhcn_nm() { nmcli con delete "$connection" done } + +rmhcn_wicked() { + hcnlog INFO "Delete bonding $BONDNAME" + wicked ifdown "$BONDNAME" + suse_ifcfg_bond_delete "$BONDNAME" +} + # # function rmhcn # Given HCNID, remove HCN @@ -449,6 +538,9 @@ rmhcn() { NetworkManager.service) rmhcn_nm ;; + wicked.service) + rmhcn_wicked + ;; esac hcnlog DEBUG "rmhcn: exit" return $E_SUCCESS @@ -463,6 +555,15 @@ qrydev_nm() { return $E_SUCCESS fi } +qrydev_wicked() { + if ! wicked ifstatus $DEVNAME |grep link |grep up; then + hcnlog DEBUG "network connection $BONDNAME-$DEVNAME is inactive or nonexist" + hcnlog DEBUG "HCNID $HCNID devname $DEVNAME mode $MODE physloc $PHYSLOC DEVPATH $DEVPATH" + hcnlog DEBUG "qryhcn: exit" + # In this case, tell HMC to do rmdev and okay to migrate + return $E_SUCCESS + fi +} # #function qrydev # Called by HMC right before migration, to see if it is safe to @@ -494,6 +595,9 @@ qrydev() { NetworkManager.service) qrydev_nm ;; + wicked.service) + qrydev_wicked + ;; esac hcnlog DEBUG "check if there is bond for this $HCNID" @@ -533,9 +637,16 @@ show_hcnstatus() { nmcli connection show >>$LOG_FILE nmcli device status >>$LOG_FILE ;; + wicked.service) + if systemctl is-active -q "$SERVICE" ; then + wicked ifstatus all >>$LOG_FILE + else + hcnlog DEBUG "network service $SERVICE is currently inactive" + fi + ;; esac - ip addr show >>$LOG_FILE + ip -d addr show >>$LOG_FILE } # @@ -554,6 +665,16 @@ rmdev_nm() { nmcli con delete "$BONDNAME-$DEVNAME" fi } + +rmdev_wicked() { + hcnlog DEBUG "rmdev_wicked: enter" + suse_ifcfg_bond_del_slave "$BONDNAME" "$DEVNAME" + wicked ifdown "$DEVNAME" + wicked ifup "$BONDNAME" + hcnlog DEBUG "rmdev_wicked: exit" + return $E_SUCCESS +} + # #function rmdev # this is called at pre-migration time, remove sr-iov from HCN @@ -576,6 +697,9 @@ rmdev() { NetworkManager.service) rmdev_nm ;; + wicked.service) + rmdev_wicked + ;; esac hcnlog DEBUG "rmdev: exit" @@ -701,14 +825,122 @@ scanhcn_nm() { done ;; esac + hcnlog DEBUG "scanhcn: scan for hybrid virtual network finished" } +# +# function scanhcn_wicked +# +# This function will scan the device-tree to find new SR-IOV vfs and virtual devices +# that has configured as migratable sr-iov device or as backup vdevice during LPAR +# is inactive (or during manual 'hcnmgr -s' call). +# +scanhcn_wicked() { + local hcnids=() + local -A hcn_devs hcn_primary + local file dev + + hcnlog DEBUG "scanhcn: on boot scan for hybrid virtual network starts" + + hcnlog DEBUG "search sr_iov device with ibm,hcn-id propterty......" + # Look at pci ethernet devices for SR_IOV VFs with ibm,hcn-id propterty + # join or Create bond for this hcnid if not exist, add SR-IOVs as primary + # slave for this bond accosiated with hcnid, if not already to + for pci_dev in "$DT_PATH"/pci*; do + [ -d "$pci_dev" ] || continue + for dev in "$pci_dev"/ethernet*; do + [ -d "$dev" ] || continue + if [ -e "$dev"/ibm,hcn-id ] && get_dev_hcn "$dev"; then + hcnlog DEBUG "scanhcn found $MODE sr-iov device $DEVNAME with hcnid $HCNID" + # Collect what we have found + hcnids=($(suse_wlist_uniq ${hcnids[*]} $HCNID)) + hcn_devs[$HCNID]=$(suse_wlist_uniq ${hcn_devs[$HCNID]} $DEVNAME) + [ "X$MODE" = "Xprimary" ] && hcn_primary[$HCNID]="$DEVNAME" + fi + done + done + + hcnlog DEBUG "search ibmveth device with ibm,hcn-id propterty......" + # Look at every vNIC device with ibm,hcn-id propterty + # join or create bond for this hcnid if not exist, add vnic device as + # slave for this bond accosiated with hcnid, if not already to + for dev in "$DT_PATH"/vdevice/l-lan*; do + [ -d "$dev" ] || continue + if [ -e "$dev"/ibm,hcn-id ] && get_dev_hcn "$dev"; then + hcnlog DEBUG "scanhcn found $MODE veth device $DEVNAME with hcnid $HCNID" + # Collect what we have found + hcnids=($(suse_wlist_uniq ${hcnids[*]} $HCNID)) + hcn_devs[$HCNID]=$(suse_wlist_uniq ${hcn_devs[$HCNID]} $DEVNAME) + [ "X$MODE" = "Xprimary" ] && hcn_primary[$HCNID]="$DEVNAME" + fi + done + + hcnlog DEBUG "search vnic device with ibm,hcn-id propterty......" + # Look at every vNIC device with ibm,hcn-id propterty + # join or create bond for this hcnid if not exist, add vnic device as + # slave for this bond accosiated with hcnid, if not already to + for dev in "$DT_PATH"/vdevice/vnic*; do + [ -d "$dev" ] || continue + if [ -e "$dev"/ibm,hcn-id ] && get_dev_hcn "$dev"; then + hcnlog DEBUG "scanhcn found $MODE vnic device $DEVNAME with hcnid $HCNID" + # Collect what we have found + hcnids=($(suse_wlist_uniq ${hcnids[*]} $HCNID)) + hcn_devs[$HCNID]=$(suse_wlist_uniq ${hcn_devs[$HCNID]} $DEVNAME) + [ "X$MODE" = "Xprimary" ] && hcn_primary[$HCNID]="$DEVNAME" + fi + done + + # TODO: when the LPAR has been shut down and the configuration changes then, + # e.g. from: bond$HCNID_old { eth0, eth1 } + # into: bond$HCNID_new { eth0, eth2 } + # ^^^^ + # there is still a config for bond$HCNID_old that we need to remove + # at LPAR boot _before_ we can setup bond$HCNID_new as the new bond + # is (re)using one slave device of the old bond.. + # This requires to know which bond is managed via HCN and we may need + # to mark or remember the hcn managed bonds... + + # (Re)configure all bonds + for id in "${hcnids[@]}" ; do + local bond="bond$id" + local primary="${hcn_primary[$id]}" + local devices="${hcn_devs[$id]}" + + hcnlog INFO "scanhcn configure HCN $bond with devices '$devices'" + if suse_ifcfg_bond_modify "$bond" "$devices" ; then + hcnlog INFO "scanhcn configured bond '$bond' config with devices '$devices'" + else + hcnlog INFO "scanhcn failed to configure bond '$bond' with devices '$devices'" + continue + fi + if suse_ifcfg_bond_set_primary "$bond" "$primary" ; then + hcnlog INFO "scanhcn adjusted bond '$bond' config primary to '$primary'" + else + hcnlog INFO "scanhcn failed to adjust bond '$bond' config primary to '$primary'" + fi + + if systemctl is-active -q wicked.service ; then + hcnlog INFO "scanhcn reloading HCN bonding: $bond" + wicked ifreload "$bond" + else + hcnlog INFO "scanhcn omits HCN bondings reload due to inactive network" + # at boot, hcn-init.service adjusts the configuration and + # the wicked.service starting after sets up the bondings. + fi + done + + hcnlog DEBUG "scanhcn: scan for hybrid virtual network finished" + return $E_SUCCESS +} scanhcn() { case $SERVICE in NetworkManager.service) scanhcn_nm ;; + wicked.service) + scanhcn_wicked + ;; esac } -- 2.34.1 ++++++ 0005-hcnmgr-maintain-hcnid-state-for-later-cleanup.patch ++++++ >From 3f9f6c8f47bc46448ce77617fd6febaddf8008de Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski <m...@suse.de> Date: Wed, 16 Feb 2022 19:20:27 +0100 Subject: [PATCH 5/6] hcnmgr: maintain hcnid state for later cleanup When the LPAR has been shut down and the configuration changes then, there is still previous bonding config (e.g. bond<old HCNID>), that needs to be cleaned up while in hcn-init.service start (hcnmgr -s). --- scripts/hcnmgr | 78 ++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 60 insertions(+), 18 deletions(-) diff --git a/scripts/hcnmgr b/scripts/hcnmgr index c617960..ce34179 100644 --- a/scripts/hcnmgr +++ b/scripts/hcnmgr @@ -32,6 +32,7 @@ DT_PATH="/proc/device-tree" HCNMGR="hcnmgr" HCNCMD="" HCNTRACE="" +STATEDIR="/var/lib/powerpc-utils/hcnmgr" LOG_FILE="/var/log/hcnmgr" HCN_LOGGING_LEVEL=DEBUG HCNID=0 @@ -167,6 +168,28 @@ xdump4() { hexdump -n 4 -ve '/1 "%02x"' "$1" } +hcnid_state_create() +{ + local hcnid="$1" + [ "X$hcnid" != "X" ] && mkdir -p -- "$STATEDIR/$hcnid" +} +hcnid_state_remove() +{ + local hcnid="$1" + [ "X$hcnid" != "X" ] && rm -rf -- "$STATEDIR/$hcnid" +} +hcnid_state_list() +{ + local revert + + shopt -q nullglob ; revert=$? + shopt -s nullglob + for dir in "$STATEDIR"/* ; do + echo "${dir##*/}" + done + [ $revert -eq 0 ] || shopt -u nullglob +} + # function search_dev: # Given DRX_INDEX, Search for device-tree, looking for migratable SR_IOV # backend vnic or ibmveth device to configure hybrid network @@ -414,6 +437,7 @@ do_config_vdevice_wicked() { } do_config_vdevice() { + hcnid_state_create "$HCNID" case $SERVICE in NetworkManager.service) do_config_vdevice_nm @@ -542,6 +566,7 @@ rmhcn() { rmhcn_wicked ;; esac + hcnid_state_remove "$HCNID" hcnlog DEBUG "rmhcn: exit" return $E_SUCCESS } @@ -837,12 +862,14 @@ scanhcn_nm() { # is inactive (or during manual 'hcnmgr -s' call). # scanhcn_wicked() { - local hcnids=() + local hcnid hcnids=() local -A hcn_devs hcn_primary local file dev hcnlog DEBUG "scanhcn: on boot scan for hybrid virtual network starts" + udevadm settle + hcnlog DEBUG "search sr_iov device with ibm,hcn-id propterty......" # Look at pci ethernet devices for SR_IOV VFs with ibm,hcn-id propterty # join or Create bond for this hcnid if not exist, add SR-IOVs as primary @@ -891,22 +918,37 @@ scanhcn_wicked() { fi done - # TODO: when the LPAR has been shut down and the configuration changes then, - # e.g. from: bond$HCNID_old { eth0, eth1 } - # into: bond$HCNID_new { eth0, eth2 } - # ^^^^ - # there is still a config for bond$HCNID_old that we need to remove - # at LPAR boot _before_ we can setup bond$HCNID_new as the new bond - # is (re)using one slave device of the old bond.. - # This requires to know which bond is managed via HCN and we may need - # to mark or remember the hcn managed bonds... - - # (Re)configure all bonds - for id in "${hcnids[@]}" ; do - local bond="bond$id" - local primary="${hcn_primary[$id]}" - local devices="${hcn_devs[$id]}" + # Cleanup (and shutdown) obsolete bondings or unenslave obsolete slaves + # This can happen when the LPAR has been shut down and reconfigured at + # next boot (or as attempt to fix via manual rescan when something went + # wrong before). + for hcnid in $(hcnid_state_list) ; do + local bond="bond$hcnid" + if suse_wlist_find "$hcnid" "${hcnids[@]}" ; then + local devices=(${hcn_devs[$hcnid]}) + for dev in $(suse_ifcfg_bond_get_slaves "$bond") ; do + suse_wlist_find "$dev" "${devices[@]}" && continue + suse_ifcfg_bond_del_slave "$bond" "$dev" + if systemctl is-active -q wicked.service ; then + wicked ifdown "$dev" + fi + done + else + suse_ifcfg_bond_delete "$bond" + if systemctl is-active -q wicked.service ; then + wicked ifdown "$bond" + fi + hcnid_state_remove "$hcnid" + fi + done + + # Configure (and set up) actual bonds with current device list + for hcnid in "${hcnids[@]}" ; do + local bond="bond$hcnid" + local primary="${hcn_primary[$hcnid]}" + local devices="${hcn_devs[$hcnid]}" + hcnid_state_create "$hcnid" hcnlog INFO "scanhcn configure HCN $bond with devices '$devices'" if suse_ifcfg_bond_modify "$bond" "$devices" ; then hcnlog INFO "scanhcn configured bond '$bond' config with devices '$devices'" @@ -921,8 +963,8 @@ scanhcn_wicked() { fi if systemctl is-active -q wicked.service ; then - hcnlog INFO "scanhcn reloading HCN bonding: $bond" - wicked ifreload "$bond" + hcnlog INFO "scanhcn starting HCN bonding: $bond" + wicked ifup "$bond" else hcnlog INFO "scanhcn omits HCN bondings reload due to inactive network" # at boot, hcn-init.service adjusts the configuration and -- 2.34.1 ++++++ 0006-Add-hcn-init.service.suse.patch ++++++ >From 0f2489fd015cce2662bde4a98a6c54b8432ee667 Mon Sep 17 00:00:00 2001 From: Mingming Cao <m...@linux.vnet.ibm.com> Date: Wed, 16 Feb 2022 01:09:05 -0800 Subject: [PATCH 6/6] Add hcn-init.service.suse --- configure.ac | 2 +- systemd/hcn-init.service.suse.in | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 systemd/hcn-init.service.suse.in diff --git a/configure.ac b/configure.ac index 79d6cf7..fd275be 100644 --- a/configure.ac +++ b/configure.ac @@ -117,5 +117,5 @@ LOCAL_CHECK_FLAGS AC_CONFIG_FILES([Makefile powerpc-utils.spec systemd/smt_off.service]) AC_CONFIG_FILES([systemd/smtstate.service scripts/smtstate]) -AC_CONFIG_FILES([systemd/hcn-init.service]) +AC_CONFIG_FILES([systemd/hcn-init.service systemd/hcn-init.service.suse]) AC_OUTPUT diff --git a/systemd/hcn-init.service.suse.in b/systemd/hcn-init.service.suse.in new file mode 100644 index 0000000..f841755 --- /dev/null +++ b/systemd/hcn-init.service.suse.in @@ -0,0 +1,13 @@ +[Unit] +Description=hybrid virtual network scan and config +After=network-pre.target NetworkManager.service +Before=wicked.service +Requisite=network.service +PartOf=network.service + +[Service] +Type=oneshot +ExecStart=@sbindir@/hcnmgr -s + +[Install] +WantedBy=multi-user.target network.target -- 2.34.1 ++++++ lparstat-report-LPAR-name-from-lparcfg.patch ++++++ >From 615e8a4d003b4aba46bcf2103a7fa9e26b16169b Mon Sep 17 00:00:00 2001 From: Laurent Dufour <lduf...@linux.ibm.com> Date: Wed, 1 Dec 2021 20:09:27 +0100 Subject: [PATCH] lparstat: report LPAR name from lparcfg Upstream: accepted - expected 1.3.10 Git-commit: 615e8a4d003b4aba46bcf2103a7fa9e26b16169b If the kernel is reporting the LPAR name in /proc/powerpc/lparcfg, report that value instead of the one found in the Device Tree which is not updated when the user change the LPAR in the HMC. Signed-off-by: Laurent Dufour <lduf...@linux.ibm.com> Signed-off-by: Tyrel Datwyler <tyr...@linux.ibm.com> --- src/lparstat.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lparstat.c b/src/lparstat.c index 5ea1a62..37cd31a 100644 --- a/src/lparstat.c +++ b/src/lparstat.c @@ -795,6 +795,10 @@ void get_node_name(struct sysentry *se, char *buf) void get_partition_name(struct sysentry *se, char *buf) { + if (se->value[0] != '\0') { + strcpy(buf, se->value); + return; + } return get_name("/proc/device-tree/ibm,partition-name", buf); } -- 2.34.1