Commit 95b370f5 authored by Mike Hibler's avatar Mike Hibler

Cleanup the source tree to account for master frisbee server.

No more frisbeelauncher or assorted subboss frisbee stuff.
parent 3a1ae260
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -139,8 +139,6 @@ my %xmlfields =
"description" => ["description", $SLOT_OPTIONAL],
"path" => ["path", $SLOT_OPTIONAL],
"mtype_*" => ["mtype", $SLOT_OPTIONAL],
#"load_address" => ["load_address", $SLOT_ADMINONLY],
#"frisbee_pid" => ["frisbee_pid", $SLOT_ADMINONLY]
);
#
# Need a list of node types. We join this over the nodes table so that
......@@ -375,31 +373,6 @@ foreach $key (@mtype_keys) {
UserError("Node Types: Must select at least one node type")
if ($node_types_selected == 0);
#
# Only admins can edit the load_address or the frisbee pid.
# XXX: Bring back functionally is some way
#if ($isadmin) {
# if (exists($editimageid_args{"load_address"}) &&
# $editimageid_args{"load_address"} ne "") {
# $foo = escapeshellarg($editimageid_args{"load_address"});
#
# if ($editimageid_args{"load_address"} ne $foo) {
# UserError("Load Address: Contains illegal characters!");
# }
# }
# # Frisbee_pid has already been checked to be a valid int coming from XML.
#}
#else { # Not isadmin.
# if (exists($editimageid_args{"load_address"}) &&
# $editimageid_args{"load_address"} ne $image->load_address()) {
# UserError("Load Address: No permission, admin-only");
# }
# if (exists($editimageid_args{"frisbee_pid"}) &&
# $editimageid_args{"frisbee_pid"} ne $image->frisbee_pid()) {
# UserError("Frisbee PID: No permission, admin-only");
# }
#}
#
# Mereusers are not allowed to create more than one osid/imageid mapping
# for each machinetype. They cannot actually do that through the EZ form
......
......@@ -2230,17 +2230,17 @@ for ac_hdr in ulxmlrpcpp/ulxr_config.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2226: checking for $ac_hdr" >&5
echo "configure:2234: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2231 "configure"
#line 2239 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2236: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2279,17 +2279,17 @@ for ac_hdr in linux/videodev.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:2275: checking for $ac_hdr" >&5
echo "configure:2283: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2280 "configure"
#line 2288 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2322,7 +2322,7 @@ done
# Extract the first word of "gtk-config", so it can be a program name with args.
set dummy gtk-config; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2318: checking for $ac_word" >&5
echo "configure:2326: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_prog_GTK_CONFIG'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2379,7 +2379,7 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
echo "configure:2375: checking how to run the C++ preprocessor" >&5
echo "configure:2383: checking how to run the C++ preprocessor" >&5
if test -z "$CXXCPP"; then
if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -2392,12 +2392,12 @@ ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftes
cross_compiling=$ac_cv_prog_cxx_cross
CXXCPP="${CXX-g++} -E"
cat > conftest.$ac_ext <<EOF
#line 2388 "configure"
#line 2396 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2393: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2401: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
:
......@@ -2423,17 +2423,17 @@ echo "$ac_t""$CXXCPP" 1>&6
ac_safe=`echo "xercesc/dom/DOM.hpp" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for xercesc/dom/DOM.hpp""... $ac_c" 1>&6
echo "configure:2419: checking for xercesc/dom/DOM.hpp" >&5
echo "configure:2427: checking for xercesc/dom/DOM.hpp" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 2424 "configure"
#line 2432 "configure"
#include "confdefs.h"
#include <xercesc/dom/DOM.hpp>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:2429: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:2437: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -2497,7 +2497,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:2493: checking for a BSD compatible install" >&5
echo "configure:2501: 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
......@@ -2558,7 +2558,7 @@ esac
# Extract the first word of "rsync", so it can be a program name with args.
set dummy rsync; ac_word=$2
echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
echo "configure:2554: checking for $ac_word" >&5
echo "configure:2562: checking for $ac_word" >&5
if eval "test \"`echo '$''{'ac_cv_path_RSYNC'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
......@@ -2681,8 +2681,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/batchexp tbsetup/batch_daemon tbsetup/repos_daemon \
tbsetup/wanlinkinfo tbsetup/wanassign \
tbsetup/swapexp tbsetup/endexp tbsetup/elabinelab \
tbsetup/frisbeelauncher tbsetup/eventsys.proxy tbsetup/frisbeeimage \
tbsetup/subboss_frisbeelauncher tbsetup/subboss_frisbeeimage \
tbsetup/eventsys.proxy \
tbsetup/snmpit.proxy tbsetup/snmpit_remote.pm \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
......@@ -2697,7 +2696,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
tbsetup/assign_wrapper2 \
tbsetup/frisbeelauncher tbsetup/node_update \
tbsetup/node_update \
tbsetup/savelogs tbsetup/setgroups \
tbsetup/savelogs.proxy tbsetup/rmgroup tbsetup/mkexpdir \
tbsetup/node_control tbsetup/node_attributes \
......
......@@ -911,8 +911,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/batchexp tbsetup/batch_daemon tbsetup/repos_daemon \
tbsetup/wanlinkinfo tbsetup/wanassign \
tbsetup/swapexp tbsetup/endexp tbsetup/elabinelab \
tbsetup/frisbeelauncher tbsetup/eventsys.proxy tbsetup/frisbeeimage \
tbsetup/subboss_frisbeelauncher tbsetup/subboss_frisbeeimage \
tbsetup/eventsys.proxy \
tbsetup/snmpit.proxy tbsetup/snmpit_remote.pm \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
......@@ -927,7 +926,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
tbsetup/assign_wrapper2 \
tbsetup/frisbeelauncher tbsetup/node_update \
tbsetup/node_update \
tbsetup/savelogs tbsetup/setgroups \
tbsetup/savelogs.proxy tbsetup/rmgroup tbsetup/mkexpdir \
tbsetup/node_control tbsetup/node_attributes \
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2007-2010 University of Utah and the Flux Group.
# Copyright (c) 2007-2011 University of Utah and the Flux Group.
# All rights reserved.
#
package Image;
......@@ -127,9 +127,6 @@ sub part4_osid($) { return field($_[0], "part4_osid"); }
sub default_osid($) { return field($_[0], "default_osid"); }
sub path($) { return field($_[0], "path"); }
sub magic($) { return field($_[0], "magic"); }
#sub load_address($) { return field($_[0], "load_address"); }
#sub frisbee_pid($) { return field($_[0], "frisbee_pid"); }
#sub load_busy($) { return field($_[0], "load_busy"); }
sub ezid($) { return field($_[0], "ezid"); }
sub shared($) { return field($_[0], "shared"); }
sub global($) { return field($_[0], "global"); }
......@@ -139,6 +136,8 @@ sub access_key($) { return field($_[0], "access_key"); }
#
# Get a list of all running frisbee images.
# XXX if this is actually used, it will have to be fixed; DB no longer
# tracks running frisbee daemons.
#
sub ActiveImages($)
{
......@@ -370,7 +369,6 @@ sub EditImageid($$$$)
# (Others above already did their own updates.)
#
my %updates;
#foreach my $col ("description", "path", "load_address", "frisbee_pid" ) {
foreach my $col ("description", "path") {
# Copy args we want so that others can't get through.
if (exists($argref->{$col})) {
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2010 University of Utah and the Flux Group.
# Copyright (c) 2010-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -49,8 +49,8 @@ my $PGENIUPDATE = "$TB/sbin/protogeni/update";
my $PGENISUPPORT = @PROTOGENI_SUPPORT@;
my $INSTALLUPDATE= "$TB/sbin/update-install";
my $SETSITEVAR = "$TB/sbin/setsitevar";
my $MFRISBEED = "/usr/local/etc/rc.d/3.mfrisbeed.sh";
my $STARTUP = "/usr/local/etc/rc.d/3.testbed.sh";
my $FRISBEE = "$TB/sbin/frisbeelauncher";
my $tempfile = "/var/tmp/update.$$";
# Protos
......@@ -225,8 +225,7 @@ sub Restart()
}
if ($stopped) {
print "Starting up testbed daemons.\n";
system("$STARTUP start");
if ($?) {
if (system("$MFRISBEED start") || system("$STARTUP start")) {
print "*** Could not restart testbed daemons.\n";
exit(1);
}
......@@ -307,47 +306,12 @@ if ($stopbed) {
sleep(30);
}
print "** Testbed is quiet; stopping testbed daemons ... \n";
system("$STARTUP stop >/dev/null 2>&1");
if ($?) {
if (system("$STARTUP stop >/dev/null 2>&1") ||
system("$MFRISBEED stop >/dev/null 2>&1")) {
Fatal("Could not stop testbed daemons. Stopping.");
}
$stopped = 1;
#
# XXX cannot just call Image->ActiveImages as the implementation
# changed and thus the code would not work when upgrading from a
# code base with the old implementation to one with the new.
#
my $table = "images";
if (!emdb::DBSlotExists("images", "frisbee_pid")) {
$table = "frisbee_blobs";
}
my $query_result =
emdb::DBQueryWarn("select imageid from $table where frisbee_pid!=0");
my @activeimages = ();
if ($query_result) {
while (my ($imageid) = $query_result->fetchrow_array()) {
my $image = Image->Lookup($imageid);
if (!defined($image)) {
print STDERR
"*** Could not find DB object for image $imageid\n";
next;
}
push(@activeimages, $image);
}
}
if (@activeimages > 0) {
print "** Stopping running frisbee processes ...\n";
foreach my $image (@activeimages) {
my $imageid = $image->imageid();
print "-> Killing frisbee for $image ...\n";
system("$FRISBEE -k $imageid");
if ($?) {
Fatal("Could not stop frisbee for $image!");
}
}
}
print "** Testbed is stopped. Proceeding to update\n";
#
......
......@@ -13,6 +13,7 @@
* - record the state of running frisbeeds in persistant store so that
* they can be restarted if we die and restart
* - related: make sure we don't leave orphans when we die!
* - handle signals: INT/TERM should kill all frisbeeds and remove our pid
*/
#include <paths.h>
#include <sys/stat.h>
......@@ -82,7 +83,7 @@ main(int argc, char **argv)
MasterServerLogInit();
log("mfrisbee daemon starting, methods=%s (debug level %d)",
log("mfrisbeed daemon starting, methods=%s (debug level %d)",
GetMSMethods(onlymethods), debug);
if (fetchfromabove)
log(" using parent %s:%d%s, methods=%s",
......@@ -113,7 +114,7 @@ main(int argc, char **argv)
*/
if (!geteuid()) {
if (!pidfile) {
sprintf(buf, "%s/mfrisbee.pid", _PATH_VARRUN);
sprintf(buf, "%s/mfrisbeed.pid", _PATH_VARRUN);
pidfile = buf;
}
fp = fopen(pidfile, "w");
......
#!/bin/sh
# PROVIDE: mfrisbeed
# REQUIRE: mysql
# BEFORE: testbed
# KEYWORD: shutdown
#
# Start up the frisbee master server.
# We run it under the daemon wrapper if available so that it will get
# automatically restarted.
#
. /etc/rc.subr
bindir=@prefix@/sbin
if [ ! -x $bindir/mfrisbeed ]; then
echo "*** mfrisbeed.sh: $bindir/mfrisbeed not installed"
exit 1
fi
case "$1" in
start|faststart)
;;
restart)
if [ -f /var/run/mfrisbeed_wrapper.pid ]; then
kill `cat /var/run/mfrisbeed_wrapper.pid` >/dev/null 2>&1
rm -f /var/run/mfrisbeed_wrapper.pid
fi
if [ -f /var/run/mfrisbeed.pid ]; then
kill `cat /var/run/mfrisbeed.pid` >/dev/null 2>&1
rm -f /var/run/mfrisbeed.pid
fi
;;
stop)
echo -n ' mfrisbeed'
if [ -f /var/run/mfrisbeed_wrapper.pid ]; then
kill `cat /var/run/mfrisbeed_wrapper.pid` >/dev/null 2>&1
rm -f /var/run/mfrisbeed_wrapper.pid
fi
if [ -f /var/run/mfrisbeed.pid ]; then
kill `cat /var/run/mfrisbeed.pid` >/dev/null 2>&1
rm -f /var/run/mfrisbeed.pid
fi
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart}" >&2
exit 1
;;
esac
echo -n " mfrisbeed"
args="-C emulab"
# if an inner elab, use outer boss as our parent
if [ -n "@OUTERBOSS_NODENAME@" ]; then
args="$args -S @OUTERBOSS_NODENAME@"
fi
if [ -x @prefix@/sbin/daemon_wrapper ]; then
@prefix@/sbin/daemon_wrapper -i 30 -l @prefix@/log/mfrisbeed_wrapper.log \
@prefix@/sbin/mfrisbeed -d $args
else
@prefix@/sbin/mfrisbeed $args
fi
exit $?
......@@ -48,19 +48,10 @@ case "$1" in
if [ -x @prefix@/sbin/sslxmlrpc_server.py ]; then
echo -n " sslxmlrpc_server"
@prefix@/sbin/sslxmlrpc_server.py
@prefix@/sbin/sslxmlrpc_server.py 2>/dev/null
fi
if [ -x @prefix@/sbin/mfrisbeed ]; then
echo -n " mfrisbeed"
if [ -x @prefix@/sbin/daemon_wrapper ]; then
@prefix@/sbin/daemon_wrapper \
-i 30 -l @prefix@/log/mfrisbeed_wrapper.log \
@prefix@/sbin/mfrisbeed
else
@prefix@/sbin/mfrisbeed
fi
fi
# mfrisbeed started with its own script
if [ -x @prefix@/sbin/reload_daemon ]; then
echo -n " reloadd"
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
# For installation.
......@@ -17,7 +17,7 @@ SYSTEM := $(shell uname -s)
include $(OBJDIR)/Makeconf
RC_SCRIPTS = 2.mysql-server.sh 3.testbed.sh \
RC_SCRIPTS = 2.mysql-server.sh 3.mfrisbeed.sh 3.testbed.sh \
2.dhcpd.sh 1.mysql-client.sh
SUBBOSS_SCRIPTS = 2.dhcpd.sh
OPS_SCRIPTS = 3.and.sh 1.mysql-client.sh 1.mysql-server.sh
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -35,22 +35,19 @@ BIN_STUFF = power snmpit tbend tbprerun tbreport \
SBIN_STUFF = resetvlans console_setup.proxy sched_reload named_setup \
batch_daemon exports_setup reload_daemon sched_reserve \
console_reset db2ns bwconfig frisbeelauncher \
frisbeeimage rmgroup mkgroup setgroups mkproj modgroups \
console_reset db2ns bwconfig \
rmgroup mkgroup setgroups mkproj modgroups \
exports_setup.proxy vnode_setup eventsys_start \
sfskey_update sfskey_update.proxy rmuser idleswap \
newnode_reboot savelogs.proxy eventsys.proxy \
elabinelab snmpit.proxy panic node_attributes \
nfstrace plabinelab smbpasswd_setup smbpasswd_setup.proxy \
rmproj snmpit.proxynew snmpit.proxyv2 pool_daemon \
checknodes_daemon subboss_frisbeelauncher_wrapper \
subboss_wrapper
checknodes_daemon
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
......@@ -95,11 +92,10 @@ LIB_STUFF = libtbsetup.pm exitonwarn.pm libtestbed.pm snmpit_intel.pm \
# These scripts installed setuid, with sudo.
SETUID_BIN_SCRIPTS = node_reboot eventsys_control tarfiles_setup savelogs \
tbrsync
SETUID_SBIN_SCRIPTS = mkproj rmgroup mkgroup frisbeelauncher frisbeeimage \
SETUID_SBIN_SCRIPTS = mkproj rmgroup mkgroup \
rmuser idleswap named_setup exports_setup \
sfskey_update setgroups newnode_reboot vnode_setup \
elabinelab nfstrace rmproj subboss_frisbeelauncher_wrapper \
subboss_wrapper
elabinelab nfstrace rmproj
SETUID_LIBX_SCRIPTS = console_setup spewlogfile
ifeq ($(SYSTEM),FreeBSD)
......@@ -235,14 +231,6 @@ endif
chmod u+s $(INSTALL_SBINDIR)/rmgroup
chown root $(INSTALL_SBINDIR)/mkgroup
chmod u+s $(INSTALL_SBINDIR)/mkgroup
chown root $(INSTALL_SBINDIR)/frisbeelauncher
chmod u+s $(INSTALL_SBINDIR)/frisbeelauncher
chown root $(INSTALL_SBINDIR)/subboss_frisbeelauncher_wrapper
chmod u+s $(INSTALL_SBINDIR)/subboss_frisbeelauncher_wrapper
chown root $(INSTALL_SBINDIR)/subboss_wrapper
chmod u+s $(INSTALL_SBINDIR)/subboss_wrapper
chown root $(INSTALL_SBINDIR)/frisbeeimage
chmod u+s $(INSTALL_SBINDIR)/frisbeeimage
chown root $(INSTALL_SBINDIR)/rmuser
chmod u+s $(INSTALL_SBINDIR)/rmuser
chown root $(INSTALL_SBINDIR)/idleswap
......@@ -278,11 +266,6 @@ 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\n";
exit(-1);
}
my $optlist = "d";
my $debug = 1;
#
# Configure variables
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $ELABINELAB = @ELABINELAB@;
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");
}
if (!$ELABINELAB) {
die("This script is for elabinelab systems only!\n");
}
# Load the Testbed support stuff.
use lib "@prefix@/lib";
use libdb;
use libtestbed;
use libxmlrpc;
use libtblog;
use Image;
# 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) = @ARGV;
#
# Untaint the arguments.
#
if ($imageid =~ /^([-\@\w\+\.]+)$/) {
$imageid = $1;
}
else {
die("Tainted argument $imageid!\n");
}
my $image = Image->Lookup($imageid);
if (!defined($image)) {
tbdie("No such imageid: $imageid!");
}
#
# Grab mcastif. This is has been set up for us, and its a serious kludge.
#
if (! -e "/etc/emulab/outer_ipaddr") {
tbdie("/etc/emulab/outer_ipaddr does not exist!");
}
$mcastif = `cat /etc/emulab/outer_ipaddr`;
chomp($mcastif);
if ($mcastif =~ /^([\d\.]+)$/) {
$mcastif = $1;
}
else {
tbdie("Could not parse outer IP: $mcastif!");
}
#
# Grab image path.
#
my $filename = $image->path();
#
# 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("elabinelab", "frisbeelauncher",
{"imageid" => "$imageid"});
if (!defined($rval)) {
die("Could not fire up frisbee on outer Emulab!");
}
#
# 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 {
tbdie("Could not parse loadinfo from server: $rval!");
}
if ($debug) {
print "$FRISBEE -N -i $mcastif -m $loadaddr -p $loadport $filename\n";
}
$SIG{HUP} = $SIG{INT} = $SIG{TERM} = \&cleanup;
system("$FRISBEE -N -i $mcastif -m $loadaddr -p $loadport $filename");
if ($?) {
tbdie("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.
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
# Osload library. Basically the backend to the osload script, but also used
......@@ -44,8 +44,6 @@ my $PROJROOT = "@PROJROOT_DIR@";
my $MAXRETRIES = 1;
my $OUTERBOSS = "@OUTERBOSS_NODENAME@";
my $FRISBEELAUNCHER = "$TB/sbin/frisbeelauncher";
my $SUBBOSS_FRISBEELAUNCHER = "$TB/sbin/subboss_frisbeelauncher_wrapper";
my $osselect = "$TB/bin/os_select";
my $TBUISP = "$TB/bin/tbuisp";
......@@ -475,7 +473,6 @@ sub osload ($$) {
my $class = $nodeobject->class();
my $isremote = $nodeobject->isremotenode();
my $isvirtnode = $nodeobject->isvirtnode();
my $subboss;
my $reload_mode;
my $reload_func;
my $reboot_required;
......@@ -489,7 +486,6 @@ sub osload ($$) {
$reload_mode = "Frisbee";
$reload_func = \&SetupReloadFrisbee;
$reboot_required = !$noreboot; # Reboot unless $noreboot flag set
$nodeobject->GetSubboss('frisbee', \$subboss);
if (defined($nodeflags{$node})
&& defined($nodeflags{$node}{'noreboot'})) {
......@@ -531,7 +527,6 @@ sub osload ($$) {
'zerofree' => $zerofree,
'prepare' => $prepare,
'maxwait' => $maxwait,
'subboss' => $subboss,
'isremote' => $isremote,
'isvirtnode' => $isvirtnode
};
......@@ -797,17 +792,17 @@ sub GetImageInfo($;$)
}
} else {
$imagesize = stat($imagepath)->size;
}
#
# A zero-length image cannot be right and will result in much confusion
# if allowed to pass: the image load will succeed, but the disk will be
# unchanged, making it appear that os_load loaded the default image.
#
if ($imagesize == 0) {
tberror "$imagepath is empty!";
$imageinfo{$imageid} = 'BADIMAGE';
return 0;
}
#
# A zero-length image cannot be right and will result in much confusion
# if allowed to pass: the image load will succeed, but the disk will be
# unchanged, making it appear that os_load loaded the default image.
#
if ($imagesize == 0) {
tberror "$imagepath is empty!";
$imageinfo{$imageid} = 'BADIMAGE';
return 0;
}
#
......@@ -1015,7 +1010,6 @@ sub SetupReloadFrisbee($)
my $zerofree = $reload_info->{'zerofree'};
my $prepare = $reload_info->{'prepare'};
my $isvirtnode = $reload_info->{'isvirtnode'};
my $subboss = $reload_info->{'