Commit d12f9b61 authored by Robert Ricci's avatar Robert Ricci

Commit the stuff necessary to copy out new plab rootballs, versions of

which had been hanging around in my home directory for a while.

There are a few new things in plab/etc/netbed_files that set up a
directory of the same name in @prefix@. This will get rsync'ed with
netbed_files/ on each planetlab node.
log/  - just needs to exist for the httpd server
sbin/ - contains thttpd, and scripts to manipulate it
www/  - the directory served by thttpd. Contains symlinks to the 'real'
        location of the rootballs (etc/plab)

I've committed a binary of thttpd - this is simply because it'd be a
PITA to compile a Linux binary for every devel tree, etc.

PLAB_ROOTBALL has now become a configure options. The idea is that we
will keep the latest version number in configure.in, but you can
override it in your defs
file. This way, we don't have to update every defs file when there's a new
version, but people can still play around with their own version if they want.

The two scripts that interact with the plab nodes skip ones that are
down. They ssh in as 'utah1', meaning that one of us who has access to
that account needs to run them, so that they can have access to our
keys. We can put boss's public key (or something) out there to remove
this requirement.

plabdist runs an rsync between @prefix@/etc/plab/netbed_files and a
file of the same name on the planetlab nodes. It's intended to be run
from the main install tree - the local rsync directory is not normally
set up in devel trees. It runs in parallel, but is limited to 4 to
avoid beating up boss too much. Takes about 1:40 with the current set
of plab nodes (took > 10 minutes doing one at a time).

