diff --git a/xCAT-genesis-scripts/usr/bin/bmcsetup b/xCAT-genesis-scripts/usr/bin/bmcsetup index 3932d70d5..7344aaeeb 100755 --- a/xCAT-genesis-scripts/usr/bin/bmcsetup +++ b/xCAT-genesis-scripts/usr/bin/bmcsetup @@ -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}'`