2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 19:22:05 +00:00

bmcsetup: enhance BMC port configuration for Dell systems

Add optional values to ipmi.bmcport to support more fine-grained
configuration for Dell servers, and mirror the `ipmitool delloem`
capabilities:

   lan set <Mode>
    sets the NIC Selection Mode :
        dedicated, shared with lom<idx>

   lan set <Shared Failover Mode>
    sets the shared Failover Mode :
        shared with failover lom<idx>
        shared with failover all loms,
        shared with failover none.

This patch introduces the possibility to provide 3 (space-separated)
values for ipmi.bmcport:
  1st value:  0 = shared / 1 = dedicated
  2nd value   shared LOM (1-4)   (0 or no value means first available LOM)
  3rd value:  failover LOM (1-4) (0 means no failover, no value means all LOMs)

To ensure maximum compatibility with the default 0/1 shared/dedicated
scheme, the 2nd and 3rd values are optional, and will retain the
previous behavior when not specified.

Examples:

ipmi.bmcport value      BMC interface configuration
0                       Shared with first available interface, failover with
                        all LOMs (catch-all mode)
0 1                     Shared with LOM1, failover all LOMs
0 1 2                   Shared with LOM1, failover LOM2
0 2 0                   Shared with LOM2, no failover
1                       Dedicated
This commit is contained in:
Kilian Cavalotti 2024-08-12 13:20:16 -07:00
parent a299d61cac
commit 787ea2191e

View File

@ -263,16 +263,53 @@ elif [ "$IPMIMFG" == 20301 -o "$IPMIMFG" == 19046 ] ; then
elif [ "$IPMIMFG" == "47488" ]; then
LOCKEDUSERS=1
elif [ "$IPMIMFG" == "674" ]; then # DELL
logger -s -t $log_label -p local4.info "Dell server detected"
BMCPORT=`grep bmcport /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
# BMCPORT can take 3 values:
# 1st value: 0 = shared / 1 = dedicated
# 2nd value shared LOM (1-4) (0 or no value means first available LOM)
# 3rd value: failover LOM (1-4) (0 means no failover, no value means all LOMs)
read -r bmc_mode shared_lom failover_lom <<< "$BMCPORT"
logger -s -t $log_label -p local4.info "BMCPORT is $BMCPORT"
if [ "$BMCPORT" == "0" ]; then # shared
logger -s -t $log_label -p local4.info "bmc_mode:$bmc_mode shared_lom:$shared_lom failover_lom:$failover_lom"
if [ "$bmc_mode" == "1" ]; then # dedicated
logger -s -t $log_label -p local4.info "Setting BMC to dedicated mode"
# https://github.com/ipmitool/ipmitool/issues/18
# ipmitool raw 0x30 0x28 0xAA 0xBB, with:
# AA: 01 = dedicated, 02...05 = shared with lom1...4
# BB: 00 = no failover, 02...05 = failover on lom1...4, , 06 = failover on all loms
ipmitool raw 0x30 0x28 0x02 0x06
elif [ "$BMCPORT" == "1" ]; then # dedicated
ipmitool raw 0x30 0x28 0x01 0x00
elif [ "$bmc_mode" == "0" ]; then # shared
logger -s -t $log_label -p local4.info "Setting BMC to shared mode"
case "$failover_lom" in
"" ) xFAIL=0x06 ;;
0 ) xFAIL=0x00 ;;
[1-4]) xFAIL=$(printf 0x%02x $((failover_lom+1))) ;;
*) logger -s -t $log_label -p local4.info "WARNING: can't set failover LOM to $failover_lom, defaulting to failover all LOMs"
xFAIL=0x06 ;;
esac
case "$shared_lom" in
""|0) xLOM=00 ;;
[1-4]) xLOM=$(printf 0x%02x $((shared_lom+1))) ;;
*) logger -s -t $log_label -p local4.info "WARNING: can't set shared LOM to $shared_lom, defaulting to first available LOMs"
xLOM=00 ;;
esac
case "$xLOM" in
"00") # try to find the first available LOM
_lom=1
while ! ipmitool raw 0x30 0x28 "$(printf 0x%02x $((_lom+1)))" "$xFAIL" 2>/dev/null; do
_lom=$((_lom+1))
snooze
if [ $_lom -gt 4 ]; then
logger -s -t $log_label -p local4.info "ERROR: setting BMC to share mode failed"
break;
fi
done
;;
*) ipmitool raw 0x30 0x28 "$xLOM" "$xFAIL" || \
logger -s -t $log_label -p local4.info "ERROR: error setting BMCPORT to requested parameters"
;;
esac
fi
elif [ "$IPMIMFG" == "10876" ]; then # Supermicro
BMCPORT=`grep bmcport /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`