plabhttpd (re)starts the mini web server on all plab nodes
parent 31293e81
......@@ -865,6 +865,7 @@ fi
#
......@@ -906,6 +907,7 @@ JAILIPMASK=255.240.0.0
IPBASE=10
SFSSUPPORT=1
PLABSUPPORT=0
PLAB_ROOTBALL="plabroot-8.tgz"
TBLOGFACIL="local5"
#
......@@ -1288,7 +1290,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1291: checking for a BSD compatible install" >&5
echo "configure:1294: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -1413,6 +1415,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/plab/plabmetrics tbsetup/plab/plabstats \
tbsetup/plab/plabmonitord tbsetup/plab/plablinkdata \
tbsetup/plab/libdslice/GNUmakefile tbsetup/plab/etc/GNUmakefile \
tbsetup/plab/plabdist tbsetup/plab/plabhttpd \
tbsetup/plab/etc/netbed_files/GNUmakefile \
tip/GNUmakefile \
tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/openbsd/GNUmakefile \
tmcd/linux/GNUmakefile tmcd/ron/GNUmakefile tmcd/common/GNUmakefile \
......@@ -1629,6 +1633,7 @@ s%@TBMAINSITE@%$TBMAINSITE%g
s%@SFSSUPPORT@%$SFSSUPPORT%g
s%@PLABSUPPORT@%$PLABSUPPORT%g
s%@TBLOGFACIL@%$TBLOGFACIL%g
s%@PLAB_ROOTBALL@%$PLAB_ROOTBALL%g
s%@TBOPSEMAIL@%$TBOPSEMAIL%g
s%@TBOPSEMAIL_NOSLASH@%$TBOPSEMAIL_NOSLASH%g
s%@TBLOGSEMAIL@%$TBLOGSEMAIL%g
......
......@@ -58,6 +58,7 @@ AC_SUBST(TBMAINSITE)
AC_SUBST(SFSSUPPORT)
AC_SUBST(PLABSUPPORT)
AC_SUBST(TBLOGFACIL)
AC_SUBST(PLAB_ROOTBALL)
#
# Offer both versions of the email addresses that have the @ escaped
......@@ -98,6 +99,7 @@ JAILIPMASK=255.240.0.0
IPBASE=10
SFSSUPPORT=1
PLABSUPPORT=0
PLAB_ROOTBALL="plabroot-8.tgz"
TBLOGFACIL="local5"
#
......@@ -456,6 +458,8 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/plab/plabmetrics tbsetup/plab/plabstats \
tbsetup/plab/plabmonitord tbsetup/plab/plablinkdata \
tbsetup/plab/libdslice/GNUmakefile tbsetup/plab/etc/GNUmakefile \
tbsetup/plab/plabdist tbsetup/plab/plabhttpd \
tbsetup/plab/etc/netbed_files/GNUmakefile \
tip/GNUmakefile \
tmcd/GNUmakefile tmcd/freebsd/GNUmakefile tmcd/openbsd/GNUmakefile \
tmcd/linux/GNUmakefile tmcd/ron/GNUmakefile tmcd/common/GNUmakefile \
......
......@@ -15,7 +15,7 @@ include $(OBJDIR)/Makeconf
SUBDIRS = libdslice etc
SBIN_STUFF = plabslice plabnode plabdaemon plabmetrics plabstats \
plabmonitord plablinkdata
plabmonitord plablinkdata plabdist plabhttpd
LIB_STUFF = libplab.py
......
......@@ -12,6 +12,19 @@ UNIFIED = @UNIFIED_BOSS_AND_OPS@
include $(OBJDIR)/Makeconf
#
# Only do the netbed_files subdir in the main install tree
#
ifeq ($(TBROOT),/usr/testbed)
SUBDIRS = netbed_files
NF_INSTALL = @$(MAKE) -C netbed_files install
NF_POST_INSTALL = @$(MAKE) -C netbed_files post-install
else
SUBDIRS = netbed_files
NF_INSTALL = @$(MAKE) -C netbed_files install
NF_POST_INSTALL = @$(MAKE) -C netbed_files post-install
endif
ETC_STUFF = fixsudo.sh # plabroot.tgz
CERTS = cacert.pem cert.pem key.pem pubkey.pem req.pem
......@@ -20,11 +33,11 @@ CERTS = cacert.pem cert.pem key.pem pubkey.pem req.pem
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(ETC_STUFF) # $(CERTS)
all: $(ETC_STUFF) $(SUBDIRS) # $(CERTS)
include $(TESTBED_SRCDIR)/GNUmakerules
install: all data-install
install: all data-install subdir-install
#
# Automate this part at some point.
......@@ -34,7 +47,7 @@ data-install: $(addprefix $(INSTALL_ETCDIR)/plab/, $(ETC_STUFF)) # \
@echo Make sure etc/plab/ has the necessary certificates
@echo See tbsetup/plab/etc/README for instructions
post-install:
post-install: subdir-post-install
chmod 775 $(INSTALL_ETCDIR)
chmod 775 $(INSTALL_ETCDIR)/plab
......@@ -44,3 +57,9 @@ $(INSTALL_ETCDIR)/plab/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_ETCDIR)/plab
$(INSTALL_DATA) $< $@
subdir-install:
${NF_INSTALL}
subdir-post-install:
${NF_POST_INSTALL}
......@@ -28,6 +28,11 @@ cacert.pem
http://www.planet-lab.org/dotplanetlab/base/cacert.pem (see
plkeygen:getbsae in the dslice source)
netbed_files
This directory, in the install tree, will be rsync'ed to a
directory of the same name on the plabnetlab nodes
Note that all of the *.pem files created by plkeygen are dropped in
~/.planetlab, so they have to be moved to this directory to be used.
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2003 University of Utah and the Flux Group.
# All rights reserved.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../../../..
SUBDIR = tbsetup/plab/etc/netbed_files
ROOTBALL = @PLAB_ROOTBALL@
include $(OBJDIR)/Makeconf
SBIN_STUFF = installcron.sh thttpd.restart thttpd
FILES_DIR = $(INSTALL_ETCDIR)/plab/netbed_files
SBIN_DIR = $(FILES_DIR)/sbin
LOG_DIR = $(FILES_DIR)/log
WWW_DIR = $(FILES_DIR)/www
include $(TESTBED_SRCDIR)/GNUmakerules
mkdirs: $(LOG_DIR) $(WWW_DIR)
rootball-link:
-ln -s $(INSTALL_ETCDIR)/plab/$(ROOTBALL) $(WWW_DIR)/$(ROOTBALL)
install: sbin-install mkdirs rootball-link
sbin-install: $(addprefix $(SBIN_DIR)/, $(SBIN_STUFF))
#
# We have to change perms on these files, because rsync will preserve them
#
post-install:
chmod 770 $(FILES_DIR)
chmod 770 $(SBIN_DIR)
chmod 770 $(LOG_DIR)
chmod 775 $(WWW_DIR)
all: $(SBIN_STUFF)
$(SBIN_DIR)/%: %
@echo "Installing $<"
-mkdir -p $(SBIN_DIR)
$(INSTALL_PROGRAM) $< $@
$(LOG_DIR):
mkdir -p $@
$(WWW_DIR):
mkdir -p $@
#!/bin/sh
CRONTAB=/usr/bin/crontab
CRONLINE="@reboot cd /home/utah1; ./netbed_files/sbin/thttpd.restart"
#
# For now, just install the new crontab - we don't really have a reason to
# put anything else into it
#
echo $CRONLINE | $CRONTAB -
#!/bin/sh
MAIL_WARNINGS_TO=testbed-ops@emulab.net
BASE=/home/utah1/netbed_files
LOGDIR=$BASE/log
LOGFILE=$LOGDIR/thttpd.log
PIDFILE=$LOGDIR/thttpd.pid
DOCDIR=$BASE/www
PORT=1492
HTTPD_COMMAND="$BASE/sbin/thttpd -p $PORT -d $DOCDIR -h localhost -l $LOGFILE -i $PIDFILE"
INSTALLCRON=$BASE/sbin/installcron.sh
WGET_COMMAND="/usr/bin/wget -q -O /dev/null localhost:$PORT/"
#
# Install a crontab that starts the webserver at boot time
#
$INSTALLCRON
#
# Kill the old one
#
if [ -e $PIDFILE ]; then
kill -USR1 `cat $PIDFILE`;
fi
#
# Run the new one
#
$HTTPD_COMMAND
#
# Make sure it started
#
if $WGET_COMMAND; then
ERRSTR="thttpd on `hostname` failed to start"
echo $ERRSTR
echo "$ERRSTR" | mail -s "$ERRSTR" $MAIL_WARNINGS_TO
fi;
......@@ -67,7 +67,7 @@ HTTPD_PORT = "1492"
HTTP_PATH = "/" # ensure this ends in a slash
ROOTBALL_HTTP_URLPATH = HTTPD_SITE + HTTPD_PORT + HTTP_PATH
DEF_ROOTBALL_NAME = "plabroot-8.tgz"
DEF_ROOTBALL_NAME = @PLAB_ROOTBALL@
#
# How many seconds to sleep between failures and how many times to try
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2003 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Script for sync-ing out the netbed_files directory to planetlab nodes
#
# NOTE: This script currently requires YOUR keys, because it logs in as utah1
# on the planetlab nodes
#
use lib '@prefix@/lib';
use libdb;
my $INSTALL_ETCDIR = '@prefix@/etc';
my $ROOTBALL = '@PLAB_ROOTBALL@';
#
# Username that we'll use to ssh into planetlab nodes
#
my $PLAB_USER = "utah1";
#
# Directory to sync with the plab nodes
#
my $LOCAL_SYNC_DIR = "$INSTALL_ETCDIR/plab/netbed_files";
my $REMOTE_SYNC_DIR = "netbed_files";
#
# Maximum number of children to run at once - we'll keep this low, since it
# consumes bandwidth on boss
#
my $max_children = 4;
#
# Die unless the rootball exists - this serves two purposes:
# 1) It reminds you to install the rootball
# 2) It prevents you from accidentally running this in a devel tree
#
# We try opening it, so that a symlink pointing to a non-existant file will
# fail.
#
if (!open(ROOTBALL,"<$LOCAL_SYNC_DIR/www/$ROOTBALL")) {
die "Unable to open $LOCAL_SYNC_DIR/www/$ROOTBALL: $!";
}
close ROOTBALL;
#
# Set up rsync to use ssh - we don't use sshtb, because we need to be able to
# control the username, and it would automatically pick emulabman. Also, we
# have to do the ssh argument differently from normal, because of the way rsync
# 'helpfully' parses them for us - spaces and quotes are a no-no.
#
$ENV{'RSYNC_RSH'} = "ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no " .
"-l $PLAB_USER";
my $RSYNC = "/usr/local/bin/rsync";
if (!TBAdmin()) {
die "Sorry, only admins can use this script!\n";
}
if (@ARGV) {
die "Usage: $0\n";
}
#
# Get a list of planetlab nodes that are up
#
my $query_result = DBQueryFatal("SELECT n.node_id FROM nodes as n " .
"LEFT JOIN node_status AS s ON n.node_id=s.node_id " .
"LEFT JOIN reserved AS r ON n.node_id = r.node_id " .
"WHERE n.type=\"pcplabphys\" AND s.status=\"up\" AND " .
"!(r.pid=\"" . NODEDEAD_PID .
"\" AND r.eid=\"" . NODEDEAD_EID . "\")");
my @nodes = ();
while (my ($node) = $query_result->fetchrow()) {
push @nodes, $node;
}
#
# Run up to $max_children rsyncs at a time
#
my $current_children = 0;
my @failed = ();
while (@nodes || $current_children) {
if (($current_children < $max_children) && @nodes) {
#
# If we have room for another child, start one up
#
my $node = pop @nodes;
if (my $pid = fork()) {
$current_children++;
$children{$pid} = $node;
} else {
print "rsync-ing with $node ...\n";
exec "$RSYNC -aLz $LOCAL_SYNC_DIR/ ${node}:$REMOTE_SYNC_DIR/";
}
} else {
#
# Wait for a child to die, and see if it failed
#
my $childpid = wait();
if ($childpid < 0) {
die "Bad return value from wait(): $childpid\n";
}
if ($children{$childpid}) {
$current_children--;
if ($?) {
push @failed, $children{$childpid};
}
}
}
}
if (@failed) {
print "Some nodes failed: \n";
print map {"$_\n"} @failed;
}
exit scalar @failed;
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2003 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Simple little script to start up thttpd on planetlab nodes - it actually
# restarts the server gracefully, so that any downloads already going on will
# get to complete
#
# NOTE: This script currently requires YOUR keys, because it logs in as utah1
# on the planetlab nodes
#
use lib '@prefix@/lib';
use libdb;
#
# Username that we'll use to ssh into planetlab nodes
#
my $PLAB_USER = "utah1";
#
# Script to run on the plab nodes to start the webserver
#
my $THTTPD_START = "netbed_files/sbin/thttpd.restart";
#
# SSH command
#
my $SSH = "ssh -q -oBatchMode=yes -oStrictHostKeyChecking=no -l $PLAB_USER";
#
# Get a list of planetlab nodes that are up
#
my $query_result = DBQueryFatal("SELECT n.node_id FROM nodes as n " .
"LEFT JOIN node_status AS s ON n.node_id=s.node_id " .
"LEFT JOIN reserved AS r ON n.node_id = r.node_id " .
"WHERE n.type=\"pcplabphys\" AND s.status=\"up\" AND " .
"!(r.pid=\"" . NODEDEAD_PID .
"\" AND r.eid=\"" . NODEDEAD_EID . "\")");
while (my ($node) = $query_result->fetchrow()) {
print "Starting up webserver on $node ...\n";
system "$SSH $node $THTTPD_START";
}
......@@ -43,8 +43,7 @@ ALLCERTS = $(CERTS)
#
# Name and rootball revision
#
ROOTBALLREV = 8
ROOTBALLNAME = plabroot-$(ROOTBALLREV).tgz
ROOTBALLNAME = @PLAB_ROOTBALL@
include $(OBJDIR)/Makeconf
......
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