Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
57d1b59a
Commit
57d1b59a
authored
Jun 04, 2013
by
Dan Reading
Browse files
remove old proff of concept directories
parent
90f6cac6
Changes
11
Hide whitespace changes
Inline
Side-by-side
clientside/tmcc/common/nodetest/usr/local/etc/emulab/diskspeedcheck
deleted
100755 → 0
View file @
90f6cac6
#!/bin/bash
# error out if referencing unset variable, better safe then sorry
set
-u
# stop if any error
#set -e
# GLOBAL DEFINEDs
# startdir
declare
startdir
=
$(
pwd
)
# need this much space free
declare
os host failed
declare
logfile tmplog tmplog2
# max time the dd will run
declare
-r
maxddtime
=
3
# need this much space free, how many K's can be written in maxddtime assuming 300Mb/sec
declare
-r
needsize
=
$((
100
*
1024
*
$maxddtime
))
# directory were speed test file will be written
declare
-r
tempwkdir
=
"/var/tmp"
# results
declare
wkps rkps
#helper functions
source
getfromtb.sh
source
checkutils.sh
source
hbis.sh
#FUNCDEBUG=y
main_diskspeedcheck
()
{
funcdebug
$FUNCNAME
:
$LINENO
enter:
$@
echo
-n
' Starting diskspeedcheck.. '
initalize
"
$@
"
doit_diskspeed
&&
checkwithdb
finished
}
# args: if of max_time
ddspeed
()
{
funcdebug
$FUNCNAME
:
$LINENO
enter:
$@
local
if
of
time
res
ifile
=
$1
ofile
=
$2
time
=
$3
res
=
/tmp/.
$$
ddresult
$(
cp
/dev/null
$res
)
$(
timesys
$time
$res
dd
if
=
$ifile
of
=
$ofile
bs
=
4k
)
[[
-s
$res
]]
||
exit
1
linewithbytes
=
$(
grep
bytes
$res
)
unset
-v
ary
;
declare
-a
ary
=(
${
linewithbytes
// /
}
)
#turn space seperated string into array
declare
-a
ary
=(
$(
grep
bytes
$res
)
)
numelm
=
${#
ary
[*]
}
# need to parse the dd output per OS
os
=
`
uname
-s
`
if
[
"
$os
"
==
"FreeBSD"
]
;
then
[[
${
numelm
}
-ne
8
]]
&&
printf
"PROGRAMMING ERROR
$FUNCNAME
:
$LINENO
numlen=
${
numelm
}
\n
"
&&
$(
rm
-f
$res
)
&&
return
0
# numelm=$(($numelm - 2))
#debug
#numelm=6
s
=
${
ary
[6]
}
# stip leading (
s
=
${
s
#(
}
speed
=
$(
hbis
$s
)
elif
[
"
$os
"
==
"Linux"
]
;
then
[[
${
numelm
}
-ne
9
]]
&&
printf
"PROGRAMMING ERROR
$FUNCNAME
:
$LINENO
numlen=
${
numelm
}
\n
"
# && $(rm -f $res) && return 0
s
=
"
${
ary
[8]
}
${
ary
[9]
}
"
#remove space
s
=
${
s
//
}
speed
=
$(
hbis
$s
)
else
echo
"I give up don't know this OS claming to be
$os
, I give up."
exit
1
fi
rm
-f
$res
echo
$speed
return
0
}
initalize
()
{
funcdebug
$FUNCNAME
:
$LINENO
enter:
$@
startdir
=
$(
pwd
)
os
=
`
uname
`
host
=
`
hostname
`
failed
=
""
if
[
-e
"/var/emulab/boot/realname"
]
;
then
host
=
`
cat
/var/emulab/boot/realname
`
fi
# setup logging
[[
$#
-gt
0
]]
&&
logfile
=
$1
||
logfile
=
"/tmp/nodecheck.log"
tmplog
=
/tmp/.
$$
.log
tmplog2
=
/tmp/.2tmp
cat
/dev/null
>
${
tmplog
}
touch
$logfile
}
finished
()
{
funcdebug
$FUNCNAME
:
$LINENO
enter:
$@
echo
"diskspeedcheck
`
date
`
"
>>
${
logfile
}
cat
${
tmplog
}
>>
${
logfile
}
if
[
-r
${
tmplog2
}
]
;
then
# cat ${tmplog2}
cat
${
tmplog2
}
>>
${
logfile
}
rm
-f
${
tmplog2
}
fi
[[
-z
${
failed
}
]]
&&
exit
1
||
exit
0
}
doit_diskspeed
()
{
funcdebug
$FUNCNAME
:
$LINENO
enter:
$@
cd
$tempwkdir
# hardcoded name to copies don't stack up
tempfile
=
${
tempwkdir
}
/dskspdchckwrt
$(
rm
-f
$tempfile
)
;
$(
sync
;
sync
)
declare
-a
df
=(
$(
df
-k
.
|
grep
/ |
tail
-1
)
)
havesize
=
${
df
[3]
}
if
[[
$havesize
-gt
$needsize
]]
;
then
# write speed time limited
wkps
=
$(
ddspeed
"/dev/zero"
"
$tempfile
"
$maxddtime
)
# read speed
rkps
=
$(
ddspeed
"
$tempfile
"
"/dev/null"
$maxddtime
)
$(
rm
$tempfile
)
else
failed
=
"not enough space need:
$needsize
have:
$havesize
"
echo
"
$failed
FAILED"
echo
"
$failed
"
>>
${
tmplog
}
fi
cd
${
startdir
}
return
0
}
checkwithdb
()
{
funcdebug
$FUNCNAME
:
$LINENO
enter:
$@
local
testsays
=
"Write_Speed
${
wkps
}
/sec Read_Speed
${
rkps
}
/sec"
local
tbreturn
local
err
=
''
echo
-n
${
testsays
}
echo
${
testsays
}
>>
$tmplog
tbreturn
=
$(
getfromtb diskspeedinfo
$host
)
if
[
-z
"
$tbreturn
"
]
;
then
failed
=
"TBmiss no info"
echo
"
$failed
FAILED"
$(
echo
"TBmiss empty info returned."
>>
${
tmplog2
}
)
return
1
elif
[
"
${
tbreturn
}
"
!=
"
${
tbreturn
/unknown_node/
}
"
]
;
then
failed
=
$tbreturn
echo
"
$failed
FAILED"
$(
echo
"
$failed
"
>>
${
tmplog2
}
)
return
1
fi
#lowercase
tbreturn
=
${
tbreturn
,,
}
#turn space seperated string into array
unset
-v
tbinfo
;
declare
-a
tbinfo
=(
${
tbreturn
// /
}
)
dskstring
=
"
$wkps
$rkps
"
dskstring
=
${
dskstring
,,
}
unset
-v
dskspdinfo
;
declare
-a
dskspdinfo
=(
${
dskstring
// /
}
)
# strip letters
x
=
${
tbinfo
[0]
}
;
x
=
${
x
%%[a-z]*
}
;
tbinfo[0]
=
$x
x
=
${
tbinfo
[1]
}
;
x
=
${
x
%%[a-z]*
}
;
tbinfo[1]
=
$x
x
=
${
dskspdinfo
[0]
}
;
x
=
${
x
%%[a-z]*
}
;
dskspdinfo[0]
=
$x
x
=
${
dskspdinfo
[1]
}
;
x
=
${
x
%%[a-z]*
}
;
dskspdinfo[1]
=
$x
halfwritespeed
=
$((${
tbinfo
[0]
}
/
2
))
halfreadspeed
=
$((${
tbinfo
[1]
}
/
2
))
doublewritespeed
=
$((${
tbinfo
[0]
}
*
2
))
doublereadspeed
=
$((${
tbinfo
[1]
}
*
2
))
if
((
${
dskspdinfo
[0]
}
<
$halfwritespeed
))
;
then
$(
echo
"write speed slow"
>>
${
tmplog2
}
)
err
=
"WriteSlow"
fi
if
((
${
dskspdinfo
[1]
}
<
$halfreadspeed
))
;
then
$(
echo
"read speed slow"
>>
${
tmplog2
}
)
err
=
"
$err
ReadSlow"
fi
if
((
${
dskspdinfo
[0]
}
>
$doublewritespeed
))
;
then
$(
echo
"write speed fast"
>>
${
tmplog2
}
)
err
=
"
$err
WriteFast"
fi
if
((
${
dskspdinfo
[1]
}
>
$doublereadspeed
))
;
then
$(
echo
"read speed fast"
>>
${
tmplog2
}
)
err
=
"
$err
ReadFast"
fi
[[
$err
]]
&&
echo
"
$err
FAILED"
||
echo
" OK"
}
# Hmmm when to run this
main_diskspeedcheck
"
$@
"
#doit_diskspeed
#echo wkps:$wkps rkps:$rkps
#exit 0
clientside/tmcc/common/nodetest/usr/local/etc/emulab/disktest.pl
deleted
100644 → 0
View file @
90f6cac6
#
# Run a 0.5GB dd every 5GBs on the disk
#
use
Getopt::
Std
;
my
$DISKSIZE
=
0
;
# in GB or 0 to just go to end
my
$INTERVAL
=
100
;
# in GB
my
$IOSIZE
=
128
;
# in MB
my
$BLOCKSIZE
=
128
;
# in KB
my
$COUNT
=
(
$IOSIZE
*
1024
)
/
$BLOCKSIZE
;
my
$BLKSPERGB
=
(
1024
*
1024
)
/
$BLOCKSIZE
;
my
$OS
=
`
uname
`;
chomp
(
$OS
);
#
# Process command-line arguments
#
my
$debug
=
0
;
my
$doit
=
1
;
my
$force
=
0
;
my
$quick
=
0
;
my
$indisk
;
my
$outdisk
;
my
%opt
=
();
getopts
("
d:i:o:nfq
",
\
%opt
);
if
(
$opt
{'
d
'})
{
$debug
=
$opt
{'
d
'};
}
if
(
$opt
{'
n
'})
{
$doit
=
0
;
}
if
(
$opt
{'
i
'})
{
$indisk
=
$opt
{'
i
'};
}
if
(
$opt
{'
o
'})
{
$outdisk
=
$opt
{'
o
'};
}
if
(
$opt
{'
f
'})
{
$force
=
1
;
}
if
(
$opt
{'
q
'})
{
$quick
=
1
;
}
if
(
!
$indisk
&&
!
$outdisk
)
{
die
("
Must specify one of -i or -o
");
}
if
(
$indisk
&&
$outdisk
)
{
die
("
Must specify EXACTLY one of -i or -o
");
}
if
(
$outdisk
&&
!
$force
)
{
print
"
Are you SURE you want to write to
$outdisk
?
";
my
$line
=
<
STDIN
>
;
chomp
$line
;
if
(
$line
=~
/^yes$/i
)
{
print
"
okay, its your disk...
\n
";
}
else
{
print
"
wise choice!
\n
";
exit
(
0
);
}
}
my
$gboffset
=
0
;
my
(
$inarg
,
$outarg
,
$sizearg
,
$countarg
,
$skiparg
,
$xtraarg
);
if
(
$indisk
)
{
$inarg
=
"
if=
$indisk
";
if
(
$OS
eq
"
Linux
")
{
$xtraarg
=
"
iflag=direct
";
}
else
{
$xtraarg
=
"";
}
$outarg
=
"
of=/dev/null
";
}
else
{
$inarg
=
"
if=/dev/zero
";
$outarg
=
"
of=
$outdisk
";
if
(
$OS
eq
"
Linux
")
{
$xtraarg
=
"
oflag=direct
";
}
else
{
$xtraarg
=
"";
}
}
# note: 'k' means 1024 for both BSD and Linux (gnu) dd
$sizearg
=
"
bs=
${BLOCKSIZE}
k
";
$countarg
=
"
count=
$COUNT
";
while
(
$DISKSIZE
==
0
||
$gboffset
<
$DISKSIZE
)
{
my
$off
=
$gboffset
*
$BLKSPERGB
;
my
$skiparg
=
$off
?
"
skip=
$off
"
:
"";
if
(
!
$quick
)
{
print
"
${gboffset}
GB:
";
}
if
(
$doit
)
{
print
STDERR
"
dd
$inarg
$outarg
$skiparg
$sizearg
$countarg
$xtraarg
\n
"
if
(
$debug
);
my
@output
=
`
dd
$inarg
$outarg
$skiparg
$sizearg
$countarg
$xtraarg
2>&1
`;
my
$mbps
;
foreach
my
$line
(
@output
)
{
chomp
(
$line
);
# BSD: 1073741824 bytes transferred in 62.940028 secs (17059761 bytes/sec)
if
(
$line
=~
/\((\d+)\s+bytes\/sec\)/
)
{
$mbps
=
$
1
/
(
1000
*
1000
);
print
STDERR
"
Parsed line: '
$line
'
\n
"
if
(
$debug
>
1
);
last
;
}
# Linux: 1342177280 bytes (1.3 GB) copied, 12.7455 s, 95.5 MB/s
# (MB is 1000*1000).
if
(
$line
=~
/,\s+(\d+(?:\.\d+)?)\s+MB\/s/
)
{
$mbps
=
$
1
;
print
STDERR
"
Parsed line: '
$line
'
\n
"
if
(
$debug
>
1
);
next
;
}
if
(
$line
=~
/permission denied/i
)
{
die
(
$line
);
}
print
STDERR
"
Skipped line: '
$line
'
\n
"
if
(
$debug
>
1
);
}
printf
"
%.2f MB/sec
",
$mbps
;
}
else
{
print
"
would do dd
$inarg
$outarg
$skiparg
$sizearg
$countarg
\n
"
}
$gboffset
+=
$INTERVAL
;
last
if
(
$quick
);
}
exit
(
0
);
clientside/tmcc/common/nodetest/usr/local/etc/emulab/update
deleted
100755 → 0
View file @
90f6cac6
#!/usr/local/bin/bash
arg
=
$1
#list="pc4 pc7 pc133 pc137 pc207 pc208 pc406 pc446 pc511 pc606"
if
[
"
${
arg
}
"
==
"static"
]
;
then
here
=
$(
pwd
)
if
[
-d
"bin_FreeBSD_static"
]
;
then
cd
bin_FreeBSD_static
stuff
=
$(
ls
)
if
[
-n
"
${
stuff
}
"
]
;
then
sudo
rsync
-a
-P
*
/proj/emulab-ops/nodecheck/bin_freebsd
fi
cd
$here
fi
if
[
-d
"bin_Linux_static"
]
;
then
cd
bin_Linux_static
stuff
=
$(
ls
)
if
[
-n
"
${
stuff
}
"
]
;
then
sudo
rsync
-a
-P
*
/proj/emulab-ops/nodecheck/bin_linux
fi
cd
$here
fi
exit
0
fi
list
=
$(
mysql
-B
-N
-e
"select node_id from reserved where pid='emulab-ops' and eid='adminnodecheck';"
tbdb
)
machines
=
""
set
-u
linux
=
""
bsd
=
""
#echo "||$machines||"
#echo "bsd||$bsd||"
#echo "linux||$linux||"
utils
=
"diskcheck diskspeedcheck memcheck cpucheck checkutils.sh getfromtb.sh hbis.sh timecheck niccheck gatherinv"
arg
=
${
arg
=
""
}
# use var if set else use ""
case
$arg
in
drive
|
disk
|
mem
|
cpu
|
diskspeed
|
time
|
nic
|
Ngetlogs
|
clearlogs
|
help
|
-help
|
-h
|
?
)
;;
pc
*
|
dbox
*
)
list
=
$arg
;;
esac
case
$arg
in
# don't need OS if not
drive
|
disk
|
mem
|
cpu
|
diskspeed
|
time
|
nic
|
Ngetlogs
|
clearlogs
|
help
|
-help
|
-h
|
?
)
machines
=
$list
;;
*
)
for
i
in
$list
do
os
=
$(
sudo
ssh
$i
uname
-s
)
if
[
"
$os
"
==
"FreeBSD"
]
;
then
bsd
=
"
$bsd
$i
"
;
machines
=
"
$machines
$i
"
elif
[
"
$os
"
==
"Linux"
]
;
then
linux
=
"
$linux
$i
"
;
machines
=
"
$machines
$i
"
else
echo
"Do not know the
$os
of
$i
, skipping"
fi
done
;;
esac
case
$arg
in
drive
|
disk
|
mem
|
cpu
|
diskspeed
|
time
|
nic
)
[[
"
$arg
"
==
"drive"
]]
&&
arg
=
disk
for
i
in
$machines
;
do
sudo
scp
-q
${
arg
}
check
$i
:/usr/local/etc/emulab
echo
-n
"
$i
"
sudo
ssh
$i
"cd /usr/local/etc/emulab; bash /usr/local/etc/emulab/
${
arg
}
check /var/emulab/logs/nodecheck.log"
echo
""
done
;;
run
|
boot
)
[[
"
$arg
"
==
"boot"
]]
&&
action
=
boot
||
action
=
''
for
i
in
$linux
;
do
sudo
scp
-q
rc/rc.nodecheck_perl
$i
:/usr/local/etc/emulab/rc/rc.nodecheck
done
for
i
in
$bsd
;
do
sudo
scp
-q
rc/rc.nodecheck_sh
$i
:/usr/local/etc/emulab/rc/rc.nodecheck
done
for
i
in
$machines
;
do
[[
${
linux
/
${
i
}
//
}
==
${
linux
}
]]
&&
echo
-n
"FreeBSD"
||
echo
-n
"Linux"
echo
"-----------------
$i
--------------------"
sudo
ssh
$i
"cd /usr/local/etc/emulab; /usr/local/etc/emulab/rc/rc.nodecheck
${
action
}
"
done
;;
getlogs
)
for
i
in
$machines
;
do
[[
${
linux
/
${
i
}
//
}
==
${
linux
}
]]
&&
echo
-n
"FreeBSD"
||
echo
-n
"Linux"
echo
"-----------------
$i
--------------------"
sudo
ssh
$i
"cat /var/emulab/logs/nodecheck.log"
done
;;
clearlogs
)
for
i
in
$machines
;
do
sudo
ssh
$i
"rm -f /var/emulab/logs/nodecheck.log"
done
;;
help
|
-help
|
-h
|
?
)
cat
<<
EOF
Usage:
Nodes to be operated on
$machines
[disk|mem|cpu|diskspeed|time|nic] Update node test and run
[run] Update bootscript and run all the nodetests
[boot] Update bootscript run the nodetests as if run at boot time
[getlog] get and display nodecheck.log files
[clearlog] clear the nodecheck.log files
No argument will update all node with checknode scripts
EOF
;;
*
)
for
i
in
$machines
do
echo
"
$i
rc.config "
# sudo rsync -a rc/rc.config ${i}:/usr/local/etc/emulab/rc/rc.config
sudo
scp
-p
rc/rc.config
${
i
}
:/usr/local/etc/emulab/rc/rc.config
# sudo ssh ${i} chown root /usr/local/etc/emulab/rc/rc.config
# sudo ssh ${i} chgrp 0 /usr/local/etc/emulab/rc/rc.config
done
for
i
in
$linux
do
echo
-n
"
$i
:rc.nodecheck-linux "
sudo
scp
-p
rc/rc.nodecheck_perl
${
i
}
:/usr/local/etc/emulab/rc/rc.nodecheck
# sudo ssh ${i} chown root /usr/local/etc/emulab/rc/rc.nodecheck
# sudo ssh ${i} chgrp root /usr/local/etc/emulab/rc/rc.nodecheck
done
for
i
in
$bsd
do
echo
-n
"
$i
:rc.nodecheck-bsd "
sudo
scp
-p
rc/rc.nodecheck_sh
${
i
}
:/usr/local/etc/emulab/rc/rc.nodecheck
# sudo ssh ${i} chown root /usr/local/etc/emulab/rc/rc.nodecheck
# sudo ssh ${i} chgrp wheel /usr/local/etc/emulab/rc/rc.nodecheck
done
for
i
in
$machines
do
echo
"
${
i
}
:utils "
# sudo rsync -a ${utils} ${i}:/usr/local/etc/emulab
for
u
in
${
utils
}
;
do
scp
-p
$u
${
i
}
:/usr/local/etc/emulab
done
# sudo ssh ${i} "cd /usr/local/etc/emulab ; chown root ${utils} "
# sudo ssh ${i} "cd /usr/local/etc/emulab ; chgrp 0 ${utils} "
done
;;
esac
clientside/tmcc/common/nodetest_MFS/LinuxMFS/LinuxMFSandBuildroot.txt
deleted
100644 → 0
View file @
90f6cac6
Hi Dan,
(Sorry for the delay - I spaced this yesterday after we talked.)
I have a 'buildroot' environment setup that you can use to build
executables for our Linux MFS if you wish. Here are the salient bits:
Machine: highlander.onelinux.testbed.emulab.net (pc313 -
testbed/onelinux experiment)
Path: /mnt/local/buildroot-2012.08
Documentation:
http://buildroot.uclibc.org/downloads/manual/manual.html
Note particularly the section on "Building out of the tree", which is
what I've done in the directories "br-build1" and "br-build2" in
/mnt/local. This will keep the buildroot source there relatively
clean. Feel free to copy the configuration I've got there in
"br-build2" as a starting point.
Section "5.3.1" on "Using the generated toolchain outside of
buildroot" may be particularly relevant assuming you don't want to
create a buildroot-specific package (Makefile) for what you're doing.
I actually have a buildroot toolchain compiled and installed in
/opt/br-toolchain that will probably "just work" for cross-compiling
to x86/uclibc for use with the Linux MFS.
Let me know if you run into problems or have questions.
clientside/tmcc/common/nodetest_MFS/LinuxMFS/MachineCheck_OSID
deleted
100644 → 0
View file @
90f6cac6
wap load-descriptors db_osid
OSID MachineCheck/3380 has been created
clientside/tmcc/common/nodetest_MFS/LinuxMFS/db_osid
deleted
100644 → 0
View file @
90f6cac6
<osid>
<attribute name="OS"><value>Linux</value></attribute>
<attribute name="description"><value>Linux admin MFS</value></attribute>
<attribute name="features"><value>ping,ssh,ipod,isup</value></attribute>
<attribute name="magic"><value></value></attribute>
<attribute name="mfs"><value>1</value></attribute>
<attribute name="mustclean"><value>1</value></attribute>
<attribute name="op_mode"><value>PXEFBSD</value></attribute>
<attribute name="osname"><value>MachineCheck</value></attribute>
<attribute name="path"><value>/tftpboot/mcheck</value></attribute>
<attribute name="pid"><value>emulab-ops</value></attribute>
<attribute name="reboot_waittime"><value>120</value></attribute>
<attribute name="shared"><value>1</value></attribute>
<attribute name="version"><value>2.6.27.8</value></attribute>
</osid>
clientside/tmcc/common/nodetest_MFS/LinuxMFS/linux-mfs.txt
deleted
100644 → 0
View file @
90f6cac6
1. The Linux MFS
The Linux MFS for Emulab is based on busybox. There is actually only a single
MFS that is invoke differently for newnode, admin or frisbee. The root
directories are (on boss):
/tftpboot/newnode_linux
/tftpboot/admin_linux
/tftpboot/frisbee_linux
If you look in those directories you will see grub.cfg files which reference
the common directory (right now: /tftpboot/linux_mfs_64_3.2.7) but invoke
linux with a different elab_mode option for each.
So to make your own, copy the common directory to say /tftpboot/linux_mfs_mine
and then either make your own copies of the stub newnode/admin/frisbee
directories, or just drop a grub.cfg in your copy of the common directory
and modify it accordingly to be a linux or admin MFS depending on what you
are doing.
The actual MFS is initramfs.lzma in the common directory. It is a compressed
cpio archive of a filesystem. To modify it, use the extract_initramfs script
in that directory. It will unpack everything to extracted_initramfs and then
you can go in there and tweak stuff. When you are done, use compress_initramfs
to cpio it all up again.
If you don't need to modify binaries, life is easy. Just tweak whatever scripts
you need, add/remove stuff, etc. However, if you need to rebuild a binary or
install a package, then you need a cross-build environment. Probably talk to
Kirk about that.
2. Tweaking the Emulab DB to use your MFS.
First you have to create an OSID for your MFS. To do that, take this little
xml snippit:
<osid>