diff --git a/xCAT-genesis-builder/xcat-cmdline.sh b/xCAT-genesis-builder/xcat-cmdline.sh index 1188095f5..00aa2556e 100755 --- a/xCAT-genesis-builder/xcat-cmdline.sh +++ b/xCAT-genesis-builder/xcat-cmdline.sh @@ -38,4 +38,23 @@ if grep console=ttyS /proc/cmdline > /dev/null; then while :; do sleep 1; screen -x console < /dev/tty1 > /dev/tty1 2>&1; clear; done & fi while :; do screen -ln < /dev/tty2 > /dev/tty2 2>&1; done & + +# The section below is just for System P LE hardware discovery + +# Need to wait for NIC initialization +sleep 20 +ARCH=`uname -m` +if [ $ARCH == 'ppc64' ]; then + + ALL_NICS=`ip link show | grep -v "^ " | awk '{print $2}' | sed -e 's/:$//' | grep -v lo` + for tmp in $ALL_NICS; do + tmp_data=`ip link show $tmp | grep -v "^ " | grep "UP"` + if [ "$tmp_data" == "" ]; then + ip link set $tmp up + fi + tmp_data="UP" + sleep 1 + done +fi + while :; do screen -L -ln doxcat; done diff --git a/xCAT-genesis-scripts/bin/dodiscovery b/xCAT-genesis-scripts/bin/dodiscovery index e4c8dd6c0..426b5bb4f 100755 --- a/xCAT-genesis-scripts/bin/dodiscovery +++ b/xCAT-genesis-scripts/bin/dodiscovery @@ -71,10 +71,26 @@ if [ -r /sys/devices/virtual/dmi/id/product_name ]; then #x86 MTM=`cat /sys/devices/virtual/dmi/id/product_name|awk -F'[' '{print $2}'|awk -F']' '{print $1}'` SERIAL=`cat /sys/devices/virtual/dmi/id/product_serial` fi + CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` + grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing + echo $line > /tmp/cpumod + done + CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` + UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` + elif [ -r /proc/device-tree/model ]; then #POWER - MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'` + #MTM=`cat /proc/device-tree/model |awk -F, '{print $2}'` + MTM=`cat /proc/device-tree/model | sed -e 's/\^.*,//'` + CPUCOUNT=`cat /proc/cpuinfo |grep -e "^cpu\s*:"|wc -l` + grep -e "^cpu\s*:" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing + echo $line > /tmp/cpumod + done + CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` + SERIAL=`cat /proc/device-tree/system-id` + UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /proc/sys/kernel/random/uuid` + fi -CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` +#CPUCOUNT=`cat /proc/cpuinfo |grep "model name"|wc -l` # The MEMORY will look like this: 32868920 MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'` @@ -86,11 +102,11 @@ MEMORY=`cat /proc/meminfo |grep MemTotal|awk '{printf "%.0fMB\n", $2/1024}'` # The DISKSIZE will look like this: sdb:250GB,sda:250GB DISKSIZE=`cat /proc/partitions |grep -e "sd.\>" |awk -F' ' '{printf "%s:%.0fGB\n", $4, $3*0.000001024}' |sed 'N;s/\n/,/'` -UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` -grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing - echo $line > /tmp/cpumod -done -CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` +#UUID=`sed -e 's/\(..\)\(..\)\(..\)\(..\)-\(..\)\(..\)-\(..\)\(..\)/\4\3\2\1-\6\5-\8\7/' /sys/devices/virtual/dmi/id/product_uuid` +#grep "model name" /proc/cpuinfo | while read line; do #to avoid pulling in tail, we do a goofy thing +# echo $line > /tmp/cpumod +#done +#CPUTYPE=`cat /tmp/cpumod|awk -F':' '{print $2}'|sed -e 's/^ //'` echo '' > /tmp/discopacket echo "findme" >> /tmp/discopacket echo "$ARCH" >> /tmp/discopacket @@ -101,7 +117,10 @@ echo "$CPUCOUNT" >> /tmp/discopacket echo "$CPUTYPE" >> /tmp/discopacket echo "$MEMORY" >> /tmp/discopacket echo "$DISKSIZE" >> /tmp/discopacket -echo "$UUID" >> /tmp/discopacket +if [ "$UUID" != "unknown" ]; then + echo "$UUID" >> /tmp/discopacket +fi + if [ "$MTM" != "unknown" ]; then echo "$MTM" >> /tmp/discopacket fi diff --git a/xCAT-genesis-scripts/bin/doxcat b/xCAT-genesis-scripts/bin/doxcat index 3048dee6f..2820e48be 100755 --- a/xCAT-genesis-scripts/bin/doxcat +++ b/xCAT-genesis-scripts/bin/doxcat @@ -145,6 +145,15 @@ if [[ -n $hostip && -n $netmask && -n $gateway && -n $bootnic ]]; then sleep 3 else echo "Setting IP via DHCP..." +# This section is for System P hardware discovery, which won't have a BOOTIF value set + if [ -z "$bootnic" ]; then + ALLUP_NICS=`ip link show | grep -v "^ " | grep "state UP" | awk '{print $2}' | sed -e 's/:$//'|grep -v lo` + for tmp1 in $ALLUP_NICS; do + bootnic=$tmp1 + break + done + fi + dhclient -cf /etc/dhclient.conf -pf /var/run/dhclient.$bootnic.pid $bootnic & #we'll kick of IPv6 and IPv4 on all nics, but not wait for them to come up unless doing discovery, to reduce #chances that we'll perform a partial discovery