Commit 03cf92cb authored by Leigh B. Stoller's avatar Leigh B. Stoller

Changes to elabinelab setup. The source code for inner boss/ops no

longer comes from the project directory (really, my source directory
in the various projects). Instead, the source code comes from one of
two places:

* Using fetch on the inner ops and boss, make a special request to the
  outer webserver to return a tarball, currently stored in
  /usr/testbed/src, and created by toplevel makefile target "elabinelab".
  So, in your object tree (preferably one that is pure, without any of your
  own hacks) run "make elabinelab" and it will create the tarfile for you.
  The tarball is returned only to elabinelab experiments providing the
  experiment secret key (a variant of the existing spewrpmtar file stuff).

* Using the standard tarfile install command, albiet indrectly cause of how
  we hide all of the elabinelab NS goo. So, in your NS file you can do:

	tb-elab-in-elab 1
	set ::TBCOMPAT::elabinelab_source_tarfile \
			"/proj/testbed/tarfiles/emulab-src.tar.gz"

  Which will arrange for this tarfile to be installed in /usr/src, and then
  copied to the approriate place later when inner boss and inner ops are
  setup. The tarfile should be created in the top of your testbed source
  tree. This is given preference over method 1 above.

XXX Currently the tarfile is unpacked in /usr/src cause install-tarfile
does not create the target directory. As soon as we have new images, I'll
move this unpacking to a more suitable place.
parent c3d2b2d8
......@@ -47,6 +47,11 @@ if { ${::TBCOMPAT::elabinelab_maxpcs} != 0 } {
set maxpcs 0
}
if { ${::TBCOMPAT::elabinelab_source_tarfile} != "" } {
tb-set-node-tarfiles $myboss /usr/src ${::TBCOMPAT::elabinelab_source_tarfile}
tb-set-node-tarfiles $myops /usr/src ${::TBCOMPAT::elabinelab_source_tarfile}
}
set lanstr "myboss myops "
for {set i 1} {$i <= $maxpcs} {incr i} {
set name "mypc${i}"
......
......@@ -114,6 +114,7 @@ namespace eval TBCOMPAT {
variable elabinelab_maxpcs
variable elabinelab_hardware
variable elabinelab_fixnodes
variable elabinelab_source_tarfile ""
# Mapping of "resource classes" and "reservation types" to bootstrap
# values, where a resource class is a symbolic string provided by the user
......
......@@ -141,6 +141,7 @@ sub SetupOpsNode();
sub SetupBossNode();
sub CreateDefsFile($);
sub SetupSendMail($$);
sub GetEmulabSource($);
#
# Boot Action.
......@@ -239,9 +240,7 @@ sub SetupOpsNode()
mysystem("mkdir ${TBDIR}/testbed/src");
mysystem("mkdir ${TBDIR}/testbed/obj");
print "Copying over current testbed software from /proj\n";
mysystem("mkdir ${TBDIR}/testbed/src/testbed");
mysystem("rsync -a --delete /proj/$pid/src/testbed ${TBDIR}/testbed/src", 3);
GetEmulabSource("${TBDIR}/testbed/src");
#
# The mirror tree is copied to temp storage, and then copied into
......@@ -467,6 +466,10 @@ sub SetupOpsNode()
mysystem("echo '/usr/local/etc/emulab/rc/rc.inelab' ".
" >> /etc/rc.local");
# Ack, still waiting for new images.
mysystem("cp ${TBDIR}/testbed/src/testbed/tmcd/common/rc.inelab ".
" /usr/local/etc/emulab/rc/rc.inelab");
#
# Copy the mirror tree into place. Do not use rsync.
#
......@@ -490,17 +493,15 @@ sub SetupBossNode()
mysystem("mkdir ${TBDIR}/testbed/src");
mysystem("mkdir ${TBDIR}/testbed/obj");
print "Copying over current testbed software from /proj\n";
mysystem("mkdir ${TBDIR}/testbed/src/testbed");
mysystem("rsync -a --delete /proj/$pid/src/testbed ${TBDIR}/testbed/src", 3);
GetEmulabSource("${TBDIR}/testbed/src");
print "Copying over initial dbstate from /proj\n";
mysystem("mkdir ${TBDIR}/testbed/stuff");
mysystem("cp -fp /proj/$pid/exp/$eid/dbstate.tar.gz ${TBDIR}/testbed/stuff",
3);
mysystem("cp -fp /proj/$pid/exp/$eid/dbstate.tar.gz ".
" ${TBDIR}/testbed/stuff");
# Copy over creators ssl certificate for XMLRPC. See below.
mysystem("cp -fp ~${creator}/.ssl/emulab.pem ${TBDIR}/testbed/stuff", 3);
mysystem("cp -fp ~${creator}/.ssl/emulab.pem ${TBDIR}/testbed/stuff");
#
# Stash the IP of the outer emulab for tmcc (and script above).
......@@ -749,6 +750,10 @@ sub SetupBossNode()
#
mysystem("echo '/usr/local/etc/emulab/rc/rc.inelab' ".
" >> /etc/rc.local");
# Ack, still waiting for new images.
mysystem("cp ${TBDIR}/testbed/src/testbed/tmcd/common/rc.inelab ".
" /usr/local/etc/emulab/rc/rc.inelab");
}
#
......@@ -993,3 +998,40 @@ sub mysystem($;$)
}
print "Finished at: " . libsetup::TBTimeStamp() . "\n";
}
#
# Deal with the source code!
#
sub GetEmulabSource($)
{
my ($destdir) = @_;
mysystem("mkdir $destdir/testbed");
#
# Look to see if the source code is already here (say, cause the user
# specified a tarfile). If so, copy it into place.
#
if (-d "/usr/src") {
print "Copying over current testbed software from /usr/src\n";
mysystem("rsync -a --delete /usr/src/ $destdir/testbed");
}
else {
#
# Get the tarball from the server.
#
my $file = TMNODEID();
my $nodeid = `cat $file`;
chomp($nodeid);
my $keyfile = TMKEYHASH();
my $keyhash = `cat $keyfile`;
chomp($keyhash);
mysystem("fetch -q -o /tmp/foo.tar.gz ".
"'https://${bossname}/spewrpmtar.php3?nodeid=${nodeid}&".
"key=${keyhash}&elabinelab_source=1'");
mysystem("tar xzf /tmp/foo.tar.gz -C $destdir/testbed");
}
}
Markdown is supported
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