Commit 9aa6b5ca authored by Leigh Stoller's avatar Leigh Stoller

The bulk of the event system changes.

* The per-experiment event scheduler now runs on ops instead of boss.
  Boss still runs elvind and uses events internally, but the user part
  of the event system has moved.

* Part of the guts of eventsys_control moved to new script, eventsys.proxy,
  which runs on ops and fires off the event scheduler. The only tricky part
  of this is that the scheduler runs as the user, but killing it has to be
  done as root since a different person might swap out the experiment. So,
  the proxy is a perl wrapper invoked from a root ssh from boss, which
  forks, writes the pid file into /var/run/emulab/evsched/$pid_$eid.pid,
  then flips to the user and execs the event scheduler (which is careful
  not to fork). Obviously, if the kill is done as root, the pid file has to
  be stored someplace the user is not allowed to write.

* The event scheduler has been rewritten to use Tim's C++ interface to the
  sshxmlrpc server on boss. Actually, I reorg'ed the scheduler so that it
  can be built either as a mysql client, or as RPC client. Note that it can
  also be built to use the SSL version of the XMLRPC server, but that will
  not go live until I finish the server stuff up. Also some goo for dealing
  with building the scheduler with C++.

* Changes to several makefiles to install the ops binaries over NFS to
  /usr/testbed/opsdir. Makes life easier, but only if boss and ops are
  running the same OS. For now, using static linking on the event scheduler
  until ops upgraded to same rev as boss.

* All of the event clients got little tweaks for dealing with the new CNAME
  for the event system server (event-sever). Will need to build new images
  at some point. Old images and clients will continue to work cause of an
  inetd hack on boss that uses netcat to transparently redirect elvind
  connections to ops.

* Note that eventdebug needs some explaining. In order to make the inetd
  redirect work, elvind cannot be listening on the standard port. So, the
  boss event system uses an alternate port since there are just a few
  subsystems on boss that use the server, and its easy to propogate changes
  on boss. Anyway, the default for eventdebug is to connect to the standard
  port on localhost, which means it will work as expected on ops, but will
  require -b argument on boss.

* Linktest changes were slightly more involved. No longer run linktest on
  boss when called from the experiment swapin path, but ssh over to ops to
  fire it off. This is done as the user of course, and there are some
  tricks to make it possible to kill a running linktest and its ssh when
  experiment swapin is canceled (or from the command line) by forcing
  allocation of a tty. I will probably revisit this at some point, but I
  did not want to spend a bunch of time on linktest.

* The upgrade path detailed in doc/UPDATING is necessarily complicated and
  bound to cause consternation at remote sites doing an upgrade.
