Commit 26c4153c authored by Mike Hibler's avatar Mike Hibler

Nuke the special planetlab pa-wrapper.

parent e3c90cb9
......@@ -30,7 +30,6 @@ my $WRAPLOG = "$LOGDIR/progwrap.debug";
my $PIDFILE = "/var/run/progagent.pid";
my $CONFIG = "$BOOTDIR/progagents";
my $PAGENT = "$BINDIR/program-agent";
my $PAWRAPPER = "$BINDIR/pa-wrapper";
#
# Load the OS independent support library. It will load the OS dependent
......@@ -184,26 +183,48 @@ sub doboot()
print "Starting Program Agent ...\n";
#
# PlanetLab nodes don't have a fixed elvind port, so we need to
# look that up and pass it in. Also for plab, we always restart
# a dead program-agent, regardless of the cause.
#
if (PLAB()) {
system("$PAWRAPPER $PAGENT -e $pid/$eid -s localhost -l $LOGFILE ".
"-d -i $PIDFILE -k " . TMEVENTKEY() . " -c $CONFIG");
# pa-wrapper already does what the loop above does.
exit($? >> 8);
my $elvind_port;
if (tmcc(TMCCCMD_PLABCONFIG, undef, \@tmccresults) < 0) {
# this failure does happen...
warning("Could not get plabconfig from server, ".
"waiting awhile and trying again...");
sleep(5);
next;
}
if ($tmccresults[0] =~ /ELVIND_PORT=(\d+)/) {
$elvind_port = $1;
}
else {
# this failure should not happen
fatal("invalid format for plabconfig info");
}
system("$PAGENT -e $pid/$eid -s localhost -l $LOGFILE ".
"-d -i $PIDFILE -k " . TMEVENTKEY() . " -c $CONFIG ".
"-r -p $elvind_port");
}
else {
system("$PAGENT -e $pid/$eid -s localhost -l $LOGFILE ".
"-d -i $PIDFILE -k " . TMEVENTKEY() . " -c $CONFIG");
}
exit(0)
if (! $?);
# Like the magic exit code? This means the agent was told by boss
# to exit so that we can regen the config file and then restart.
# There is most certainly a better way to do this.
if ($? >> 8 != 45) {
fatal("program agent exited with non-zero status: $?");
exit(0)
if (! $?);
# Like the magic exit code? This means the agent was told by boss
# to exit so that we can regen the config file and then restart.
# There is most certainly a better way to do this.
if ($? >> 8 != 45) {
fatal("program agent exited with non-zero status: $?");
}
}
print "Program Agent died ($?), restarting...\n";
#
# We want to restart, go around the loop again. Turn the cache off.
#
......
......@@ -14,7 +14,7 @@ COMSCRIPTS = $(addprefix $(TESTBED_SRCDIR)/tmcd/common/, \
libtmcc.pm libsetup.pm libtestbed.pm startcmddone)
LINSCRIPTS = $(TESTBED_SRCDIR)/tmcd/linux/liblocsetup.pm
PLABSCRIPTS = $(addprefix $(TESTBED_SRCDIR)/tmcd/plab/, \
rc.inplab plabrusage pa-wrapper runelvin)
rc.inplab plabrusage runelvin)
OSSCRIPTS = $(addprefix $(TESTBED_SRCDIR)/os/, \
install-tarfile install-rpm)
EVSCRIPTS = $(addprefix $(TESTBED_SRCDIR)/event/lib/, \
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
use POSIX qw(setsid);
#
# This script is a wrapper around the program-agent to handle
# the runtime knowledge of elvind port on local node
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
# Plab setup slightly different than Jail setup. libsetup already knows
# our vnodeid, and has configured the tmcc library with that info as well.
#
use libsetup;
use libtmcc;
sub daemonize;
daemonize;
# build Agent cmdline
$AGENT = "";
foreach $num (0 .. $#ARGV) {
$AGENT .= $ARGV[$num]." ";
}
for(;;) {
# make a call to TMCC for elvind port
my @tmccresults;
my %tmccoptions = ("nocache" => 1);
if (tmcc(TMCCCMD_PLABCONFIG, undef, \@tmccresults, %tmccoptions) < 0) {
#fatal("Could not get plabconfig from server!");
sleep 5;
next;
}
$plabconfig = $tmccresults[0];
if ($plabconfig =~ /ELVIND_PORT=(\d+)/) {
my $elvind_port = $1;
# call the actual agent
system("$AGENT -r -p $elvind_port");
}
sleep 5;
}
sub daemonize {
chdir '/' or die "Can't chdir to /: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
open STDOUT, '>>/dev/null' or die "Can't write to /dev/null: $!";
open STDERR, '>>/dev/null' or die "Can't write to /dev/null: $!";
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
umask 0;
}
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