From 053225fb26667ec7c917a541a0183d42f27eb35c Mon Sep 17 00:00:00 2001 From: zhaoertao Date: Wed, 15 Oct 2014 00:21:48 -0700 Subject: [PATCH] fix bug 4296 :p8le hw discovery error info about syslog and dmidecode --- xCAT-genesis-scripts/bin/dodiscovery | 9 +++++---- xCAT-genesis-scripts/bin/doxcat | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index 3c3929dd8..d1241f82d 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -135,7 +135,8 @@ fi #so we have some cases where DMI table explictly records every function number, and some where only first function is enumerated #so for each onboard device, we record it. If it is also the first function, we'll seek out other function numbers and append #if that other function number does not show up in its own dmi type 41 record -for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do +if [ -f "/usr/sbin/dmidecode" ]; then + for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|grep -v Ethernet|sed -e 's/.*Address: //'`; do obdevs=("${obdevs[@]}" $onboard) if [ ${onboard#*.}=0 ]; then truncslot=${onboard%.*} @@ -145,8 +146,8 @@ for onboard in `dmidecode -t 41|egrep '(Type:|Bus Address)'|grep -A1 Ethernet|gr fi done fi -done - + done +fi #TODO: downed nics, also examine /sys/bus/pci/*/ for more network class devices that might not have driver suppert for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v usb0`; do FIRMDESC="" @@ -155,7 +156,7 @@ for dev in `ip link|grep -B1 ether|grep UP|awk '{print $2}'|sed -e s/://|grep -v PCI_SLOT=`grep PCI_SLOT_NAME /sys/class/net/$dev/device/uevent|awk -F= '{print $2}'` ADDRESS=`ip address show dev $dev|grep "inet "|grep global|awk '{print $2}'` MAC=`ip link show dev $dev|grep ether|awk '{print $2}'| tr /a-f/ /A-F/` - if [ ! -z "$PCI_SLOT" ]; then + if [[ ! -z "$PCI_SLOT" && -f "/usr/sbin/dmidecode" ]]; then SLOTNAME=`dmidecode -t 9|egrep '(Designation|Address)'|grep -B1 $PCI_SLOT|grep Designation|sed -e 's/.*Designation:[ ]*//'` if [ -z "$SLOTNAME" ]; then #check for on board device index=1 diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 7d6203531..b0e5bb7df 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -59,7 +59,7 @@ echo "Done" PUBKEY=`openssl rsa -in /etc/xcat/privkey.pem -pubout 2> /dev/null|grep -v "PUBLIC KEY"` PUBKEY=`echo $PUBKEY|sed -e 's/ //g'` export PUBKEY -/sbin/rsyslogd -c4 +/sbin/rsyslogd -4 mkdir -p /var/lib/lldpad echo 'lldp :' >> /var/lib/lldpad/lldpad.conf echo '{' >> /var/lib/lldpad/lldpad.conf @@ -199,6 +199,13 @@ ntpd -g -x # rv 0 state does not work with the new ntp versions #(while ! ntpq -c "rv 0 state"|grep 'state=4' > /dev/null; do sleep 1; done; hwclock --systohc) & (while [ "`ntpq -c \"rv 0 offset\" | grep \"offset=\" | awk -F \"=\" '{print $2}' | awk -F \".\" '{print $1}' | sed s/-//`" -ge 1000 ]; do sleep 1; done; hwclock --systohc) & +IPMI_ERROR=`ipmitool mc info` +IPMI_RC=$? +IPMI_SUPPORT=1 +if [ $IPMI_RC -ne 0 ]; then + IPMI_SUPPORT=0 +fi + if [ -f "/usr/sbin/dmidecode" ]; then if dmidecode|grep IPMI > /dev/null; then modprobe ipmi_si @@ -267,10 +274,14 @@ while :; do cd - elif [ "$dest" = "reboot" -o "$dest" = "boot" ]; then /bin/nextdestiny $XCATMASTER:$XCATPORT - ipmitool chassis bootdev pxe + if [ $IPMI_SUPPORT -ne 0 ]; then + ipmitool chassis bootdev pxe + fi reboot -f elif [ "$dest" = "install" -o "$dest" = "netboot" ]; then - ipmitool chassis bootdev pxe + if [ $IPMI_SUPPORT -ne 0 ]; then + ipmitool chassis bootdev pxe + fi reboot -f elif [ "$dest" = sysclone ]; then /bin/dosysclone