From 32743771ffad8944d82793ee9215ad45400cb847 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 22 Jun 2016 12:34:26 -0400 Subject: [PATCH 1/6] Clean up some of the messages in doxcat - clean up some messages logged to syslog to help debugging - Only start rsyslog and dhclient if not already started --- xCAT-genesis-scripts/bin/doxcat | 91 +++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 37 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index d1c2964cf..ce51a6792 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -8,12 +8,17 @@ 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 -RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` -if [ $RSYSLOGD_VERSION -ge 8 ]; then - /sbin/rsyslogd - # Newer vers of rsyslogd (8 and higher) do not support -c flag anymore -else - /sbin/rsyslogd -c4 +if [ ! -f /var/run/syslogd.pid ]; then + # + # start rsyslog ONLY if not already started + # + RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` + if [ $RSYSLOGD_VERSION -ge 8 ]; then + /sbin/rsyslogd + # Newer vers of rsyslogd (8 and higher) do not support -c flag anymore + else + /sbin/rsyslogd -c4 + fi fi logger -t $log_label -p local4.info "Beginning doxcat process..." @@ -39,7 +44,7 @@ if [ ! -z "$BOOTIF" ]; then gripeiter=$((gripeiter-1)) done fi -echo "Done" + if [ -z "$bootnic" ]; then logger -s -t $log_label -p local4.err "BOOTIF missing, can't detect boot nic" fi @@ -82,22 +87,24 @@ 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..." -mkdir -p /var/lib/lldpad -echo 'lldp :' >> /var/lib/lldpad/lldpad.conf -echo '{' >> /var/lib/lldpad/lldpad.conf +LLDP_DIR="/var/lib/lldpad" + +logger -t $log_label -p local4.info "Creating ${LLDP_DIR} directory and config files..." +mkdir -p ${LLDP_DIR} +echo 'lldp :' >> ${LLDP_DIR}/lldpad.conf +echo '{' >> ${LLDP_DIR}/lldpad.conf for iface in `ip link |grep -v '^ '|awk '{print $2}'|sed -e 's/:$//'|grep -v lo`; do -echo "$iface :" >> /var/lib/lldpad/lldpad.conf -echo "{" >> /var/lib/lldpad/lldpad.conf - echo "tlvid00000006 :" >> /var/lib/lldpad/lldpad.conf - echo "{" >> /var/lib/lldpad/lldpad.conf - echo info = '"'$PUBKEY'";' >> /var/lib/lldpad/lldpad.conf - echo 'enableTx = true;' >> /var/lib/lldpad/lldpad.conf - echo '};' >> /var/lib/lldpad/lldpad.conf - echo 'adminStatus = 3;' >> /var/lib/lldpad/lldpad.conf -echo '};' >> /var/lib/lldpad/lldpad.conf + echo "$iface :" >> ${LLDP_DIR}/lldpad.conf + echo "{" >> ${LLDP_DIR}/lldpad.conf + echo "tlvid00000006 :" >> ${LLDP_DIR}/lldpad.conf + echo "{" >> ${LLDP_DIR}/lldpad.conf + echo info = '"'$PUBKEY'";' >> ${LLDP_DIR}/lldpad.conf + echo 'enableTx = true;' >> ${LLDP_DIR}/lldpad.conf + echo '};' >> ${LLDP_DIR}/lldpad.conf + echo 'adminStatus = 3;' >> ${LLDP_DIR}/lldpad.conf + echo '};' >> ${LLDP_DIR}/lldpad.conf done -echo '};' >> /var/lib/lldpad/lldpad.conf +echo '};' >> ${LLDP_DIR}/lldpad.conf lldpad -d logger -t $log_label -p local4.info "lldpad started." @@ -184,8 +191,12 @@ else while [ $tries -lt 100 ]; do ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo | sort -n -r` for tmp1 in $ALLUP_NICS; do - dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 & - dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases & + if [ ! -f /var/run/dhclient.$tmp1.pid ]; then + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 & + fi + if [ ! -f /var/run/dhclient6.$tmp1.pid $tmp1 ]; then + dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases & + fi #bootnic=$tmp1 #break done @@ -274,7 +285,7 @@ if [ -e "/dev/rtc" ]; then hwclock --systohc fi HOST_ARCH=`uname -m` -if echo $HOST_ARCH | grep "ppc64"; then +if [ `echo $HOST_ARCH | grep "bac" > /dev/null; echo $?` == 0 ]; then modprobe ipmi_powernv else modprobe ipmi_si @@ -290,20 +301,21 @@ fi DEVICE=$bootnic export DEVICE +logger -t $log_label -p local4.info "IPMI SUPPORT=${IPMI_SUPPORT}, DEVICE=$bootnic" + 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 -t $log_label -p local4.info "Run /bin/getcert to xCAT Master ($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 -t $log_label -p local4.info "Run getdestiny to xCAT Master ($XCATMASTER:$XCATPORT)..." destiny=`getdestiny $XCATMASTER:$XCATPORT` - logger -t $log_label -p local4.info "Getdestiny done." fi - + destparameter=`echo $destiny|cut -d '=' -f 2-` logger -t $log_label -p local4.info "The destparameter is $destparameter" @@ -311,15 +323,16 @@ while :; do 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 -t $log_label -p local4.info "The destiny is $dest" + + if [ "$dest" = "discover" ]; then #skip a query to xCAT when /proc/cmdline will do - logger -t $log_label -p local4.info "Run dodiscovery..." + logger -t $log_label -p local4.info "Run Discovery..." /bin/dodiscovery - logger -t $log_label -p local4.info "Dodiscovery done." - logger -t $log_label -p local4.info "Run getcert $XCATMASTER:$XCATPORT..." + logger -t $log_label -p local4.info "... Discovery complete." + logger -t $log_label -p local4.info "Run /bin/getcert to xCAT Master ($XCATMASTER:$XCATPORT)..." /bin/getcert $XCATMASTER:$XCATPORT - logger -t $log_label -p local4.info "Getcert done." destiny='' dest='' elif [ "$dest" = shell ]; then @@ -327,7 +340,7 @@ while :; do destiny='' dest='' /bin/bash - logger -t $log_label -p local4.info "Exit shell." + logger -t $log_label -p local4.info "Exiting shell." logger -t $log_label -p local4.info "Run nextdestiny $XCATMASTER:$XCATPORT..." /bin/nextdestiny $XCATMASTER:$XCATPORT logger -t $log_label -p local4.info "Nextdestiny done." @@ -386,7 +399,9 @@ 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 @@ -400,7 +415,9 @@ while :; do 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 in $delay seconds" + fi delay=$((delay-1)) sleep 1 done From 41b755a4139ba1449b30b518c4ce53a0d81fb5bb Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 22 Jun 2016 14:21:14 -0400 Subject: [PATCH 2/6] For getipmi script, change the rm to use the -f option so that we avoid a warning message that the file does not exists. Add a log label for logger messages --- xCAT-genesis-scripts/bin/getipmi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 From 3d2605c2f231e943098682748467973f6e922cb5 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Wed, 22 Jun 2016 15:50:25 -0400 Subject: [PATCH 3/6] Clean up some errors in bmcsetup script - update some log messages - do not run the mc reset cold for openPower systems - create the 'mc info' output in a file in /tmp to reduce the number of ipmitool calls - 300 is too large for chassis identify, change to 275 --- xCAT-genesis-scripts/bin/bmcsetup | 39 ++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/xCAT-genesis-scripts/bin/bmcsetup b/xCAT-genesis-scripts/bin/bmcsetup index ddef2655a..e99fe4b19 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 @@ -474,7 +479,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 @@ -517,6 +522,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 @@ -565,8 +572,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 : From 9232e7eac13e12e87bf40b021d58b83ff0b3519a Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Thu, 23 Jun 2016 07:45:54 -0400 Subject: [PATCH 4/6] Fix a typo in the doxcat script to grep ppc64 --- xCAT-genesis-scripts/bin/doxcat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index ce51a6792..17d293dc2 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -285,7 +285,7 @@ if [ -e "/dev/rtc" ]; then hwclock --systohc fi HOST_ARCH=`uname -m` -if [ `echo $HOST_ARCH | grep "bac" > /dev/null; echo $?` == 0 ]; then +if [ `echo $HOST_ARCH | grep "ppc64" > /dev/null; echo $?` == 0 ]; then modprobe ipmi_powernv else modprobe ipmi_si From 1f121f11d93ed78fa1e728fd53320a8b20997479 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 24 Jun 2016 16:00:31 -0400 Subject: [PATCH 5/6] Change the logger commands to print to stderr so that the SOL console will record the messages --- xCAT-genesis-scripts/bin/dodiscovery | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 3d5e3c522..76510c8d0 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -112,7 +112,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 "$ARCH" >> /tmp/discopacket @@ -247,20 +247,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 From ce00394dff95e296b59ceff7cc3bd4b30e6826c4 Mon Sep 17 00:00:00 2001 From: Victor Hu Date: Fri, 24 Jun 2016 16:01:32 -0400 Subject: [PATCH 6/6] - Undo some changes in doxcat that was causing problems. - clean up some of the logging messages --- xCAT-genesis-scripts/bin/doxcat | 134 +++++++++++++++----------------- 1 file changed, 63 insertions(+), 71 deletions(-) diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 17d293dc2..f8fc3ac22 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -8,20 +8,23 @@ 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 -if [ ! -f /var/run/syslogd.pid ]; then - # - # start rsyslog ONLY if not already started - # - RSYSLOGD_VERSION=`rsyslogd -v | grep "rsyslogd" | cut -d" " -f2 | cut -d"." -f1` - if [ $RSYSLOGD_VERSION -ge 8 ]; then - /sbin/rsyslogd - # Newer vers of rsyslogd (8 and higher) do not support -c flag anymore - else - /sbin/rsyslogd -c4 - fi +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 +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 @@ -44,7 +47,7 @@ if [ ! -z "$BOOTIF" ]; then gripeiter=$((gripeiter-1)) done fi - +echo "Done" if [ -z "$bootnic" ]; then logger -s -t $log_label -p local4.err "BOOTIF missing, can't detect boot nic" fi @@ -87,26 +90,24 @@ PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBL PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` export PUBKEY -LLDP_DIR="/var/lib/lldpad" - -logger -t $log_label -p local4.info "Creating ${LLDP_DIR} directory and config files..." -mkdir -p ${LLDP_DIR} -echo 'lldp :' >> ${LLDP_DIR}/lldpad.conf -echo '{' >> ${LLDP_DIR}/lldpad.conf +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 for iface in `ip link |grep -v '^ '|awk '{print $2}'|sed -e 's/:$//'|grep -v lo`; do - echo "$iface :" >> ${LLDP_DIR}/lldpad.conf - echo "{" >> ${LLDP_DIR}/lldpad.conf - echo "tlvid00000006 :" >> ${LLDP_DIR}/lldpad.conf - echo "{" >> ${LLDP_DIR}/lldpad.conf - echo info = '"'$PUBKEY'";' >> ${LLDP_DIR}/lldpad.conf - echo 'enableTx = true;' >> ${LLDP_DIR}/lldpad.conf - echo '};' >> ${LLDP_DIR}/lldpad.conf - echo 'adminStatus = 3;' >> ${LLDP_DIR}/lldpad.conf - echo '};' >> ${LLDP_DIR}/lldpad.conf +echo "$iface :" >> /var/lib/lldpad/lldpad.conf +echo "{" >> /var/lib/lldpad/lldpad.conf + echo "tlvid00000006 :" >> /var/lib/lldpad/lldpad.conf + echo "{" >> /var/lib/lldpad/lldpad.conf + echo info = '"'$PUBKEY'";' >> /var/lib/lldpad/lldpad.conf + echo 'enableTx = true;' >> /var/lib/lldpad/lldpad.conf + echo '};' >> /var/lib/lldpad/lldpad.conf + echo 'adminStatus = 3;' >> /var/lib/lldpad/lldpad.conf +echo '};' >> /var/lib/lldpad/lldpad.conf done -echo '};' >> ${LLDP_DIR}/lldpad.conf +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(){ @@ -166,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 @@ -191,12 +192,8 @@ else while [ $tries -lt 100 ]; do ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo | sort -n -r` for tmp1 in $ALLUP_NICS; do - if [ ! -f /var/run/dhclient.$tmp1.pid ]; then - dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 & - fi - if [ ! -f /var/run/dhclient6.$tmp1.pid $tmp1 ]; then - dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases & - fi + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$tmp1.pid $tmp1 & + dhclient -6 -pf /var/run/dhclient6.$tmp1.pid $tmp1 -lf /var/lib/dhclient/dhclient6.leases & #bootnic=$tmp1 #break done @@ -285,7 +282,7 @@ if [ -e "/dev/rtc" ]; then hwclock --systohc fi HOST_ARCH=`uname -m` -if [ `echo $HOST_ARCH | grep "ppc64" > /dev/null; echo $?` == 0 ]; then +if echo $HOST_ARCH | grep "ppc64"; then modprobe ipmi_powernv else modprobe ipmi_si @@ -301,37 +298,32 @@ fi DEVICE=$bootnic export DEVICE -logger -t $log_label -p local4.info "IPMI SUPPORT=${IPMI_SUPPORT}, DEVICE=$bootnic" - if [ "$destiny" != "discover" ]; then #we aren't discoverying, we probably can and should get a cert - logger -t $log_label -p local4.info "Run /bin/getcert to xCAT Master ($XCATMASTER:$XCATPORT)..." + logger -s -t $log_label -p local4.info "Getting initial certificate --> $XCATMASTER:$XCATPORT" /bin/getcert $XCATMASTER:$XCATPORT fi - while :; do grepconfigraid=`echo $destiny|grep "configraid"` if [ -z "$destiny" -o -n "$grepconfigraid" ]; then - logger -t $log_label -p local4.info "Run getdestiny to xCAT Master ($XCATMASTER:$XCATPORT)..." + logger -s -t $log_label -p local4.info "Running getdestiny --> $XCATMASTER:$XCATPORT" destiny=`getdestiny $XCATMASTER:$XCATPORT` + 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 destiny 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 Discovery..." + logger -s -t $log_label -p local4.info "Running dodiscovery..." /bin/dodiscovery - logger -t $log_label -p local4.info "... Discovery complete." - logger -t $log_label -p local4.info "Run /bin/getcert to xCAT Master ($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 destiny='' dest='' @@ -340,21 +332,21 @@ while :; do destiny='' dest='' /bin/bash - logger -t $log_label -p local4.info "Exiting 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 @@ -375,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 @@ -386,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 @@ -399,24 +391,24 @@ while :; do dest='' delay=$((30+$RANDOM%270)) while [ $delay -gt 0 ]; do - 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" + 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 - if [ $((delay%10)) == 0 ]; then - 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 @@ -425,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