Commit 1e8d93dd authored by Ryan Jackson's avatar Ryan Jackson

add libxmlrpc stuff for subboss

parent e99c2f4f
......@@ -238,6 +238,7 @@ endif
@$(MAKE) -C tmcd subboss-install
@$(MAKE) -C rc.d subboss-install
@$(MAKE) -C dhcpd subboss-install
@$(MAKE) -C tbsetup client-install
# Hack: this should probably be done by a subboss-install
# script, but there isn't a huge need for that yet
@rm -f $(INSTALL_RCDIR)/isc-dhcpd
......
This diff is collapsed.
......@@ -101,7 +101,7 @@ AC_SUBST(optional_subdirs)
# These get defined in the definitions file (--with-TBDEFS).
# NB: See AC_DEFINE_UNQUOTED() calls below, if you want a variable
# to appear in config.h.
#
#
AC_SUBST(TBDBNAME)
AC_SUBST(TBERRORLOGDBNAME)
AC_SUBST(TBADMINGROUP)
......@@ -156,6 +156,7 @@ AC_SUBST(ELABINELAB)
AC_SUBST(OUTERBOSS_NODENAME)
AC_SUBST(OUTERBOSS_XMLRPCPORT)
AC_SUBST(OUTERBOSS_SSLCERTNAME)
AC_SUBST(SUBBOSS_SSLCERTNAME)
AC_SUBST(PLABSUPPORT)
AC_SUBST(PUBSUPPORT)
AC_SUBST(WIKISUPPORT)
......@@ -250,7 +251,7 @@ AC_SUBST(TBERRORSEMAIL_NOSLASH)
#
# Defaults for for above variables.
#
#
TBERRORLOGDBNAME="errorlog"
TBADMINGROUP="flux"
CLIENT_ETCDIR="/etc/emulab"
......@@ -270,6 +271,7 @@ ELABINELAB=0
OUTERBOSS_NODENAME=""
OUTERBOSS_XMLRPCPORT=3069
OUTERBOSS_SSLCERTNAME="/etc/outer_emulab.pem"
SUBBOSS_SSLCERTNAME="/etc/subboss.pem"
PLABSUPPORT=0
PUBSUPPORT=0
WIKISUPPORT=0
......@@ -431,7 +433,7 @@ AC_SUBST(LOG_TESTBED)
# If the private network is different then the control network, we need
# an extra subnet decl for it in dhcpd.conf.template. This is enormously
# crude and simplistic, but works for the local case!
#
#
if test "$PRIVATE_NETWORK" != "$CONTROL_NETWORK"; then
DHCPD_CONTROLNET_DECL="subnet $PRIVATE_NETWORK netmask $PRIVATE_NETMASK {}"
fi
......@@ -660,7 +662,7 @@ AC_SUBST(OPT_CFLAGS)
#
# Disable event system. Relies on Elvin. On by default.
#
#
AC_ARG_ENABLE(events,
[ --disable-events Disable events (requires Elvin libraries)])
......@@ -715,7 +717,7 @@ fi
# Enable Windows support.
# Right now this means NTFS support in imagezip, maybe more things later.
# Relies on Linux NTFS library.
#
#
AC_ARG_ENABLE(windows,
[ --enable-windows Enable Windows XP support (default)])
......@@ -868,6 +870,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/wanlinkinfo tbsetup/wanassign \
tbsetup/swapexp tbsetup/endexp tbsetup/elabinelab \
tbsetup/frisbeelauncher tbsetup/eventsys.proxy tbsetup/frisbeeimage \
tbsetup/subboss_frisbeelauncher tbsetup/subboss_frisbeeimage \
tbsetup/snmpit.proxy tbsetup/snmpit_remote.pm \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
......
......@@ -48,6 +48,8 @@ ifeq ($(ISMAINSITE),1)
SBIN_STUFF += repos_daemon
endif
SUBBOSS_SBIN_STUFF = subboss_frisbeelauncher subboss_frisbeeimage
CTRLSBIN_STUFF = console_setup.proxy sfskey_update.proxy \
savelogs.proxy eventsys.proxy
......@@ -266,6 +268,11 @@ endif
chown root $(INSTALL_SBINDIR)/nfstrace
chmod u+s $(INSTALL_SBINDIR)/nfstrace
#
# Subboss installation
#
subboss-install: $(addprefix $(INSTALL_SBINDIR)/, $(SUBBOSS_SBIN_STUFF))
#
# Control node installation (okay, plastic)
#
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2004, 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
#
# Ask outer emulab for an image we do not happen to have locally.
#
sub usage()
{
print STDOUT "Usage: frisbeeimage [-d] imageid filename\n";
exit(-1);
}
my $optlist = "d";
my $debug = 1;
#
# Configure variables
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $RPCSERVER = "@OUTERBOSS_NODENAME@";
my $RPCPORT = "@OUTERBOSS_XMLRPCPORT@";
my $RPCCERT = "@OUTERBOSS_SSLCERTNAME@";
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin:/usr/site/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# Turn off line buffering on output
#
$| = 1;
#
# We don't want to run this script unless its the real version.
#
if ($EUID != 0) {
die("Must be root! Maybe its a development version?\n");
}
# Load the Testbed support stuff.
use lib "@prefix@/lib";
use libtestbed;
use libxmlrpc;
# Locals
my $FRISBEE = "$TB/sbin/frisbee";
my $SAVEUID = $UID;
my $loadaddr;
my $loadport;
my $mcastif;
#
# Parse command arguments. Once we return from getopts, all that should
# left are the required arguments.
#
%options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (! @ARGV) {
usage();
}
my ($imageid, $filename) = @ARGV;
#
# Untaint the arguments.
#
if ($imageid =~ /^([-\@\w\+\.]+)$/) {
$imageid = $1;
}
else {
die("Tainted argument $imageid!\n");
}
my $mcast_ip_file = "/var/emulab/boot/myip";
if (! -e $mcast_ip_file) {
die("$mcast_ip_file does not exist!");
}
$mcastif = `cat $mcast_ip_file`;
chomp($mcastif);
if ($mcastif =~ /^([\d\.]+)$/) {
$mcastif = $1;
}
else {
die("Could not parse outer IP: $mcastif!");
}
#
# Ask the outer Emulab to lauch a frisbee and return the loadinfo to us.
#
libxmlrpc::Config({"server" => $RPCSERVER,
"verbose" => 1,
"cert" => $RPCCERT,
"portnum" => $RPCPORT});
my $rval = libxmlrpc::CallMethod("subboss", "frisbeelauncher",
{"imageid" => "$imageid"});
if (!defined($rval)) {
die("Could not fire up frisbee on boss!");
}
#
# The return value is the loadaddr. Parse that into something we
# can pass to the frisbee client.
#
if ($rval =~ /^(.*):(\d*)$/) {
$loadaddr = $1;
$loadport = $2;
}
else {
die("Could not parse loadinfo from server: $rval!");
}
if ($debug) {
print "$FRISBEE -N -i $mcastif -m $loadaddr -p $loadport $filename\n";
}
# XXX HACK
$filename =~ /(.*)/;
$filename = $1;
$SIG{HUP} = $SIG{INT} = $SIG{TERM} = \&cleanup;
system($FRISBEE, '-N', '-i', $mcastif, '-m', $loadaddr,
'-p', $loadport, $filename);
if ($?) {
die("Error downloading image data from outer Emulab!");
}
exit(0);
sub cleanup {
tbwarn("Download interrupted, $filename removed");
$SIG{HUP} = $SIG{INT} = $SIG{TERM} = 'IGNORE';
kill('TERM', 0);
unlink($filename);
exit(-1);
}
This diff is collapsed.
This diff is collapsed.
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