Commit f26d80bd authored by Dan Reading's avatar Dan Reading
Browse files

execpt for getting HD serial numbers test now run in a MFS-Admin image

parent e0b62283
......@@ -48,30 +48,52 @@ finish() {
exit 0
}
round1p() {
# round up 1 place
in=$1
y=$(echo "((($in * .005)) + $in)/1" | bc)
#truncate decimal
y=${in%%.*}
#count digits
n=${#y}
if [ $n == 5 ] ; then
echo -n $(echo "($y / 1000) * 1000" | bc)
# according to #digits add roundup and get most sig-bits
if [ $n == 6 ] ; then
y=$(($y + 5000))
y=$(($y / 10000))
y=$(($y * 10000))
echo -n $y
elif [ $n == 5 ] ; then
y=$(($y + 500))
y=$(($y / 1000))
y=$(($y * 1000))
echo -n $y
elif [ $n == 4 ] ; then
echo -n $(echo "($y / 100) * 100" | bc)
y=$(($y + 50))
y=$(($y / 100))
y=$(($y * 100))
echo -n $y
elif [ $n == 3 ] ; then
echo -n $(echo "($y / 10) * 10" | bc)
y=$(($y + 25))
y=$(($y / 10))
y=$(($y * 10))
echo -n $y
else
echo -n $y
return 1
fi
return 0
}
# check that external need program are installed
s=""
case $os in
Linux )
progs="grep bc echo lscpu"
progs="grep"
;;
FreeBSD )
progs="grep bc echo"
progs="grep"
;;
* )
failed="Unknown OS :$os: FAILED"
......@@ -91,40 +113,31 @@ fi
{
case $os in
Linux )
unset -v d ; declare -a d=()
d=($(lscpu))
for ((idx=0; idx<${#d[*]}; idx++)) ; do
[[ "${d[$idx]}" == "Architecture:" ]] && break
done
((++idx))
arch=${d[$idx]}
echo -n "Architecture:$arch "
for ((idx=0; idx<${#d[*]}; idx++)) ; do
z=${d[$idx]}; y=$(echo ${z,,}) #lower case letters
[[ "${y}" == "socket(s):" ]] && break
done
((++idx))
sockets=${d[$idx]}
[[ $sockets == 0 ]] && sockets=1
echo -n "Sockets:$sockets "
for ((idx=0; idx<${#d[*]}; idx++)) ; do
[[ "${d[$idx]}" == "socket:" ]] && break
done
((++idx))
cores_socket=${d[$idx]}
echo -n "Cores_socket:$cores_socket "
for ((idx=0; idx<${#d[*]}; idx++)) ; do
[[ "${d[$idx]}" == "core:" ]] && break
done
((++idx))
threads_core=${d[$idx]}
echo -n "Threads_core:$threads_core "
for ((idx=0; idx<${#d[*]}; idx++)) ; do
[[ "${d[$idx]}" == "MHz:" ]] && break
done
((++idx))
rawmhz=${d[$idx]}
Linux )
# XXX if have lscpu then us it to get arch
x=$(grep "model name" /proc/cpuinfo | head -1)
x=${x##*: }
#takeout all the spaces
x=${x// /}
[[ "${x:0:16}" == "Intel(R)Core(TM)" ]] && arch="x86_64" || arch=$x
[[ "${x:0:15}" == "Intel(R)Xeon(R)" ]] && arch="x86_64" || arch=$x
x=$(grep "cpu cores" /proc/cpuinfo | head -1)
x=${x##*: }
cores_socket=$x
x=$(grep "siblings" /proc/cpuinfo | head -1)
x=${x##*: }
threads_core=$(($x/$cores_socket))
x=$(grep "processor" /proc/cpuinfo | tail -1)
x=${x##*: }
((++x))
cpus=$x
sockets=$(($cpus/$threads_core))
sockets=$(($sockets/$cores_socket))
#better if dmesg not to old
dmesgmhz=$(dmesg | grep -i mhz | grep processor)
if [ -n "$dmesgmhz" ] ; then
......@@ -133,6 +146,11 @@ case $os in
rawmhz=$x
fi
mhz=$(round1p $rawmhz)
echo -n "Architecture:$arch "
echo -n "Sockets:$sockets "
echo -n "Cores_socket:$cores_socket "
echo -n "Threads_core:$threads_core "
echo -n "MHz:$mhz "
cpuflags=$(grep flags /proc/cpuinfo | head -1)
......@@ -143,7 +161,7 @@ case $os in
FreeBSD )
x=y=""
x=$(grep 'CPU:' /var/run/dmesg.boot | grep CPU:)
echo -n $x
x=${x#CPU: }
x=${x%%CPU*}
x=${x%%([0-9]*}
......@@ -174,6 +192,7 @@ case $os in
[[ $x ]] && threads_core=${x%%SMT*} || threads_core=1
x=$(grep 'CPU\|SMP' /var/run/dmesg.boot | grep CPU:)
# example CPU: Intel(R) Xeon(TM) CPU 3.00GHz (2992.71-MHz 686-class CPU)
x=${x%%-MHz*}
mhz=$(round1p ${x##*(})
......@@ -211,8 +230,9 @@ echo ""
# if saving data for testbed database
[[ ${x64bit} == 1 ]] && bits=64 || bits=32
if [ -f ${logfile4tb} ] ; then
printf "CPUINFO SOCKET=%s THREADS=%s SPEED=%s BITS=%s HV=%s\n"\
${sockets} ${threads_core} ${mhz} ${bits} ${hyperthread} >> ${logfile4tb}
printf "CPUINFO SOCKET=%s CORES=%s THREADS=%s SPEED=%s BITS=%s HV=%s\n"\
${sockets} ${cores_socket} ${threads_core} ${mhz} ${bits} ${hwvirt} >> ${logfile4tb}
exit 0
fi
tbinfo=$(getfromtb cpuinfo $host)
......
......@@ -25,7 +25,8 @@ hbis() {
base=""
# little input checking - remove punction and spaces
z=$(echo ${number} | tr -d [:punct:] | tr -d [:space:])
# z=$(echo ${number} | tr -d [:punct:] | tr -d [:space:])
z=$number
y=$(echo ${z,,}) #lower case letters
# what units is the number in
......
......@@ -14,12 +14,7 @@ source hbis.sh
declare failed="" s=""
os=`uname`
host=`hostname`
if [ -e "/var/emulab/boot/realname" ]; then
host=`cat /var/emulab/boot/realname`
fi
inithostname
## # setup logging
##if [ $1 ] ; then
......@@ -53,10 +48,15 @@ finish() {
exit 0
}
s=""
# check that external need program are installed
case $os in
Linux )
progs="cat grep bc"
if [ -f ${logfile4tb} ] ; then
progs="cat grep"
else
progs="cat grep bc"
fi
;;
FreeBSD )
progs="grep cat"
......@@ -82,6 +82,10 @@ case $os in
Linux )
unset -v d ; declare -a d=($(cat /proc/meminfo | grep MemTotal))
# Linux under reports, add 11MiB (in KiB units) for reserved mem
if [ -f ${logfile4tb} ] ; then
meminfo=${d[1]}
meminfo=$(($meminfo / 1000))
else
if (( ${d[1]} > $_32KGiB )) ; then
number=$(echo "scale=0; (${d[1]} * 1.015) / 1;" | bc)
elif (( ${d[1]} > $_1KGiB )) ; then
......@@ -97,6 +101,7 @@ case $os in
#echo "$0:${LINENO} ========== was:${d[1]} now number:$number sent:$mi "
meminfo=$(hbis $mi)
#echo "$0:${LINENO} ========== returned:$meminfo"
fi
;;
FreeBSD )
unset -v d ; declare -a d=($(grep memory /var/run/dmesg.boot | grep real))
......@@ -125,6 +130,7 @@ if [ "$base" == "GiB" ] ; then
fi
if [ -f ${logfile4tb} ] ; then
printf "MEMINFO SIZE=%s\n" ${num} >> ${logfile4tb}
exit 0
fi
tbinfo=$(getfromtb meminfo $host)
......
......@@ -24,6 +24,7 @@ initlogs
##cat /dev/null > ${tmplog}
tmplog2=/tmp/.2tmp
touch ${tmplog2}
finished() {
cat ${tmplog2}
......@@ -66,6 +67,16 @@ echo "${ifinfo[@]}"
} >> ${tmplog} 2>&1
ifcnt=${#ifinfo[*]}
# if saving data for testbed database
if [ -f ${logfile4tb} ] ; then
printf "NETINFO UNITS=%s\n" ${ifcnt} >> ${logfile4tb}
for ((ifi=0; ifi<$ifcnt; ifi++)) ; do
printf "NETUNIT TYPE=\""ETH\"" ID=\""%s\""\n" ${ifinfo[$ifi]} >> ${logfile4tb}
done
finished
fi
tbreturn=$(getfromtb macinfo $host)
if [ -z "$tbreturn" ] ; then
failed="TBmiss no info"
......@@ -79,19 +90,10 @@ tbreturn=${tbreturn,,}
#turn space seperated string into array
unset -v tbinfo; declare -a tbinfo=(${tbreturn// / })
ifcnt=${#ifinfo[*]}
tbcnt=${#tbinfo[*]}
numnics=$ifcnt
maxcnt=${ifcnt}
# if saving data for testbed database
if [ -f ${logfile4tb} ] ; then
printf "NETINFO UNITS=%s\n" ${ifcnt} >> ${logfile4tb}
for ((ifi=0; ifi<$ifcnt; ifi++)) ; do
printf "NETUNIT TYPE=\""ETH\"" ID=\""%s\""\n" ${ifinfo[$ifi]} >> ${logfile4tb}
done
fi
if [[ ${ifcnt} -ne ${tbcnt} ]] ; then
failed="TBmiss"
......
......@@ -33,7 +33,10 @@ BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#LINUX
#@checkscripts = ("disk", "cpu", "mem", "time", "nic", "diskspeed");
@checkscripts = ("disk", "cpu", "mem", "time", "nic");
# do not run timecheck for MFS hw gather mode
#@checkscripts = ("disk", "cpu", "mem", "time", "nic");
@checkscripts = ("disk", "cpu", "mem", "nic");
system("echo 'Running nodechecks'");
......
......@@ -32,7 +32,10 @@ elif
fi
#checks="disk cpu mem time nic diskspeed"
checks="disk cpu mem time nic"
# do not run timecheck for MFS hw gather mode
#checks="disk cpu mem time nic"
checks="disk cpu mem nic"
echo "Running nodechecks"
# truncate file at boot time
......
......@@ -24,10 +24,34 @@ fi
tmplog=/tmp/.$$.log
cat /dev/null > ${tmplog}
# check that external need program are installed
s=""
case $os in
Linux | FreeBSD )
progs="tr bc ntpserver"
;;
* )
failed="Unknown OS :$os: FAILED"
echo "$failed" >> ${logfile}
echo "$failed"
exit 1
;;
esac
for i in $progs ; do
type $i &>/dev/null && continue || s="$s $i "
done
if [ -n "$s" ] ; then
failed=" Unable to run need missing command(s) $s FAILED"
echo "$failed" >> ${logfile}
echo "$failed"
exit 1
fi
#exit on unbound var
set -u
{
set -x
unset -v d ; declare -a d=()
case $os in
Linux | FreeBSD )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment