diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index 247ffe80f..6aeb489d2 100755 --- a/xCAT-genesis-scripts/bin/bmcsetup +++ b/xCAT-genesis-scripts/bin/bmcsetup @@ -37,12 +37,13 @@ function cold_reset_bmc() { # 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. - sleep 30 + snooze + else + logger -s -t $log_label -p local4.info "Resetting BMC ..." + ipmitool mc reset cold + logger -s -t $log_label -p local4.info "Waiting for the BMC to appear ..." fi - logger -s -t $log_label -p local4.info "Resetting BMC ..." - ipmitool mc reset cold - logger -s -t $log_label -p local4.info "Waiting for the BMC to appear ..." 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 @@ -125,18 +126,22 @@ while [ -z "$BMCIP" -a $IPCFGMETHOD="static" ]; do done kill $CREDPID NUMBMCS=`grep bmcip /tmp/ipmicfg.xml |awk -F\> '{print $2}'|awk -F\< '{print $1}'|wc -l` -logger -s -t $log_label -p local4.debug "BMC IP=$BMCIP, NETMASK=$BMCNM, GATEWAY=$BMCGW, VLAN=$BMCVLAN, USER=$BMCUS, PASSWORD=$BMCPW" -logger -s -t $log_label -p local4.info "NUMBMCS=$NUMBMCS" +logger -s -t $log_label -p local4.debug "BMC Information obtained from xCAT" +logger -s -t $log_label -p local4.debug "NUMBMCS=$NUMBMCS ==> BMC IP=$BMCIP/$BMCNM, GW=$BMCGW, VLAN=$BMCVLAN, USER=$BMCUS, PASSWORD=$BMCPW" + # # Get the BMC Version and Manufacturer ID # -IPMIVER=`ipmitool mc info|grep ^IPMI|awk '{print $4}'` -IPMIMFG=`ipmitool mc info|grep "^Manufacturer ID"|awk '{print $4}'` -logger -s -t $log_label -p local4.info "IPMIVER=$IPMIVER, IPMIMFG=$IPMIMFG" +MC_INFO=/tmp/xcat.ipmitool.mcinfo + +ipmitool mc info > ${MC_INFO} +IPMIVER=`cat ${MC_INFO} |grep ^IPMI|awk '{print $4}'` +IPMIMFG=`cat ${MC_INFO} |grep "^Manufacturer ID"|awk '{print $4}'` # Get the BMC Product ID -XPROD=`ipmitool mc info|grep "^Product ID"|awk '{print $4}'` -logger -s -t $log_label -p local4.info "XPROD=$XPROD" +XPROD=`cat ${MC_INFO} |grep "^Product ID"|awk '{print $4}'` + +logger -s -t $log_label -p local4.info "IPMIVER=$IPMIVER, IPMIMFG=$IPMIMFG, XPROD=$XPROD" # # IPMIMFG=2 = IBM @@ -484,7 +489,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 - MSG="Enabling IPMI v 1.5 MD5 LAN access" + MSG="Enabling IPMI MD5 LAN access" logger -s -t $log_label -p local4.info "$MSG" TRIES=0 # Set the auth level to md5 for the channel @@ -527,6 +532,8 @@ while [ $idev -gt 0 ]; do i=$((i+1)) done + logger -s -t $log_label -p local4.info "ACCESS=$NEWACCESS" + MSG="Set the cipher_privileges for the channel" logger -s -t $log_label -p local4.info "$MSG" # Set the cipher_privileges for the channel @@ -575,8 +582,12 @@ while [ $idev -gt 0 ]; do logger -s -t $log_label -p local4.info "Lighting Identify Light" if [ "$XPROD" = "43707" ]; then - # OpenPower BMC specific, turn on the LED beacon for 5 minutes - ipmitool chassis identify 300 + # 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 + # Given interval is too big. + ipmitool chassis identify 250 else # All other BMCs while : diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 5148e1dab..f1af844ff 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -114,7 +114,7 @@ DISKSIZE=`cat /proc/partitions |grep -e "sd.\>" |awk -F' ' '{printf "%s:%.0fGB\n #done #CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` -logger -t $log_label -p local4.info "Beginning echo infomation to discovery packet file..." +logger -s -t $log_label -p local4.info "Beginning echo infomation to discovery packet file..." echo '' > /tmp/discopacket echo "findme" >> /tmp/discopacket echo "1" >> /tmp/discopacket @@ -258,20 +258,20 @@ cat /tmp/discopacket |while read line; do echo $line >> /tmp/discopacket.new done mv /tmp/discopacket.new /tmp/discopacket -logger -t $log_label -p local4.info "Discovery packet file is ready." +logger -s -t $log_label -p local4.info "Discovery packet file is ready." rm -f /tmp/discopacket.gz gzip -9 /tmp/discopacket if [ ! -z "$XCATMASTER" ]; then - logger -t $log_label -p local4.info "Sending the discovery packet to xCAT ($XCATMASTER:$XCATPORT)..." + logger -s -t $log_label -p local4.info "Sending the discovery packet to xCAT ($XCATMASTER:$XCATPORT)..." (cat /tmp/discopacket.gz | udpcat.awk $XCATMASTER $XCATPORT ) & fi for dhcps in `grep dhcp-server /var/lib/dhclient/dhclient.leases|awk '{print $4}'|sed -s 's/;//'`; do - logger -t $log_label -p local4.info "Sending the discovery packet to xCAT ($dhcps:$XCATPORT)..." + logger -s -t $log_label -p local4.info "Sending the discovery packet to xCAT ($dhcps:$XCATPORT)..." (cat /tmp/discopacket.gz | udpcat.awk $dhcps $XCATPORT ) & done #cat /tmp/discopacket - logger -t $log_label -p local4.info "Sleeping 5 seconds..." + logger -s -t $log_label -p local4.info "Sleeping 5 seconds..." sleep 5 done -logger -t $log_label -p local4.info "Restart..." +logger -s -t $log_label -p local4.info "Restart network interfaces..." /bin/restart diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index d1c2964cf..f8fc3ac22 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -8,7 +8,15 @@ log_label="xcat.genesis.doxcat" # Start rsyslogd and log into a local file specified in /etc/rsyslog.conf # Later, once xCAT MN is known, dhclient-script will change # rsyslog.conf file to send log entries to xCAT MN +logger -s -t $log_label -p local4.info "Starting syslog..." +ls /var/run/ RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` + +# if syslog is running and there's a pid file, kill it before restarting syslogd +if [ -f /var/run/syslogd.pid ]; then + kill -TERM `cat /var/run/syslogd.pid` +fi + if [ $RSYSLOGD_VERSION -ge 8 ]; then /sbin/rsyslogd # Newer vers of rsyslogd (8 and higher) do not support -c flag anymore @@ -16,7 +24,7 @@ else /sbin/rsyslogd -c4 fi -logger -t $log_label -p local4.info "Beginning doxcat process..." +logger -s -t $log_label -p local4.info "Beginning doxcat process..." modprobe acpi_cpufreq 2>/dev/null # on some machines this fails modprobe cpufreq_ondemand @@ -82,7 +90,7 @@ PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBL PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` export PUBKEY -logger -t $log_label -p local4.info "Creating /var/lib/lldpad file..." +logger -s -t $log_label -p local4.info "Creating /var/lib/lldpad file..." mkdir -p /var/lib/lldpad echo 'lldp :' >> /var/lib/lldpad/lldpad.conf echo '{' >> /var/lib/lldpad/lldpad.conf @@ -99,7 +107,7 @@ echo '};' >> /var/lib/lldpad/lldpad.conf done echo '};' >> /var/lib/lldpad/lldpad.conf lldpad -d -logger -t $log_label -p local4.info "lldpad started." +logger -s -t $log_label -p local4.info "lldpad started." # Caclulate the broadcast address of a given IP address and mask. bcastcalc(){ @@ -159,7 +167,7 @@ done export XCATPORT export XCATMASTER -logger -t $log_label -p local4.info "XCATMASTER is $XCATMASTER, XCATPORT is $XCATPORT" +logger -s -t $log_label -p local4.info "XCATMASTER is $XCATMASTER, XCATPORT is $XCATPORT" if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then # doing static ip @@ -291,35 +299,32 @@ DEVICE=$bootnic export DEVICE if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert - logger -t $log_label -p local4.info "Run getcert $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Getting initial certificate --> $XCATMASTER:$XCATPORT" /bin/getcert $XCATMASTER:$XCATPORT - logger -t $log_label -p local4.info "Getcert done." fi while :; do grepconfigraid=`echo $destiny|grep "configraid"` if [ -z "$destiny" -o -n "$grepconfigraid" ]; then - logger -t $log_label -p local4.info "Run getdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Running getdestiny --> $XCATMASTER:$XCATPORT" destiny=`getdestiny $XCATMASTER:$XCATPORT` - logger -t $log_label -p local4.info "Getdestiny done." + logger -s -t $log_label -p local4.info "Received destiny=$destiny" fi - + + # parse out some values from the destiny destparameter=`echo $destiny|cut -d '=' -f 2-` - logger -t $log_label -p local4.info "The destparameter is $destparameter" - destiny=`echo $destiny|awk -F= '{print $1}'` - logger -t $log_label -p local4.info "The destiny is $destiny" - dest=`echo $destiny|awk '{print $1}'` #could probably use bash but oh well - logger -t $log_label -p local4.info "The dest is $dest" + + logger -s -t $log_label -p local4.info "The destiny=$dest, destiny parameters=$destparameter" if [ "$dest" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do - logger -t $log_label -p local4.info "Run dodiscovery..." + logger -s -t $log_label -p local4.info "Running dodiscovery..." /bin/dodiscovery - logger -t $log_label -p local4.info "Dodiscovery done." - logger -t $log_label -p local4.info "Run getcert $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "dodiscovery - Complete." + + logger -s -t $log_label -p local4.info "Getting certificate --> $XCATMASTER:$XCATPORT" /bin/getcert $XCATMASTER:$XCATPORT - logger -t $log_label -p local4.info "Getcert done." destiny='' dest='' elif [ "$dest" = shell ]; then @@ -327,21 +332,21 @@ while :; do destiny='' dest='' /bin/bash - logger -t $log_label -p local4.info "Exit shell." - logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Exited shell." + logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." /bin/nextdestiny $XCATMASTER:$XCATPORT - logger -t $log_label -p local4.info "Nextdestiny done." + logger -s -t $log_label -p local4.info "nextdestiny - Complete." elif [ "$dest" = runcmd ]; then - logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` dest=`echo $destiny|awk -F= '{print $1}'` $destparameter - logger -t $log_label -p local4.info "Nextdestiny done." + logger -s -t $log_label -p local4.info "nextdestiny - Complete." elif [ "$dest" = runimage ]; then - logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." destiny=`/bin/nextdestiny $XCATMASTER:$XCATPORT` dest=`echo $destiny|awk -F= '{print $1}'` - logger -t $log_label -p local4.info "Nextdestiny done." + logger -s -t $log_label -p local4.info "nextdestiny - Complete." mkdir /tmp/`basename $destparameter` cd /tmp/`basename $destparameter` eval destparameter=$destparameter @@ -362,9 +367,9 @@ while :; do ./runme.sh cd - elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then - logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..." + logger -s -t $log_label -p local4.info "Running nextdestiny $XCATMASTER:$XCATPORT..." /bin/nextdestiny $XCATMASTER:$XCATPORT - logger -t $log_label -p local4.info "Nextdestiny done." + logger -s -t $log_label -p local4.info "nextdestiny - Complete." if [ $IPMI_SUPPORT -ne 0 ]; then ipmitool chassis bootdev pxe fi @@ -373,12 +378,12 @@ while :; do if [ $IPMI_SUPPORT -ne 0 ]; then ipmitool chassis bootdev pxe fi - logger -t $log_label -p local4.info "Reboot..." + logger -s -t $log_label -p local4.info "Reboot..." reboot -f elif [ "$dest" = sysclone ]; then - logger -t $log_label -p local4.info "Run dosysclone..." + logger -s -t $log_label -p local4.info "Running dosysclone..." /bin/dosysclone - logger -t $log_label -p local4.info "Dosysclone done." + logger -s -t $log_label -p local4.info "dosysclone - Complete." destiny='' dest='' elif [ "$dest" = standby ]; then @@ -386,21 +391,25 @@ while :; do dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do - logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" + if [ $((delay%10)) == 0 ]; then + logger -s -t $log_label -p local4.info "Received request to retry in a bit, will call xCAT back in $delay seconds" + fi delay=$((delay-1)) sleep 1 done echo "Retrying "; elif [ "$dest" = shutdown ]; then - logger -t $log_label -p local4.info "Poweroff..." + logger -s -t $log_label -p local4.info "Poweroff..." poweroff -f else - logger -s -t $log_label -p local4.err "Unrecognized directive $dest" + logger -s -t $log_label -p local4.err "Unrecognized directive (dest=$dest)" destiny='' dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do - logger -s -t $log_label -p local4.info "Will retry in $delay seconds" + if [ $((delay%10)) == 0 ]; then + logger -s -t $log_label -p local4.info "... Will retry xCAT in $delay seconds" + fi delay=$((delay-1)) sleep 1 done @@ -408,5 +417,5 @@ while :; do fi done -logger -t $log_label -p local4.info "doxcat is done" +logger -s -t $log_label -p local4.info "doxcat is complete" set +x diff --git a/xCAT-genesis-scripts/bin/getipmi b/xCAT-genesis-scripts/bin/getipmi index 5e9af2590..f129cb382 100755 --- a/xCAT-genesis-scripts/bin/getipmi +++ b/xCAT-genesis-scripts/bin/getipmi @@ -1,4 +1,6 @@ #!/bin/bash +log_label="xcat.genesis.getipmi" + allowcred.awk & CREDPID=$! if [ -z "$XCATDEST" ]; then @@ -24,7 +26,7 @@ echo " 300 $BMCMAC " > /tmp/bmcreq.xml -rm /tmp/ipmicfg.xml +rm -f /tmp/ipmicfg.xml while [ ! -f /tmp/ipmicfg.xml ] || grep error /tmp/ipmicfg.xml; do if [ -f /tmp/ipmicfg.xml ]; then timer=60