Commit e06abe8a authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 546982a0 98ed9445
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved.
#
package emdb;
use strict;
use File::Basename;
use English;
use Carp;
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = "Exporter";
......@@ -66,7 +67,8 @@ sub DBError($$;$)
if (! defined($nomail)) {
libtestbed::SENDMAIL($TBOPS, "DBError - $message",
"$message - In $SCRIPTNAME\n".
"$emdbi::DBErrorString\n");
"$emdbi::DBErrorString\n" .
Carp::longmess() . "\n");
}
$f->({cause=>'software'}, "$message:\n$emdbi::DBErrorString");
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved.
#
package emdbi;
......@@ -9,6 +9,7 @@ use strict;
use File::Basename;
use Mysql;
use English;
use Carp;
use Exporter;
use vars qw(@ISA @EXPORT);
@ISA = "Exporter";
......@@ -393,6 +394,8 @@ sub DBError($$;$)
print MAIL "In $SCRIPTNAME\n\n";
print MAIL "$message\n\n";
print MAIL "$DBErrorString\n\n";
print MAIL Carp::longmess();
print MAIL "\n";
close(MAIL);
}
}
......
......@@ -1794,7 +1794,7 @@ sub StubHandleEvent($$$) {
# Print the stuff we care about to stdout for the parent to pick up.
#
print "OBJTYPE='$objtype', OBJNAME='$objname', EVENTTYPE='$eventtype'\n";
if ($debug) {
if (1) {
print STDERR
"OBJTYPE='$objtype', OBJNAME='$objname', EVENTTYPE='$eventtype'\n";
}
......@@ -1827,7 +1827,7 @@ sub PollEvents($$)
if ($pollval > 0) {
my $buf;
while (sysread($childpipe, $buf, 4096)) {
while (sysread($childpipe, $buf, 8192)) {
#
# It is possible that we will get multiple lines
# of output in one read. Hopefully not so much that we get
......
#!/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;
......@@ -142,7 +142,7 @@ if ($SRCDIR =~ /^\//) {
}
my @INCDIRS = ("-I${objdir}", "-I${objdir}/../tbsetup",
"-I${objdir}/../db",
"-I${objdir}/../db", "-I${objdir}/../event/lib",
"-I${abssrcdir}/tbsetup",
"-I${abssrcdir}/install",
# To catch a few extra things that do not normally change.
......
......@@ -1478,13 +1478,18 @@ sub ListHistory($)
#
sub CheckCredentials($)
{
if (! ref($_[0]) != "ARRAY") {
return
GeniResponse->MalformedArgsResponse("Credentials should be a ".
"array not a singleton");
}
my @credentials = @{ $_[0] };
if (scalar(@credentials) != 1) {
return
GeniResponse->MalformedArgsResponse("Wrong number of credentials");
}
my $credential = GeniCredential->CreateFromSigned($credentials[0]);
my $credential = GeniCredential->CreateFromSigned($credentials[0]);
if (!defined($credential)) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Could not create credential object");
......
#!/usr/bin/perl -w
#
# GENIPUBLIC-COPYRIGHT
# Copyright (c) 2008-2010 University of Utah and the Flux Group.
# Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -53,8 +53,18 @@ sub OneShot();
#
$| = 1;
#
# Do not modify the include path if it was specified when invoked.
# This allows update to run from the build tree.
#
BEGIN
{
eval "require emutil";
if ($@) {
unshift(@INC, "@prefix@/lib");
}
}
# Load the Testbed support stuff.
use lib "@prefix@/lib";
use libtestbed;
use libdb qw(TBSetSiteVar TBSiteVarExists TBGetSiteVar);
use Experiment;
......
......@@ -3266,6 +3266,27 @@ CREATE TABLE `reserved` (
KEY `old_exptidx` (`old_exptidx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `scheduled_reloads`
--
DROP TABLE IF EXISTS `reserved_vlantags`;
CREATE TABLE `reserved_vlantags` (
`pid` varchar(12) NOT NULL default '',
`eid` varchar(32) NOT NULL default '',
`exptidx` int(11) NOT NULL default '0',
`lanid` int(11) NOT NULL default '0',
`vname` varchar(128) NOT NULL default '',
`tag` smallint(5) NOT NULL default '0',
`reserve_time` datetime default NULL,
`locked` datetime default NULL,
`state` varchar(32) NOT NULL default '',
PRIMARY KEY (`exptidx`,`lanid`,`tag`),
UNIQUE KEY `vname` (`pid`,`eid`,`vname`,`tag`),
UNIQUE KEY `lanid` (`pid`,`eid`,`lanid`,`tag`),
UNIQUE KEY `tag` (`tag`),
KEY `id` (`lanid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `scheduled_reloads`
--
......
#
# Add reserved_vlantags table
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBTableExists("reserved_vlantags")) {
DBQueryFatal("CREATE TABLE `reserved_vlantags` ( ".
" `pid` varchar(12) NOT NULL default '', ".
" `eid` varchar(32) NOT NULL default '', ".
" `exptidx` int(11) NOT NULL default '0', ".
" `lanid` int(11) NOT NULL default '0', ".
" `vname` varchar(128) NOT NULL default '', ".
" `tag` smallint(5) NOT NULL default '0', ".
" `reserve_time` datetime default NULL, ".
" `locked` datetime default NULL, ".
" `state` varchar(32) NOT NULL default '', ".
" PRIMARY KEY (`exptidx`,`lanid`,`tag`), ".
" UNIQUE KEY `vname` (`pid`,`eid`,`vname`,`tag`), ".
" UNIQUE KEY `lanid` (`pid`,`eid`,`lanid`,`tag`), ".
" UNIQUE KEY `tag` (`tag`), ".
" KEY `id` (`lanid`) ".
") ENGINE=MyISAM DEFAULT CHARSET=latin1");
}
return 0;
}
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# Copyright (c) 2004-2011 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -200,7 +200,7 @@ sub whacksome($@) {
warn "WhOL: could not send WhOL packets\n";
$failed++;
} else {
print STDERR "Whacked ", @nodelist, "\n";
print STDERR "Whacked ", join(' ', @nodelist), "\n";
}
}
......
......@@ -1196,6 +1196,9 @@ sub SetupOpsNode($)
print RC "inetd_enable=\"YES\"\n";
print RC "sendmail_enable=\"YES\"\n";
if ($emulabconfig{"CONFIG_MAILMAN"}) {
print RC "mailman_enable=\"YES\"\n";
}
print RC "sshd_enable=\"YES\"\n";
print RC "ntpdate_enable=\"YES\"\n";
......@@ -1617,7 +1620,10 @@ sub SetupBossNode()
# Disable TSO. It causes horrific xmit throughput with divert sockets.
# See: http://www.freebsd.org/cgi/query-pr.cgi?pr=121257
#
my $tso = "-tso";
my $tso = "";
if ($FBSD_VERSION > 6) {
$tso = "-tso";
}
print RC "network_interfaces=\"$outer_controlif\"\n";
print RC "ifconfig_${outer_controlif}=".
......
......@@ -93,7 +93,7 @@ find_disks() {
_DISKS=""
for d in `sed -n 's/^\([a-z]*[0-9][0-9]*\): [0-9][0-9]*MB/\1/p' /var/run/dmesg.boot`; do
case $d in
ad*|da*|ar*|aacd*) _DISKS="$_DISKS $d"
ad*|da*|ar*|aacd*|mfid*) _DISKS="$_DISKS $d"
esac
done
......@@ -145,6 +145,16 @@ loadone() {
echo "Loading image #$_NUM"
# Parse dem args
ADDR=""
SERVER=""
PART=""
PARTOS=""
DISK=""
ZFILL=""
ACPI=""
ASF=""
MBRVERS=""
PREPARE=""
for parm in $_LOADINFO; do
case $parm in
ADDR=*|\
......@@ -263,7 +273,7 @@ loadone() {
return 1
fi
imagefile="$ADDR"
else
else
PORT=`echo $ADDR | awk -F: '{ printf $2 }'`
MCAST=`echo $ADDR | awk -F: '{ printf $1 }'`
if [ -e $BOOTDIR/myip ]; then
......
# PROVIDE: cdroot
# BEFORE: disks netif
# BEFORE: disks
# KEYWORD: FreeBSD
#
......@@ -70,8 +70,9 @@ mkunionfs() {
# better be >= 6.3
# no, I don't know sed or awk
major=`uname -r | sed -e 's/\..*$//`
minor=`uname -r | sed -e 's/^[0-9]\.//' | sed -e 's/[^0-9]*$//'`
major=`uname -r | sed -e 's/\..*$//'`
# I DO know sed
minor=`uname -r | sed -e 's/^[0-9]\.\([0-9][0-9]*\).*/\1/'`
if [ $major -lt 6 -o $major -eq 6 -a $minor -lt 3 ]; then
echo -n "FreeBSD version ${major}.${minor} did not have a"
......@@ -102,7 +103,7 @@ mkunionfs() {
mkdir ${bufdir}/${mntpt}
echo "Generating ${mntpt} via unionfs"
# -o copymode=transparent \
mount_unionfs -o copymode=transparent \
mount_unionfs -o noatime -o copymode=transparent \
${bufdir}/${mntpt} $mntpt
chkerr $? "mount_unionfs ${bufdir}/${mntpt} $mntpt"
done
......
#! /usr/bin/env python
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2010 University of Utah and the Flux Group.
# Copyright (c) 2004-2011 University of Utah and the Flux Group.
# All rights reserved.
#
import sys
......@@ -4799,100 +4799,7 @@ class elabinelab:
return node_instance.console(version, argdict);
#
# vlan control
#
def vlans(self, version, argdict):
if version != self.VERSION:
return EmulabResponse(RESPONSE_BADVERSION,
output="Client version mismatch!")
try:
checknologins()
pass
except NoLoginsError, e:
return EmulabResponse(RESPONSE_REFUSED, output=str(e))
argerror = CheckRequiredArgs(argdict, ("op", "arg"))
if (argerror):
return argerror
verifyerror = self.verifystuff();
if (verifyerror):
return verifyerror
if (argdict["op"] != "setup" and
argdict["op"] != "list" and
argdict["op"] != "trunk" and
argdict["op"] != "destroy"):
return EmulabResponse(RESPONSE_BADARGS,
output="op must be list, trunk, setup or destroy")
argstr = "-p " + self.pid + " -e " + self.eid + " " + argdict["op"];
#
# Figure out how to convert the stuff we got into something we can
# pass on the command line to perl backend.
#
if argdict["op"] == "destroy" or argdict["op"] == "list":
#
# Destroy and list are easy; just pass a list of id numbers out.
# The backend script does all the verification.
#
if (isinstance(argdict["arg"], types.IntType)):
argstr += " " + str(argdict["arg"])
pass
else:
tokens = argdict["arg"].split(",")
for token in tokens:
argstr += " " + escapeshellarg(token)
pass
pass
pass
elif argdict["op"] == "trunk":
#
# Trunk is syntactically like destroy or list with two extra args.
#
info = argdict["arg"]
argstr += " " + str(info["mode"]) + " " + str(info["port"])
tokens = info["vlans"].split(",")
for token in tokens:
argstr += " " + escapeshellarg(token)
pass
pass
else:
#
# Setup is harder. Pass a set of strings to the script,
# consisting of:
#
# id,node:iface,speed,duplex,vtag
#
for id, idval in argdict["arg"].items():
vtag = idval["virtual"]
for port, portarray in idval["members"].items():
speed = portarray["speed"]
duplex = portarray["duplex"]
thisarg = escapeshellarg(str(id) + "," + port + "," +
str(speed) + "," +
duplex + "," + vtag)
argstr += " " + thisarg;
pass
pass
pass
(exitval, output) = runcommand(TBDIR + "/sbin/snmpit.proxy " + argstr)
if exitval:
return EmulabResponse(RESPONSE_ERROR, exitval >> 8, output=output)
return EmulabResponse(RESPONSE_SUCCESS, output=output)
#
# Leave the previous one in place or else existing elabinelabs will break.
#
def vlansnew(self, version, argdict):
def vlansv2(self, version, argdict):
if version != self.VERSION:
return EmulabResponse(RESPONSE_BADVERSION,
output="Client version mismatch!")
......@@ -4920,15 +4827,31 @@ class elabinelab:
if not xmlfilename:
return EmulabResponse(RESPONSE_SERVERERROR, output="Server Error")
argstr = "-p " + self.pid + " -e " + self.eid + " " + xmlfilename;
#
# Create a temporary file for the output.
#
(outfp, outfilename) = writensfile("");
if not outfilename:
return EmulabResponse(RESPONSE_SERVERERROR, output="Server Error")
(exitval, output) = runcommand(TBDIR + "/sbin/snmpit.proxynew " + argstr)
argstr = "-o " + outfilename + " ";
argstr += "-p " + self.pid + " -e " + self.eid + " " + xmlfilename;
(exitval,output) = runcommand(TBDIR + "/sbin/snmpit.proxyv2 " + argstr)
if exitval:
return EmulabResponse(RESPONSE_ERROR, exitval >> 8, output=output)
#
# Results are in the outfile.
#
stuff = ""
for l in outfp:
stuff += l
pass
return EmulabResponse(RESPONSE_SUCCESS, output=output)
def vlansv2(self, version, argdict):
return EmulabResponse(RESPONSE_SUCCESS, value=stuff, output=output)
def vlansv3(self, version, argdict):
if version != self.VERSION:
return EmulabResponse(RESPONSE_BADVERSION,
output="Client version mismatch!")
......@@ -4966,8 +4889,8 @@ class elabinelab:
argstr = "-o " + outfilename + " ";
argstr += "-p " + self.pid + " -e " + self.eid + " " + xmlfilename;
(exitval,output) = runcommand(TBDIR + "/sbin/snmpit.proxyv2 " + argstr)
if exitval:
(exitval,output) = runcommand("/usr/testbed/devel/stoller/sbin/snmpit.proxyv3 " + argstr)
if exitval:
return EmulabResponse(RESPONSE_ERROR, exitval >> 8, output=output)
#
......@@ -4979,6 +4902,7 @@ class elabinelab:
pass
return EmulabResponse(RESPONSE_SUCCESS, value=stuff, output=output)
#
# Fire up a frisbeed for an image,
#
......
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