mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-22 03:32:04 +00:00
Remove trailing spaces in file xCAT-genesis-scripts/usr/bin/bmcsetup
This commit is contained in:
parent
2766f8f5c6
commit
d53e54081c
@ -5,7 +5,7 @@
|
||||
# dx320
|
||||
# 0x2e 0x10 0x4d 0x4f 0x00 0xff
|
||||
#
|
||||
# dx340
|
||||
# dx340
|
||||
# 0x30 0x13 0xff 0x00 0x00 0x00
|
||||
#
|
||||
# dx360/x3450
|
||||
@ -26,8 +26,8 @@ TIMEOUT=15
|
||||
#
|
||||
# Otherwise the BMC will not respond to ping after running the ipmitool commands in this script
|
||||
# It is found that Dell PowerEdge M605 server have the same product ID '43707', but its 'Manufacturer ID' is '674'
|
||||
function cold_reset_bmc() {
|
||||
if [ -z $XPROD ]; then
|
||||
function cold_reset_bmc() {
|
||||
if [ -z $XPROD ]; then
|
||||
logger -s -t $log_label -p local4.crit "CRITICAL ERROR - XPROD must be set before calling ${FUNCNAME[0]}"
|
||||
rm -f /tmp/ipmicfg.xml
|
||||
exit 1
|
||||
@ -37,8 +37,8 @@ function cold_reset_bmc() {
|
||||
fi
|
||||
if [ "$XPROD" = "309" -o "$XPROD" = "43707" ] ; then
|
||||
if [ "$XPROD" = "43707" ]; then
|
||||
# OpenPOWER SPECIFIC, the OpenPOWER machines with AMI BMC should NOT need a
|
||||
# reset after applying ipmitool commands. However, it seems there is a problem with
|
||||
# OpenPOWER SPECIFIC, the OpenPOWER machines with AMI BMC should NOT need a
|
||||
# reset after applying ipmitool commands. However, it seems there is a problem with
|
||||
# the BMC where after 15 seconds, it stops responding. To work around, sleep 30
|
||||
# seconds before issuing the reset of the BMC.
|
||||
snooze
|
||||
@ -50,7 +50,7 @@ function cold_reset_bmc() {
|
||||
|
||||
if [ "$XPROD" = "43707" ]; then
|
||||
# OpenPOWER SPECIFIC, check the BMC with the following raw command to
|
||||
# make sure that the bmc is really in a "ready" state before continuing
|
||||
# make sure that the bmc is really in a "ready" state before continuing
|
||||
SLEEP_INTERVAL=3
|
||||
MAX_ITERATION=100
|
||||
tries=0
|
||||
@ -66,7 +66,7 @@ function cold_reset_bmc() {
|
||||
logger -s -t $log_label -p local4.error "ERROR, After waiting ${TOTAL_SEC} seconds, the BMC is not in a ready state."
|
||||
else
|
||||
# for Non OpenPOWER servers, just sleep for some set time.
|
||||
sleep 15
|
||||
sleep 15
|
||||
|
||||
TRIES=0
|
||||
# Get the LAN information
|
||||
@ -75,18 +75,18 @@ function cold_reset_bmc() {
|
||||
let TRIES=TRIES+1
|
||||
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#
|
||||
# Function snooze()
|
||||
#
|
||||
# The purpose of this is to work around the issue with OpenPOWER BMCs after
|
||||
# The purpose of this is to work around the issue with OpenPOWER BMCs after
|
||||
# making a change to network configuration, sleep 30 to be sure the changes apply.
|
||||
#
|
||||
function snooze() {
|
||||
if [ -z $XPROD ]; then
|
||||
function snooze() {
|
||||
if [ -z $XPROD ]; then
|
||||
logger -s -t $log_label -p local4.crit "CRITICAL ERROR - XPROD must be set before calling ${FUNCNAME[0]}"
|
||||
rm -f /tmp/ipmicfg.xml
|
||||
exit 1
|
||||
@ -95,16 +95,16 @@ function snooze() {
|
||||
return
|
||||
fi
|
||||
if [ "$XPROD" = "43707" ]; then
|
||||
# For OpenPOWER Machines
|
||||
# For OpenPOWER Machines
|
||||
logger -s -t $log_label -p local4.debug "OpenPOWER, snooze for 30 seconds..."
|
||||
sleep 30
|
||||
else
|
||||
sleep 1
|
||||
fi
|
||||
}
|
||||
}
|
||||
|
||||
if ! ipmitool -V 2>/dev/null| grep "version"; then
|
||||
echo "No ipmitool find, please install it first";
|
||||
echo "No ipmitool find, please install it first";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
@ -129,7 +129,7 @@ while [ -z "$BMCIP" -a $IPCFGMETHOD="static" ]; do
|
||||
done
|
||||
BMCIP=`grep bmcip /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
||||
BMCVLAN=`grep taggedvlan /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
||||
if [ -z "$BMCVLAN" ]; then
|
||||
if [ -z "$BMCVLAN" ]; then
|
||||
BMCVLAN=off;
|
||||
fi
|
||||
BMCGW=`grep gateway /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'`
|
||||
@ -166,7 +166,7 @@ logger -s -t $log_label -p local4.info "IPMIVER=$IPMIVER, IPMIMFG=$IPMIMFG, XPRO
|
||||
|
||||
#
|
||||
# IPMIMFG=2 = IBM
|
||||
# IPMIMFG=0 = OpenPOWER
|
||||
# IPMIMFG=0 = OpenPOWER
|
||||
# IPMIMFG=42817 and XPROD=16975 = OpenBMC
|
||||
#
|
||||
if [ "$IPMIMFG" == 2 ]; then #IBM
|
||||
@ -239,7 +239,7 @@ elif [ "$IPMIMFG" == 20301 -o "$IPMIMFG" == 19046 ] ; then
|
||||
# after this change, we need to watch and wait to see that it
|
||||
# actually takes effect. On port change, the service processor
|
||||
# does not migrate the network configuration over
|
||||
# so we might be halfway through setting up when the net config
|
||||
# so we might be halfway through setting up when the net config
|
||||
# reverts to dhcp then static, which setting a static ip for is
|
||||
# considered invalid
|
||||
CHECKBMCPORT=$(echo $p|awk '{print $1}')
|
||||
@ -274,14 +274,14 @@ if [ ! -z "$ISOPENBMC" ]; then
|
||||
# Overvide the default value for OpenBMC
|
||||
LAN_MED_TYPE="Other LAN"
|
||||
fi
|
||||
while [ -z "$LANCHAN" ]; do
|
||||
while [ -z "$LANCHAN" ]; do
|
||||
logger -s -t $log_label -p local4.info "Auto detecting LAN channel..."
|
||||
for TLANCHAN in {1..16}; do
|
||||
# Try to get the channel information; then get the MAC which is used for the channel
|
||||
if ipmitool channel info $TLANCHAN 2> /dev/null | grep "$LAN_MED_TYPE" > /dev/null 2>&1 && ipmitool raw 0xc 2 $TLANCHAN 5 0 0 > /dev/null 2>&1; then
|
||||
LANCHAN=$TLANCHAN
|
||||
break;
|
||||
fi;
|
||||
break;
|
||||
fi;
|
||||
echo -n "."
|
||||
done
|
||||
if [ -z "$LANCHAN" ]; then
|
||||
@ -290,13 +290,13 @@ while [ -z "$LANCHAN" ]; do
|
||||
fi
|
||||
done
|
||||
logger -s -t $log_label -p local4.info "Detected LAN channel $LANCHAN"
|
||||
|
||||
|
||||
let idev=NUMBMCS
|
||||
if [ $IPCFGMETHOD="static" ]; then
|
||||
while [ $idev -gt 0 ]; do
|
||||
let idev=idev-1
|
||||
TRIES=0
|
||||
# Set the channel to use STATIC IP address
|
||||
# Set the channel to use STATIC IP address
|
||||
while ! ipmitool -d $idev lan set $LANCHAN ipsrc static; do
|
||||
snooze
|
||||
let TRIES=TRIES+1
|
||||
@ -321,7 +321,7 @@ if [ $IPCFGMETHOD="static" ]; then
|
||||
let idev=0
|
||||
for m in $BMCNM; do
|
||||
TRIES=0
|
||||
# Set the NETMASK for the current channel
|
||||
# Set the NETMASK for the current channel
|
||||
while ! ipmitool -d $idev lan set $LANCHAN netmask $m; do
|
||||
snooze
|
||||
let TRIES=TRIES+1
|
||||
@ -336,7 +336,7 @@ if [ $IPCFGMETHOD="static" ]; then
|
||||
let idev=0
|
||||
for g in $BMCGW; do
|
||||
TRIES=0
|
||||
# Set the GATEWAY for the current channel
|
||||
# Set the GATEWAY for the current channel
|
||||
while ! ipmitool -d $idev lan set $LANCHAN defgw ipaddr $g; do
|
||||
snooze
|
||||
let TRIES=TRIES+1
|
||||
@ -350,7 +350,7 @@ if [ $IPCFGMETHOD="static" ]; then
|
||||
else
|
||||
if [ -z "$ISOPENBMC" ];then
|
||||
let idev=NUMBMCS
|
||||
else
|
||||
else
|
||||
let idev=0
|
||||
fi
|
||||
while [ $idev -gt 0 ]; do
|
||||
@ -360,7 +360,7 @@ else
|
||||
while ! ipmitool -d $idev lan set $LANCHAN ipsrc $IPCFGMETHOD; do
|
||||
snooze
|
||||
let TRIES=TRIES+1
|
||||
if [ $TRIES -gt $TIMEOUT ]; then
|
||||
if [ $TRIES -gt $TIMEOUT ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
@ -380,11 +380,11 @@ else
|
||||
let idev=0
|
||||
for b in $BMCVLAN; do
|
||||
TRIES=0
|
||||
# Set VLAN for the current channel
|
||||
# Set VLAN for the current channel
|
||||
while ! ipmitool -d $idev lan set $LANCHAN vlan id $b; do
|
||||
snooze
|
||||
let TRIES=TRIES+1
|
||||
if [ $TRIES -gt $TIMEOUT ]; then
|
||||
if [ $TRIES -gt $TIMEOUT ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
@ -396,30 +396,30 @@ fi
|
||||
# update the node status to 'bmcready' for openbmc, no more configuration is needed.
|
||||
if [ ! -z "$ISOPENBMC" ]; then
|
||||
# To enable network configuration for openbmc
|
||||
#
|
||||
#
|
||||
# For OpenBMC, FW team still suggest running the raw command instead of access on, use raw for now
|
||||
#
|
||||
# ipmitool -d 0 lan set $LANCHAN access on
|
||||
ipmitool -d 0 raw 0x06 0x40 $LANCHAN 0x42 0x44
|
||||
# update the node status to 'bmcready'
|
||||
if [ ! -z "$XCATMASTER" ]; then
|
||||
# Wait for some time for the new network setting is ready
|
||||
# Wait for some time for the new network setting is ready
|
||||
snooze
|
||||
if ipmitool lan print 1 | grep $BMCIP >/dev/null; then
|
||||
updateflag.awk $XCATMASTER 3002 "installstatus bmcready"
|
||||
else
|
||||
updateflag.awk $XCATMASTER 3002 "installstatus failed"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
rm -f /tmp/ipmicfg.xml
|
||||
exit $bmc_config_rc
|
||||
fi
|
||||
# After network commands are issued, pause to allow the BMC to apply (OpenPOWER)
|
||||
snooze
|
||||
snooze
|
||||
|
||||
let idev=NUMBMCS-1
|
||||
for user in $BMCUS; do
|
||||
if [ "$user" = "" ]; then
|
||||
if [ "$user" = "" ]; then
|
||||
continue
|
||||
fi
|
||||
DISABLEUSERS=$(ipmitool user list $LANCHAN|awk '{print $1}'|grep -v ID)
|
||||
@ -445,7 +445,7 @@ for user in $BMCUS; do
|
||||
logger -s -t $log_label -p local4.info "CURRENTUSER=$CURRENTUSER, DISABLEUSERS=$DISABLEUSERS"
|
||||
for userid in $DISABLEUSERS; do
|
||||
TRIES=0
|
||||
# Disable the non-specified user
|
||||
# Disable the non-specified user
|
||||
while ! ipmitool -d $idev user disable $userid; do
|
||||
sleep 1
|
||||
let TRIES=TRIES+1
|
||||
@ -461,7 +461,7 @@ for user in $BMCUS; do
|
||||
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
||||
done
|
||||
ipmitool raw 6 0x43 $(($LANCHAN|176)) $USERSLOT 4
|
||||
|
||||
|
||||
|
||||
TRIES=0
|
||||
# Last param in ipmitool user priv is the channel to set it on.
|
||||
@ -471,7 +471,7 @@ for user in $BMCUS; do
|
||||
#
|
||||
CURRPRIV=`ipmitool -d $idev user list $LANCHAN|grep ^$USERSLOT|awk '{print $6}'`
|
||||
logger -s -t $log_label -p local4.info "CURRPRIV=$CURRPRIV"
|
||||
if [ "$CURRPRIV" != "ADMINISTRATOR" ]; then
|
||||
if [ "$CURRPRIV" != "ADMINISTRATOR" ]; then
|
||||
# Set the ADMIN privilege for the specified user
|
||||
while ! ipmitool -d $idev user priv $USERSLOT 4 $LANCHAN; do
|
||||
sleep 1
|
||||
@ -510,7 +510,7 @@ for bmcp in $BMCPW; do
|
||||
if [ "$bmcp" = "" ]; then continue; fi
|
||||
|
||||
TRIES=0
|
||||
# Set the password for the specified user
|
||||
# Set the password for the specified user
|
||||
while ! ipmitool -d $idev user set password $USERSLOT "$bmcp"; do
|
||||
sleep 1
|
||||
let TRIES=TRIES+1
|
||||
@ -519,7 +519,7 @@ for bmcp in $BMCPW; do
|
||||
|
||||
logger -s -t $log_label -p local4.info "Set up following user table: "
|
||||
TRIES=0
|
||||
# Display the user list
|
||||
# Display the user list
|
||||
ipmitool -d $idev user list $LANCHAN
|
||||
let idev=idev-1
|
||||
done
|
||||
@ -561,7 +561,7 @@ while [ $idev -gt 0 ]; do
|
||||
if [ $TRIES -gt $TIMEOUT ]; then break; fi
|
||||
done
|
||||
if [ $TRIES -gt $TIMEOUT ]; then logger -s -t $log_label -p local4.err "$MSG: ERROR"; else logger -s -t $log_label -p local4.info "$MSG: OK"; fi
|
||||
|
||||
|
||||
MSG="Enabling IPMI MD5 LAN access"
|
||||
logger -s -t $log_label -p local4.info "$MSG"
|
||||
TRIES=0
|
||||
@ -573,7 +573,7 @@ while [ $idev -gt 0 ]; do
|
||||
done
|
||||
if [ $TRIES -gt $TIMEOUT ]; then logger -s -t $log_label -p local4.err "$MSG: ERROR"; else logger -s -t $log_label -p local4.info "$MSG: OK"; fi
|
||||
|
||||
if [ ! "$IPMIVER" == "1.5" ]; then
|
||||
if [ ! "$IPMIVER" == "1.5" ]; then
|
||||
MSG="Enabling IPMI v 2.0 LAN access"
|
||||
logger -s -t $log_label -p local4.info "$MSG"
|
||||
# the following goals:
|
||||
@ -619,7 +619,7 @@ while [ $idev -gt 0 ]; do
|
||||
MSG="Enabling SOL for channel $LANCHAN"
|
||||
logger -s -t $log_label -p local4.info "$MSG"
|
||||
TRIES=0
|
||||
# Enable the SOL for the channel
|
||||
# Enable the SOL for the channel
|
||||
while ! ipmitool -d $idev raw 0xc 0x21 $LANCHAN 0x1 0x1 > /dev/null; do
|
||||
sleep 1
|
||||
let TRIES=TRIES+1
|
||||
@ -657,10 +657,10 @@ while [ $idev -gt 0 ]; do
|
||||
ISOPENPOWER=1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
if [ "$ISOPENPOWER" = '1' ]; then
|
||||
# OpenPOWER BMC specific, turn on the LED beacon light.
|
||||
# OpenPOWER BMC specific, turn on the LED beacon light.
|
||||
# - default interval, # ipmitool chassis identify
|
||||
# Chassis identify interval: default (15 seconds)
|
||||
# - 275 is too large, # ipmitool chassis identify 275
|
||||
|
Loading…
x
Reference in New Issue
Block a user