Commit a51bf993 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 c24c93ba 21b06bea
......@@ -824,13 +824,12 @@ sub StartSlivers($$$$)
if (@failed) {
foreach my $resource (@failed) {
my $manager_urn = $resource->manager_urn();
my $ticketstr = $resource->Ticket();
my $ticket = GeniXML::Parse($ticketstr);
my $manifest = $resource->Manifest();
return -1
if (!defined($ticket));
if (!defined($manifest));
foreach my $ref (GeniXML::FindNodes("n:node",
$ticket)->get_nodelist()) {
$manifest)->get_nodelist()) {
my $vname = GeniXML::GetVirtualId($ref);
my $this_manager_urn = GeniXML::GetManagerId($ref);
......
......@@ -41,7 +41,7 @@ CREATE TABLE `geni_authorities` (
`url` tinytext,
`urn` tinytext,
PRIMARY KEY (`uuid`),
UNIQUE KEY `urn` (`urn`(256))
UNIQUE KEY `urn` (`urn`(255))
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
DROP TABLE IF EXISTS `geni_slices`;
......
......@@ -895,7 +895,8 @@ sub AddNode($$)
}
#
# Stub function to light up a set of nodes; does nothing.
# Stub function to light up a set of nodes; calls the big version in the
# parent.
#
sub LightUpNodes($@)
{
......
......@@ -209,6 +209,7 @@ write_image()
if [ $protocol = frisbee ]; then
[ -n "$server" ] || server=$BOSSIP
echo "$BINDIR/frisbee -m $address -p $port -S $server $frisbee_opts $disk"
$BINDIR/frisbee -m $address -p $port -S $server $frisbee_opts $disk
rc=$?
......
......@@ -25,7 +25,7 @@ SBIN_SCRIPTS = vlandiff vlansync withadminprivs export_tables cvsupd.pl \
spewconlog opsdb_control newnode suchown archive_list \
wanodecheckin wanodecreate spewimage \
anonsendmail epmodeset fixexpinfo node_traffic \
dumpdescriptor subboss_tftpboot_sync
dumpdescriptor subboss_tftpboot_sync testbed-control
WEB_SBIN_SCRIPTS= webnewnode webdeletenode webspewconlog webarchive_list \
webwanodecheckin webspewimage
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2010 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
use English;
use Getopt::Std;
use Data::Dumper;
#
# Update DB.
#
sub usage()
{
print STDERR "Usage: testbed-control [-d] [-f] shutdown | boot\n";
exit(-1);
}
my $optlist = "df";
my $debug = 0;
my $force = 0;
#
# Configure variables
#
my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $SETSITEVAR = "$TB/sbin/setsitevar";
my $STARTUP = "/usr/local/etc/rc.d/3.testbed.sh";
# Protos
sub Fatal($);
# 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;
use lib "@prefix@/lib";
use libdb;
use libtestbed;
#
# Parse command arguments.
#
my %options = ();
if (! getopts($optlist, \%options)) {
usage();
}
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"f"})) {
$force = 1;
}
usage()
if (@ARGV != 1);
usage()
if (! ($ARGV[0] eq "boot" || $ARGV[0] eq "shutdown"));
#
# Must be root if actually doing this.
#
if ($UID) {
Fatal("This script must be run as root! Maybe use sudo?")
}
sub Restart()
{
print "Starting up testbed daemons.\n";
system("$STARTUP start");
if ($?) {
print "*** Could not restart testbed daemons.\n";
exit(1);
}
print "\n";
print "Turning on the web interface and allowing swaps\n";
if (system("$SETSITEVAR web/nologins -") ||
system("$SETSITEVAR web/message -")) {
print "*** Could not renable the web interface and swapping!\n";
exit(1);
}
}
if ($ARGV[0] eq "boot") {
Restart();
exit(0);
}
#
# Stop the testbed before doing the update.
#
print "** Putting the testbed to sleep ...\n";
print "-> Turning off the web interface and disallowing swaps.\n";
my $msg = "Testbed going offline; back in a little while";
$msg =~ s|\&|&|g;
$msg =~ s|\<|&lt;|g;
system("$SETSITEVAR","web/message", $msg);
if ($?) {
Fatal("Could not update web message");
}
system("$SETSITEVAR web/nologins 1");
if ($?) {
Fatal("Could not disable web logins and experiment swaps");
}
print "-> Waiting a few seconds for testbed to quiet down ...\n";
sleep(5);
print "-> Looking for experiments still in transition.\n";
#
# Look for any experiments in transition, and wait for them to stop.
# This could take an arbitrarily long time of course, but its the only
# safe way to do it. Don't worry about any experiments that are older
# then 24 hours though; they are likely stuck and not going anywhere.
#
while (1) {
my $query_result =
DBQueryWarn("select pid,eid,idx,state,expt_locked ".
" from experiments ".
"where expt_locked is not null and ".
" DATE_SUB(NOW(),INTERVAL 1 DAY) <= expt_locked");
if (!$query_result) {
Fatal("Error getting info from the DB. Stopping.");
}
last
if (!$query_result->numrows());
print "-> Experiments still in transition:\n";
while (my ($pid,$eid,$idx,$state,$expt_locked) =
$query_result->query_result()) {
print " $pid,$eid,$idx -- $state, $expt_locked\n";
}
print "-> Waiting 30 seconds before trying again. ^C is okay\n\n";
sleep(30);
}
print "** Testbed is quiet; stopping testbed daemons ... \n";
system("$STARTUP stop >/dev/null 2>&1");
if ($?) {
Fatal("Could not stop testbed daemons. Stopping. Best to reboot!");
}
print "** Testbed is stopped. Safe to power off or reboot\n";
exit(0);
sub Fatal($)
{
my ($msg) = @_;
die("*** $0:\n".
" $msg\n");
}
Supports Markdown
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