parent a239e6ec
......@@ -1099,7 +1099,7 @@ if test -z "$THISHOMEBASE"; then
THISHOMEBASE="Emulab.Net"
fi
if test -z "$EVENTSERVER"; then
EVENTSERVER="$BOSSNODE"
EVENTSERVER="event-server"
fi
cat >> confdefs.h <<EOF
#define EVENTSERVER "$EVENTSERVER"
......@@ -1249,6 +1249,7 @@ if test "$enable_events" = "no"; then
else
eventfiles="event/GNUmakefile event/lib/GNUmakefile \
event/etc/elvind-boss.conf event/etc/elvind-ops.conf \
event/etc/elvind-inetd.conf event/etc/GNUmakefile\
event/sched/GNUmakefile event/test/GNUmakefile \
event/tbgen/GNUmakefile \
event/example/GNUmakefile event/example/tbsend.pl \
......
......@@ -243,7 +243,7 @@ if test -z "$THISHOMEBASE"; then
THISHOMEBASE="Emulab.Net"
fi
if test -z "$EVENTSERVER"; then
EVENTSERVER="$BOSSNODE"
EVENTSERVER="event-server"
fi
AC_DEFINE_UNQUOTED(EVENTSERVER, "$EVENTSERVER")
......@@ -358,6 +358,7 @@ if test "$enable_events" = "no"; then
else
eventfiles="event/GNUmakefile event/lib/GNUmakefile \
event/etc/elvind-boss.conf event/etc/elvind-ops.conf \
event/etc/elvind-inetd.conf event/etc/GNUmakefile\
event/sched/GNUmakefile event/test/GNUmakefile \
event/tbgen/GNUmakefile \
event/example/GNUmakefile event/example/tbsend.pl \
......
......@@ -6,6 +6,124 @@ This file is in the same format at the FreeBSD UPDATING file, whis is
to say, in reverse chronological order, with the date of the change
in YYYYMMDD format.
20040816:
The event system has moved to users.emulab.net.
* Install the elvin libraries and daemon on users.emulab.net.
* Pick up this package:
http://boss.emulab.net/downloads/ulsshxmlrpcpp-0.1.0.tar.gz
cd /someplace
tar zxf ulsshxmlrpcpp-0.1.0.tar.gz
cd ulsshxmlrpcpp-0.1.0
configure
gmake
sudo gmake install
* Reconfig, rebuild, and reinstall the testbed software on your
boss node.
* Reconfig, rebuild, and reinstall the testbed software on your
users node.
ssh users
cd /your/object/tree/obj/
gmake
gmake control-install
cd /your/object/tree/obj/event/etc
sudo gmake control-install
* Install the new elvind config file on boss and restart elvind
Note that this is not done as part of toplevel install.
cd /your/object/tree/obj/event/etc
sudo gmake install
sudo /usr/local/etc/rc.d/2.elvind.sh stop
sudo /usr/local/etc/rc.d/2.elvind.sh start
* Restart tmcd and stated on boss (note that if you plan to just
reboot boss, a lot of these steps can be skipped).
sudo /usr/testbed/sbin/tmcd.restart
sudo kill -USR1 `cat /var/run/stated.pid`
* Install the elvind config file on users.
Note that this is not done as part of toplevel install.
ssh users
cd /your/object/tree/obj/event/etc
sudo gmake control-install
* Install new rc.d file on boss.
Note that this is not done as part of toplevel install.
cd /your/object/tree/obj/rc.d
sudo gmake install
* Install the rc.d file that starts elvind on users.
Note that this is not done as part of toplevel install.
ssh users
cd /your/object/tree/obj/rc.d
sudo gmake control-install
* Start the elvin server on users.emulab.net:
ssh users
sudo /usr/local/etc/rc.d/2.elvind.sh
* Create the ops certificate (on boss) and copy it to your users node.
cd /your/object/tree/obj/ssl
gmake ctrlnode.pem
sudo scp ctrlnode.pem users:/etc/emulab/client.pem
sudo ssh users chmod 600 /etc/emulab/client.pem
sudo scp emulab.pem users:/etc/emulab
* Install the tmcd client stuff on users.emulab.net.
ssh users.emulab.net
cd /your/object/tree/obj/tmcd/freebsd
sudo gmake control-install
* Create the emulab-ops/opsnode experiment. Do this the same way
that hwdown is created in setup-db.txt.
* Create a node_types entry for ops. This is mostly just a stub
entry so that tmcd will recognize it and so that other parts of
the system are happy. Be sure that you get the interface correct,
and set the Default OSID to emulab-ops/OPSNODE-BSD. The type is
ops and the class is misc.
* Create the ops node nodes table entry ...
* Place the ops node into the above experiment:
wap nalloc emulab-ops opsnode ops
* Make sure that netcat is installed.
cd /usr/ports/net/netcat
sudo make
sudo make install
* Add entry to /etc/services for elvin:
elvin 2917/tcp
* Change the CNAME event-server to your zone file from boss to ops.
event-server IN CNAME ops
* Start the alternate inetd service so that old images trying to
connect to the event server are redirected to users.emulab.net.
Be sure to replace boss.foo.bar with the right name.
sudo inetd -a boss.foo.bar -p /var/run/testbed-inetd.pid \
/usr/testbed/etc/inetd.conf
20040815:
After some changes to ptopgen, you'll need to run the following SQL
command to keep vnodes working properly:
......
......@@ -19,7 +19,7 @@ ifeq ($(SYSTEM),FreeBSD)
SUBDIRS += sched delay-agent nsetrafgen stated
endif
all: trafgen-fetch all-subdirs
all: etc-subdir trafgen-fetch all-subdirs
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -29,6 +29,9 @@ include $(TESTBED_SRCDIR)/GNUmakerules
trafgen-fetch:
$(SRCDIR)/trafgen/tg-install $(SRCDIR)/trafgen
etc-subdir:
@$(MAKE) -C etc all
install:
@$(MAKE) -C lib install
@$(MAKE) -C sched install
......@@ -42,6 +45,8 @@ client-install: client client-install-subdirs
control-install:
@$(MAKE) -C lib control-install
@$(MAKE) -C tbgen control-install
@$(MAKE) -C sched control-install
@$(MAKE) -C linktest install
clean: clean-subdirs
distclean: distclean-subdirs
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -70,7 +70,7 @@ char buf_link [MAX_LINKS][MAX_LINE_LENGTH];
int main(int argc, char **argv)
{
char c;
char *server = NULL;
char *server = "localhost";
char * port = NULL;
char *map_file = NULL;
char *log_file = "/tmp/agentlog";
......
......@@ -15,18 +15,19 @@ use Getopt::Std;
use strict;
sub usage {
warn "Usage: $0 [-s server] [-p port] <event>\n";
warn "Usage: $0 [-b] [-s server] [-p port] <event>\n";
return 1;
}
my %opt = ();
getopt("s:p:h", \%opt);
getopt("s:p:hb", \%opt);
if ($opt{h}) { exit &usage; }
if (@ARGV) { exit &usage; }
my ($server,$port);
if ($opt{s}) { $server = $opt{s}; } else { $server = "boss"; }
if ($opt{s}) { $server = $opt{s}; } else { $server = "localhost"; }
if ($opt{b}) { $port = @BOSSEVENTPORT@ ; }
if ($opt{p}) { $port = $opt{p}; }
my $URL = "elvin://$server";
......
......@@ -26,7 +26,7 @@ if ($opt{h}) { exit &usage; }
if (@ARGV) { exit &usage; }
my ($server,$port);
if ($opt{s}) { $server = $opt{s}; } else { $server = "boss"; }
if ($opt{s}) { $server = $opt{s}; } else { $server = "localhost"; }
if ($opt{p}) { $port = $opt{p}; }
my $URL = "elvin://$server";
......
......@@ -25,7 +25,7 @@ if ($opt{h}) { exit &usage; }
if (@ARGV != 1) { exit &usage; }
my ($server,$port);
if ($opt{s}) { $server = $opt{s}; } else { $server = "boss"; }
if ($opt{s}) { $server = $opt{s}; } else { $server = "localhost"; }
if ($opt{p}) { $port = $opt{p}; }
my $URL = "elvin://$server";
......
......@@ -106,9 +106,10 @@ _tbevent.so: event.o event_wrap_py.o util.o
LIB_STUFF = event.pm event.so tbevent.py _tbevent.so
install: $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF))
install: $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF)) \
$(addprefix $(INSTALL_DIR)/opsdir/lib/, $(LIB_STUFF))
control-install: install
control-install: $(addprefix $(INSTALL_LIBDIR)/, $(LIB_STUFF))
#
# Right now we don't bother with the dynamic libs since all of the existing
......@@ -129,3 +130,8 @@ client-libinstall:
clean:
/bin/rm -f *.o libevent.a libevent_r.a *.so *.py swig-pywrappers
$(INSTALL_DIR)/opsdir/lib/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/lib
$(INSTALL) $< $@
......@@ -85,7 +85,9 @@ install:
$(INSTALL_PROGRAM) $(SCRIPT_CONTROL) $(INSTALL_SBINDIR)
$(INSTALL_DATA) $(SRCDIR)/linktest.html $(INSTALL_WWWDIR)/doc
control-install: install
control-install:
$(INSTALL_PROGRAM) $(LOCAL_BINDIR)/$(LTEVENT) $(INSTALL_LIBEXECDIR)
$(INSTALL_PROGRAM) $(SCRIPT_RUN) $(INSTALL_BINDIR)
client: all
client-install: client
......
......@@ -50,6 +50,7 @@ use constant PATH_PATHRATE_RCV => "/usr/local/bin/pathrate_rcv";
use constant PATH_EMULAB_SYNC => "@CLIENT_BINDIR@/emulab-sync";
use constant PATH_LTEVENT => "@CLIENT_BINDIR@/ltevent";
use constant RUN_PATH => "@CLIENT_BINDIR@"; # where the linktest-ns runs.
use constant EVENTSERVER => "@EVENTSERVER@";
# log files used by tests.
use constant CRUDE_DAT => "/tmp/crude.dat"; # binary data
......@@ -140,7 +141,6 @@ my $debug_level = 0; # enable debug statements
# 1 = print debug statements.
# 2 = show STDOUT and STDERR
my $barr_count; # used by synserv host, nubmer of hosts -1
my $event_server; # event server
my $log_file; # common logfile for information saved over time.
my @hosts; # hosts: list of text strings containing host names.
......@@ -232,16 +232,6 @@ die("Could not locate an emulab-sync server\n") unless -e $ssname;
($synserv) = split/\./, $results[0];
chomp $synserv;
#
# Execute tmcc to find out the name of the event server.
#
@results = &my_tick("@CLIENT_BINDIR@/tmcc","bossinfo");
if(@results && $results[0] =~ /^([\w\.]*)\s/) {
$event_server = $1;
} else {
die("Could not determine event server name\n");
}
#
# If the current node is the special node (arbitrarily the sync
# server node), do some housekeeping and run ns to generate
......@@ -931,7 +921,6 @@ sub get_topo {
# prints out the topology read in from the NS file
sub debug_top {
&debug("ns script: $ns_file\n");
&debug("event server: $event_server\n");
&debug("nodes:\n");
foreach my $vert (@hosts) {
&debug( " " . $vert . "\n");
......@@ -1102,7 +1091,7 @@ sub post_event {
if($hostname eq $synserv) {
system(PATH_LTEVENT,
"-s",
$event_server,
EVENTSERVER,
"-e",
"$proj_id/$exp_id",
"-k",
......
......@@ -17,17 +17,19 @@ use POSIX;
#
sub usage()
{
print("Usage: linktest_control [-d] [-k | -l <level>] [-o <file>] ".
"<pid> <eid>\n".
print("Usage: linktest_control [-d] [-t timeout] [-k | -l <level>] ".
"[-o <file>] <pid> <eid>\n".
"-l - Run linktest at a specific level; defaults to DB value.\n".
"-k - Kill a currently running linktest.\n".
"-t - Specify timeout in seconds.\n".
"-o - Specify output file for linktest results.\n".
"-d - Turn on debugging output.\n");
exit(-1);
}
my $optlist = "dkl:o:";
my $optlist = "dkl:o:t:";
my $debug = 0;
my $cancel = 0;
my $timeout;
my $level;
my $output;
my $child_pid; # Child run_linktest process.
......@@ -37,6 +39,8 @@ my $child_pid; # Child run_linktest process.
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $CONTROL = "@USERNODE@";
my $SSH = "$TB/bin/sshtb";
#
# Testbed Support libraries
......@@ -68,6 +72,16 @@ if (defined($options{"d"})) {
if (defined($options{"k"})) {
$cancel = 1;
}
if (defined($options{"t"})) {
$timeout = $options{"t"};
if ($timeout =~ /^(\d*)$/) {
$timeout = $1;
}
else {
die("Bad data in timeout: $timeout");
}
}
if (defined($options{"l"})) {
$level = $options{"l"};
......@@ -209,12 +223,23 @@ if ($child_pid) {
}
#
# Child execs run_linktest.
# Child execs an ssh to users.emulab.net where linktest is actually run.
# We tell ssh to allocate a tty so that we can kill it with TERM and have
# everything die off properly.
#
exec "$TB/bin/run_linktest.pl",
("-d", $debug, "-v"),
(defined($output) ? ("-o", $output) : ()),
("-l", (defined($level) ? $level : $linktest_level), "-e", "$pid/$eid");
my $cmd = "$SSH -t -host $CONTROL $TB/bin/run_linktest.pl -v";
$cmd .= " -d $debug"
if ($debug);
$cmd .= " -t $timeout"
if (defined($timeout));
$cmd .= " -o $output"
if (defined($output));
$cmd .= " -l " . (defined($level) ? $level : $linktest_level);
$cmd .= " -s ops -e $pid/$eid";
print "Running '$cmd'\n"
if ($debug);
exec($cmd);
die("*** $0:\n".
" Could not exec run_linktest.pl\n");
......@@ -12,9 +12,7 @@ use POSIX;
#
# Wrapper for running the linktest daemon. This script is currently
# setup so it can run on either boss (or ops via plasticwrap), or from
# an experimental node. Hence the odd paths and ltevent aux program,
# which is not really on boss. Also not use of tmcc to find the server.
# setup so it can run on either ops or from an experimental node.
#
sub usage()
{
......@@ -44,8 +42,7 @@ my $stopAt = 4 ; # default stop level
my $TB = "@prefix@";
my $TMCC = "@CLIENT_BINDIR@/tmcc";
my $LTEVENT = "@CLIENT_BINDIR@/ltevent";
my $LTEVENTBOSS = "$TB/libexec/ltevent";
my $BOSSNODE = "@BOSSNODE@";
my $LTEVENTOPS = "$TB/libexec/ltevent";
my $STOPEVENT = "STOP";
my $KILLEVENT = "KILL";
my $REPORTEVENT = "REPORT";
......@@ -182,24 +179,10 @@ else {
#
# Need to figure out the elvind server. Since this script runs on boss
# and on experimental nodes, do something gross!
# Default to the standard event server.
#
if (!defined($server)) {
if (-x $TMCC) {
my $results = `$TMCC bossinfo`;
if ($results =~ /^([\w\.]*)\s/) {
$server = $1;
}
else {
die("*** $0:\n".
" Bad data in server: $results\n");
}
}
else {
# We can do this on boss/ops, but not on experimental node.
$server = $BOSSNODE;
}
$server = "@EVENTSERVER@";
}
#
......@@ -352,6 +335,9 @@ sub analyze {
@dir_contents = grep(/\.fatal$|\.error$/, readdir(DIR));
closedir(DIR);
unlink($logfile)
if (defined($logfile));
foreach my $file (@dir_contents) {
# Hmm, need to taint check the filenames. Ick.
if ($file =~ /^([-\w\.\/]+)$/) {
......@@ -361,7 +347,7 @@ sub analyze {
die("*** $0:\n".
" Bad data in filename: $file\n");
}
if(defined($options{"o"})) {
if (defined($logfile)) {
open LOG_FILE, ">>$logfile" ||
die "Could not open $logfile for append: $!";
......@@ -383,8 +369,8 @@ sub analyze {
sub starter {
my $cmd;
if (-x $LTEVENTBOSS) {
$cmd = $LTEVENTBOSS;
if (-x $LTEVENTOPS) {
$cmd = $LTEVENTOPS;
}
else {
$cmd = $LTEVENT;
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -10,6 +10,7 @@ global CLIENTVARDIR
global CLIENTBINDIR
set CLIENTVARDIR @CLIENT_VARDIR@
set CLIENTBINDIR @CLIENT_BINDIR@
set EVENTSERVER @EVENTSERVER@
# consults tmcc hostnames database to translate hostname to IP
# returns ip address of name
......@@ -443,13 +444,13 @@ set eid [lindex $pideidlist 1]
set pid [lindex $pideidlist 2]
set logpath "/proj/$pid/exp/$eid/logs/nse-$vnode.log"
set simobjname [$ns set tbname]
set nseswap_cmdline "$CLIENTBINDIR/tevc -s $boss -e $pid/$eid now $simobjname NSESWAP SIMHOST=$vnode"
set nseswap_cmdline "$CLIENTBINDIR/tevc < -s $EVENTSERVER -e $pid/$eid now $simobjname NSESWAP SIMHOST=$vnode"
set pktrate_logpath "/proj/$pid/exp/$eid/logs/nse-vnodepktrate-$vnode.log"
# Configuring the Scheduler to monitor the event system
set evsink [new TbEventSink]
$evsink event-server "elvin://$boss"
$evsink event-server "elvin://$EVENTSERVER"
$evsink nseswap_cmdline $nseswap_cmdline
$evsink logfile $logpath
[$ns set scheduler_] tbevent-sink $evsink
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -64,7 +64,7 @@ main(int argc, char **argv)
event_handle_t handle;
address_tuple_t tuple;
char *progname;
char *server = NULL;
char *server = "localhost";
char *port = NULL;
char *logfile = NULL;
char *pidfile = NULL;
......
......@@ -103,12 +103,12 @@ main(int argc, char **argv)
strcpy(ipaddr, inet_ntoa(myip));
/*
* If server is not specified, then it defaults to BOSSNODE.
* If server is not specified, then it defaults to EVENTSERVER.
* This allows the client to work on either users.emulab.net
* or on a client node.
*/
if (!server)
server = BOSSNODE;
server = EVENTSERVER;
/*
* Convert server/port to elvin thing.
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2003 University of Utah and the Flux Group.
* Copyright (c) 2003, 2004 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -102,12 +102,12 @@ main(int argc, char **argv)
memcpy((char *)&myip, he->h_addr, he->h_length);
/*
* If server is not specified, then it defaults to BOSSNODE.
* If server is not specified, then it defaults to EVENTSERVER.
* This allows the client to work on either users.emulab.net
* or on a client node.
*/
if (!server)
server = BOSSNODE;
server = EVENTSERVER;
if (! (he = gethostbyname(server))) {
fatal("could not get IP address for server: %s", server);
......
......@@ -137,12 +137,12 @@ main(int argc, char **argv)
}
/*
* If server is not specified, then it defaults to BOSSNODE.
* If server is not specified, then it defaults to localhost.
* This allows the client to work on either users.emulab.net
* or on a client node.
*/
if (!server)
server = BOSSNODE;
server = "localhost";
/*
* Convert server/port to elvin thing.
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2003 University of Utah and the Flux Group.
* Copyright (c) 2003, 2004 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -38,7 +38,7 @@ main(int argc, char **argv)
{
event_handle_t handle;
address_tuple_t tuple;
char *server = NULL;
char *server = "localhost";
char *port = NULL;
char buf[BUFSIZ];
int c;
......
......@@ -11,19 +11,24 @@ SUBDIR = event/sched
include $(OBJDIR)/Makeconf
all: event-sched
all: event-sched event-sched_rpc
include $(TESTBED_SRCDIR)/GNUmakerules
CFLAGS += -pthread
CFLAGS += -pthread -DBINDIR='"$(INSTALL_BINDIR)"'
#CFLAGS += -DDEBUG
CFLAGS += -O -g -Wall
CFLAGS += -O -Wall
CFLAGS += -I. -I${OBJDIR} -I$(SRCDIR)/../lib -I$(TESTBED_SRCDIR)/lib/libtb
CFLAGS += `elvin-config --cflags vin4mt`
LDFLAGS += -pthread -static
LDFLAGS += -pthread
LDFLAGS += -L../lib -L${OBJDIR}/lib/libtb
LIBS += -levent_r -ltb -lcipher -L/usr/local/lib/mysql -lmysqlclient -lz
DBLIBS = -L/usr/local/lib/mysql -lmysqlclient -lz
LIBS += -levent_r -ltb -lcipher -lz
ULXRINC = -I/usr/local/include -I/usr/local/include/ulxmlrpcpp
CXXFLAGS += -pthread -O $(ULXRINC)
ULXRLIBS = -L/usr/local/lib -lulsshxmlrpcpp -lulxmlrpcpp -lexpat
#
# XXX elvin-config adds -lc which is rather bogus, and messes up -pthread
......@@ -33,18 +38,44 @@ LIBS += -levent_r -ltb -lcipher -L/usr/local/lib/mysql -lmysqlclient -lz
#LIBS += `elvin-config --libs vin4mt`
LIBS += -L/usr/local/lib -lvin4mt -lvin4c -lvin4 -lssl -lcrypto -lm
OBJS = event-sched.o queue.o
OBJS = event-sched.o
event-sched: event-sched.c queue.o event-sched.h ../lib/libevent.a
$(CC) $(CFLAGS) -DDBIFACE=1 $(LDFLAGS) -o $@ $< queue.o $(LIBS) $(DBLIBS)
event-sched_rpc: event-sched_rpc.o rpc.o queue.o event-sched.h \
../lib/libevent.a
$(CXX) $(CFLAGS) -static $(LDFLAGS) -o $@ event-sched_rpc.o \
rpc.o queue.o $(ULXRLIBS) $(LIBS)
event-sched: $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
event-sched_rrpc: event-sched_rpc.o rrpc.o queue.o event-sched.h \
../lib/libevent.a
$(CXX) $(CFLAGS) $(LDFLAGS) -o $@ event-sched_rpc.o \
rrpc.o queue.o $(ULXRLIBS) $(LIBS)
$(OBJS): event-sched.h ../lib/libevent.a
queue.o: event-sched.h
event-sched_rpc.o: event-sched.c event-sched.h rpc.h
$(CC) $(CFLAGS) -DRPC -c -o $@ $<
rpc.o: rpc.cc rpc.h
$(CXX) $(CXXFLAGS) -DSSHRPC $(ULXRINC) -c $<
install: $(addprefix $(INSTALL_SBINDIR)/, event-sched)
rrpc.o: rpc.cc rpc.h
$(CXX) $(CXXFLAGS) -DSSLRPC $(ULXRINC) -c -o rrpc.o $<
install:
$(INSTALL_PROGRAM) event-sched_rpc $(INSTALL_DIR)/opsdir/sbin/event-sched
control-install:
$(INSTALL_PROGRAM) event-sched_rpc $(INSTALL_SBINDIR)/event-sched
# not a client thing
client:
client-install: client
clean:
/bin/rm -f *.o event-sched
/bin/rm -f *.o event-sched event-sched_rpc event-sched_rrpc
$(INSTALL_DIR)/opsdir/bin/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/lib
$(INSTALL) $< $@
This diff is collapsed.
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2004 University of Utah and the Flux Group.
* All rights reserved.
*/
#include "rpc.h"
#define ULXR_INCLUDE_SSL_STUFF
#include <ulxmlrpcpp.h> // always first header
#include <iostream>
#include <ulxr_tcpip_connection.h> // first, don't move: msvc #include bug
#include <ulxr_ssl_connection.h>
#include <ulxr_http_protocol.h>
#include <ulxr_requester.h>
#include <ulxr_value.h>
#include <ulxr_except.h>
#include <emulab_proxy.h>
#ifdef SSHRPC
#include <ulxr_ssh_connection.h>
#include <ulxr_rfc822_protocol.h>
#endif
//
// It would be too much work to compile the event scheduler proper
// with the c++ compiler (cause main needs to be compiled with c++).
// This is just a stub that calls the realmain in event-sched.c
//
extern "C" int realmain(int argc, char **argv);
int
main(int argc, char **argv)
{
return realmain(argc, argv);
}
/*
* Simply save the stuff we need for making the connections later.
*/
static char *CERTPATH;
static char *PATH;
static char *HOST = "localhost";
static int PORT = 3069;
int RPC_init(char *certpath, char *host, int port)
{
printf("%s %s %d\n", certpath, host, port);
#ifdef SSHRPC
PATH = "xmlrpc";
#else
if (certpath)
CERTPATH = strdup(certpath);
else
CERTPATH = "/usr/testbed/etc/client.pem";
#endif
HOST = strdup(host);
PORT = port;
return 0;
}
/*
* Contact the server and invoke the method. All of the methods we care
* about using return a string, which we return to the caller after
* making a copy. Might change this at some point to use real structures
* once I have the SSL server running. The reason for strings was that
* the first version used the external SSH XMLRPC client, and it was easier
* to have it dump plain strings to stdout.
*/
static int
RPC_invoke(char *pid, char *eid, char *method, emulab::EmulabResponse *er)