Commit 45f997fd authored by Kevin Atkinson's avatar Kevin Atkinson

Updates to to Error Logging API Code.

You should start seeing much better error messages coming from my
system.  Errors coming from parse.proxy and assign (the two most
frequent sources of errors) should now be concise and to the point.
Errors coming from libosload/libreboot (the next most frequent source
of errors) should now also be much better, but not perfect.  Getting
perfect errors will likely a rework of how errors are handled in
libosload/libreboot, just adding tberror/tbwarn/tbnotice calls is not
enough.  I can do this at a latter date if necessary.

A few minor database changes.

Some changes to the API.  A few bug fixes. Lots of tberror/tbwarn/tbnotice
added to scripts.

Since assign is a C program, and at this time my API is perl only, I wrote a
second wrapper around assign, assign_wrapper2.  When assign fails errors are
now parsed in assign_wrapper2, sent to stderr and logged.  This means that
RunAssign() just returns when assign fails rather than echoing some of
assign.log output and then quiting.  The output to the activity log remains
unchanged.

Since "parse.proxy" is run from ops I couldn't use my API in it, even though
it is a perl program.  Instead I parse the errors coming form it in
parse-ns.
parent 95ec7066
......@@ -2265,6 +2265,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend tbsetup/tbrestart \
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/webnodeupdate \
tbsetup/savelogs tbsetup/setgroups tbsetup/websetgroups \
tbsetup/savelogs.proxy \
......
......@@ -703,6 +703,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend tbsetup/tbrestart \
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/webnodeupdate \
tbsetup/savelogs tbsetup/setgroups tbsetup/websetgroups \
tbsetup/savelogs.proxy \
......
......@@ -922,11 +922,12 @@ CREATE TABLE log (
invocation int(10) unsigned NOT NULL default '0',
parent int(10) unsigned NOT NULL default '0',
script smallint(3) NOT NULL default '0',
level smallint(2) NOT NULL default '0',
level tinyint(2) NOT NULL default '0',
sublevel tinyint(2) NOT NULL default '0',
priority smallint(3) NOT NULL default '0',
inferred tinyint(1) NOT NULL default '0',
cause varchar(32) NOT NULL default '',
type enum('normal','entering','exiting','thecause') NOT NULL default 'normal',
type enum('normal','entering','exiting','thecause','extra','summary') NOT NULL default 'normal',
relevant tinyint(1) NOT NULL default '0',
mesg text NOT NULL,
PRIMARY KEY (seq),
......@@ -1625,9 +1626,9 @@ CREATE TABLE portmap (
CREATE TABLE priorities (
priority smallint(3) NOT NULL default '0',
name varchar(8) NOT NULL default '',
priority_name varchar(8) NOT NULL default '',
PRIMARY KEY (priority),
UNIQUE KEY name (name)
UNIQUE KEY name (priority_name)
) TYPE=MyISAM;
--
......@@ -1758,9 +1759,9 @@ CREATE TABLE scheduled_reloads (
CREATE TABLE scripts (
script smallint(3) NOT NULL auto_increment,
name varchar(24) NOT NULL default '',
script_name varchar(24) NOT NULL default '',
PRIMARY KEY (script),
UNIQUE KEY id (name)
UNIQUE KEY id (script_name)
) TYPE=MyISAM;
--
......
......@@ -2867,7 +2867,7 @@ last_net_act,last_cpu_act,last_ext_act);
4.16: Add new tables for the logging subsystem (libdblog)
mysql tbdb < libtblog.sql
mysql tbdb < libtblog-orig.sql
4.17: Add linktest feature.
......@@ -3021,3 +3021,16 @@ last_net_act,last_cpu_act,last_ext_act);
notes text,
PRIMARY KEY (uid_idx)
) TYPE=MyISAM;
4.25: Modify tables for the logging subsystem
alter table log
modify level tinyint(2) not null,
add sublevel tinyint(2) NOT NULL default 0 after level,
modify type
enum('normal','entering','exiting','thecause','extra','summary')
NOT NULL default 'normal';
alter table scripts change name script_name varchar(24) NOT NULL default '';
alter table priorities change name priority_name varchar(8) NOT NULL;
-- MYSQL TABLES used for logging subsystem
CREATE TABLE log (
seq int unsigned NOT NULL auto_increment,
stamp int unsigned NOT NULL,
pidx int NOT NULL, -- unique project id
uid int default NULL, -- numeric user id
session int unsigned NOT NULL, -- session id (1)
invocation int unsigned NOT NULL, -- invocation id - unique id for a
-- particular execution of a script (1)
parent int unsigned NOT NULL, -- invocation id of the parent script
script smallint(3) NOT NULL, -- numeric id for the script name
level smallint(2) NOT NULL , -- depth of the script in the call chain
priority smallint(3) NOT NULL, -- syslog priority
inferred tinyint(1) NOT NULL, -- 0 - log created with tblog
-- 1 - log created by catching a die or warn
-- 2 - log created with a normal print and
-- given the non-default priority
-- 3 - log created with a normal print and
-- given the default priority
cause varchar(32) NOT NULL, -- string identifying the "cause" of the error
type enum('normal','entering','exiting','thecause')
NOT NULL default 'normal',-- type of error:
-- normal: normal error generated by tblog
-- entering: auto gen when a script starts
-- exiting: auto gen when a script exists (2)
-- thecause: created by tblog_find_error
relevant tinyint(1) NOT NULL, -- if the error was considered relevent
-- by tblog_find_error
mesg text NOT NULL, -- the text of the message
PRIMARY KEY (seq),
KEY (session)
);
-- (1) These ids are equal to the sequence number of the "entering" log
-- message
-- (2) Due to a number of factors every "exiting" message in not
-- garanteed to have a 1-1 relation with the "entering" message.
-- The two major ones are
-- (1) A Fork not followed by a "exec" will most likely to cause
-- multiple exiting messages. (2) If "exec" is used the script
-- will not have an exiting message.
-- NOTE: It may be beneficial to split this table into three:
-- session pidx uid
-- invocation session parent script level
-- seq stamp [session] invocation priority inferred cause type relevant mesg
-- ...
CREATE TABLE scripts (
script smallint(3) NOT NULL auto_increment,
name varchar(24) NOT NULL default '',
PRIMARY KEY (script),
UNIQUE KEY id (name)
);
CREATE TABLE priorities (
priority smallint(3) NOT NULL,
name varchar(8) NOT NULL,
primary key (priority),
unique key (name)
);
insert into priorities values (000, 'EMERG');
insert into priorities values (100, 'ALERT');
insert into priorities values (200, 'CRIT');
insert into priorities values (300, 'ERR');
insert into priorities values (400, 'WARNING');
insert into priorities values (500, 'NOTICE');
insert into priorities values (600, 'INFO');
insert into priorities values (700, 'DEBUG');
insert into exported_tables values ('state_timeouts');
......@@ -10,7 +10,8 @@ CREATE TABLE log (
-- particular execution of a script (1)
parent int unsigned NOT NULL, -- invocation id of the parent script
script smallint(3) NOT NULL, -- numeric id for the script name
level smallint(2) NOT NULL , -- depth of the script in the call chain
level tinyint(2) NOT NULL , -- depth of the script in the call chain
sublevel tinyint(2) NOT NULL, -- sub level
priority smallint(3) NOT NULL, -- syslog priority
inferred tinyint(1) NOT NULL, -- 0 - log created with tblog
-- 1 - log created by catching a die or warn
......@@ -19,12 +20,16 @@ CREATE TABLE log (
-- 3 - log created with a normal print and
-- given the default priority
cause varchar(32) NOT NULL, -- string identifying the "cause" of the error
type enum('normal','entering','exiting','thecause')
type enum('normal','entering','exiting','thecause','extra','summary')
NOT NULL default 'normal',-- type of error:
-- normal: normal error generated by tblog
-- entering: auto gen when a script starts
-- exiting: auto gen when a script exists (2)
-- thecause: created by tblog_find_error
-- extra: extra information to normal info
-- at a lower level
-- summary: useful summary of errors,
-- ignore all info at lower levels
relevant tinyint(1) NOT NULL, -- if the error was considered relevent
-- by tblog_find_error
mesg text NOT NULL, -- the text of the message
......@@ -49,14 +54,14 @@ CREATE TABLE log (
CREATE TABLE scripts (
script smallint(3) NOT NULL auto_increment,
name varchar(24) NOT NULL default '',
script_name varchar(24) NOT NULL default '',
PRIMARY KEY (script),
UNIQUE KEY id (name)
);
CREATE TABLE priorities (
priority smallint(3) NOT NULL,
name varchar(8) NOT NULL,
priority_name varchar(8) NOT NULL,
primary key (priority),
unique key (name)
);
......
......@@ -40,7 +40,8 @@ FSBIN_STUFF = exports_setup.proxy
LIBEXEC_STUFF = rmproj wanlinksolve wanlinkinfo \
os_setup mkexpdir console_setup webnscheck webreport \
webendexp webbatchexp webpanic \
assign_wrapper assign_prepass ptopgen webnodeupdate \
assign_wrapper assign_wrapper2 \
assign_prepass ptopgen webnodeupdate \
webdelay_config webnodehistory \
webrmgroup webswapexp webnodecontrol webeventsys_control \
webmkgroup websetgroups webmkproj webmodgroups \
......
......@@ -113,6 +113,7 @@ use libtestbed;
use Node;
use libadminctrl;
use libtblog;
use libtblog qw(*SOUT *SERR);
#
# assign_wrapper Settings
......@@ -186,11 +187,9 @@ TBDebugTimeStampsOn();
#
# All exits happen via this function!
#
sub fatal ($)
sub fatal (@)
{
my($message) = @_;
tberror $message;
&tberror(@_);
# We next go to the END block below.
exit($WRAPPER_FAILED);
......@@ -200,7 +199,7 @@ sub fatal ($)
# We want warnings to cause assign_wrapper to exit abnormally.
# We will come through here no matter how we exit though.
#
$SIG{__WARN__} = sub { print STDERR $_[0];$warnings++; };
$SIG{__WARN__} = sub { tbwarn $_[0];$warnings++; };
END {
# Watch for getting here cause of a die()/exit() statement someplace.
......@@ -211,7 +210,7 @@ END {
}
if ($warnings > 0) {
tbwarn "$warnings.\n";
tberror "$warnings warnings.\n";
$exitcode |= $WRAPPER_FAILED;
}
......@@ -750,7 +749,7 @@ while (1) {
$precheck = 1;
my $retval = RunAssign();
if ($retval != 0) {
fatal("Experiment can not be run on an empty testbed. Please fix the experiment.");
fatal({type=>'extra'}, "Experiment can not be run on an empty testbed. Please fix the experiment.");
}
print("Assign succeeded on an empty testbed.\n");
$precheck = 0;
......@@ -887,20 +886,20 @@ sub RunAssign ()
# the parent.
#
POSIX::setsid();
exec("nice $cmd $cmdargs > assign.log");
exec("nice assign_wrapper2 $cmd $cmdargs > assign.log");
die "Could not start assign!\n";
}
# Check cancel flag before continuing.
TBGetCancelFlag($pid, $eid, \$canceled);
if ($canceled) {
print("Cancel flag set; aborting assign run!\n");
tbnotice("Cancel flag set; aborting assign run!\n");
return -1;
}
# Check for possible full filesystem ...
if (-z "assign.log") {
print("assign.log is zero length! Stopping ...\n");
tbnotice("assign.log is zero length! Stopping ...\n");
return -1;
}
......@@ -916,37 +915,12 @@ sub RunAssign ()
printdb "Reading assign results.\n";
#
# We no longer care what assign has to say when it fails! Just
# tell the caller whether we want to keep trying or not. We still
# send some of the goo to the output stream so that Rob can quickly
# deduce what what wrong.
# We no longer care what assign has to say when it fails!
# Any relevent info was already sent to stderr so just
# tell the caller whether we want to keep trying or not.
#
if ($assignexitcode) {
my $violations = 0;
print "ASSIGN FAILED:\n";
while (<ASSIGNFP> !~ /^[\w\s]*precheck:$/) {}
while (<ASSIGNFP>) {
chop;
/^\w*\s*precheck:$/ && do {
next;
};
/^With ([0-9]+) violations$/ && do {
$violations = $1;
last;
};
print $_ . "\n";
}
if ($violations) {
while (<ASSIGNFP> !~ /^Violations:/) {}
while (<ASSIGNFP>) {
if (/^Nodes:/) {
last;
}
print "$_";
}
}
close(ASSIGNFP);
close ASSIGNFP;
return (($assignexitcode == 1) ? 1 : -1);
}
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Hack to get assign error messages into the database correctly. Will
# be removed once the API is ported to other languages besides perl
#
BEGIN {$FAKE_SCRIPTNAME = $ARGV[0];}
use lib "@prefix@/lib";
use libtblog;
use libtblog qw(dblog *SOUT *SERR);
use strict;
open P, join(' ', @ARGV, ' |');
my @out;
my @err;
my $obvious_error = 0;
while (<P>) {
print SOUT $_;
push @out, $_;
}
close P;
my $exitcode = $? >> 8;
#
# Now parse out relevent info and echo it to stderr. Also, pull out
# any obvious errors (prefixed with ***) and log them sepertly. The
# rest will go in te database as one big error.
#
if ($exitcode) {
my $violations = 0;
# Pull out relevent info
print SERR "ASSIGN FAILED:\n";
while ((shift @out) !~ /^[\w\s]*precheck:$/) {}
while (($_ = shift @out)) {
/^[\w\s]*precheck:$/ && do {
next;
};
/^With ([0-9]+) violations$/ && do {
$violations = $1;
last;
};
print SERR $_;
push @err, $_;
}
if ($violations) {
while ((shift @out) !~ /^Violations:/) {}
while (($_ = shift @out)) {
if (/^Nodes:/) {
last;
}
print SERR $_;
push @err, $_;
}
}
# See if there are any obvious errors
my $err = '';
while (($_ = shift @err)) {
$err .= $_;
if (/^(\s*)\*\*\*+\s*(.+)/) {
$obvious_error = 1;
my $space = $1;
my $mesg = $2;
while (@err && $err[0] =~ /^$space \s*(.+)/) {
$mesg .= "\n$1";
shift @err;
}
my $sublevel = length($space) > 0 ? 1 : 0;
if ($mesg =~ s/^warning:\s+//i) {
dblog(TBLOG_WARNING, {sublevel=>$sublevel}, $mesg);
} else {
dblog(TBLOG_ERR, {sublevel=>$sublevel}, $mesg);
}
}
}
# log all relevent output as one entry unless an obvious_error was
# already found
dblog(TBLOG_ERR, {}, $err) unless ($obvious_error);
# create a log entry that assign failed
my %parms;
$parms{sublevel} = -1;
$parms{type} = 'extra' unless $obvious_error;
dblog(TBLOG_ERR, \%parms, "Assign Failed.");
}
exit $exitcode;
......@@ -146,16 +146,14 @@ my $committed = 0;
# Verify user and get his DB uid.
#
if (! UNIX2DBUID($UID, \$dbuid)) {
die("*** $0:\n".
" You do not exist in the Emulab Database!\n");
tbdie("You do not exist in the Emulab Database!");
}
#
# Get email info for user.
#
if (! UserDBInfo($dbuid, \$user_name, \$user_email)) {
die("*** $0:\n".
" Cannot determine your name and email address.\n");
tbdie("Cannot determine your name and email address.");
}
#
......@@ -163,9 +161,7 @@ if (! UserDBInfo($dbuid, \$user_name, \$user_email)) {
# our time. Make sure user sees the error by exiting with 1.
#
if (system("$checkquota $dbuid") != 0) {
print STDERR
"*** $0:\n".
" You are over your disk quota on $CONTROL; please cleanup!\n";
tberror("You are over your disk quota on $CONTROL; please cleanup!");
exit(1);
}
......@@ -187,14 +183,13 @@ if (!defined($description)) {
$description = "'Created by $dbuid'";
}
if (! $swappable && (!defined($noswap_reason) || $noswap_reason eq "")) {
die("Must provide a reason with -S option (not swappable reason)!\n");
tbdie("Must provide a reason with -S option (not swappable reason)!");
}
if (! $idleswap && (!defined($noidleswap_reason) || $noidleswap_reason eq "")) {
die("Must provide a reason with -L option (no idleswap reason)!\n");
tbdie("Must provide a reason with -L option (no idleswap reason)!");
}
if (!defined($tempnsfile) && !TBAdmin($dbuid)) {
die("*** $0:\n".
" Only admins can create experiments with no NS file\n");
tbdie("Only admins can create experiments with no NS file");
}
my $nsfile = "$eid.ns";
my $repfile = "$eid.report";
......@@ -209,8 +204,7 @@ $noidleswap_reason = "'None Given'"
# Make sure UID is allowed to create experiments in this project.
#
if (! TBProjAccessCheck($dbuid, $pid, $gid, TB_PROJECT_CREATEEXPT)) {
die("*** $0:\n".
" You do not have permission to create experiments in $pid/$gid\n");
die("You do not have permission to create experiments in $pid/$gid");
}
#
......@@ -223,8 +217,7 @@ if (!defined($tempnsfile)) {
}
elsif (! -f $tempnsfile || ! -r $tempnsfile || -z $tempnsfile) {
# Exit so that user sees the error, not us.
print STDERR "*** $0:\n".
" $tempnsfile does not exist or is not a readable file!\n";
tberror("$tempnsfile does not exist or is not a readable file!");
exit(1);
}
......@@ -270,8 +263,7 @@ $query_result =
if ($query_result->numrows) {
DBQueryWarn("unlock tables");
die("*** $0:\n".
" Experiment $eid in project $pid already exists!\n");
tbdie("Experiment $eid in project $pid already exists!");
}
#
......@@ -298,8 +290,7 @@ foreach my $table ("experiments", "experiment_stats", "experiment_resources",
if ($query_result->numrows) {
DBQueryWarn("unlock tables");
die("*** $0:\n".
" Experiment index $exptidx exists in $table; this is bad!\n");
tbdie("Experiment index $exptidx exists in $table; this is bad!");
}
}
......@@ -324,8 +315,7 @@ if (! DBQueryWarn("INSERT INTO experiments ".
"$noidleswap_reason, $batchmode, '$batchstate', ".
"$linktest, $savestate)")) {
DBQueryWarn("unlock tables");
die("*** $0:\n".
" DB error inserting experiment record for $pid/$eid!\n");
tbdie("DB error inserting experiment record for $pid/$eid!");
}
#
......@@ -338,8 +328,7 @@ $query_result =
if (!$query_result) {
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
DBQueryWarn("unlock tables");
die("*** $0:\n".
" DB error inserting experiment resources record for $pid/$eid!");
tbdie("DB error inserting experiment resources record for $pid/$eid!");
}
my $rsrcidx = $query_result->insertid;
......@@ -353,16 +342,14 @@ if (! DBQueryWarn("insert into experiment_stats ".
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
DBQueryWarn("delete from experiment_resources where idx=$rsrcidx");
DBQueryWarn("unlock tables");
die("*** $0:\n".
" DB error inserting experiment stats record for $pid/$eid!");
tbdie("DB error inserting experiment stats record for $pid/$eid!");
}
if (! DBQueryWarn("unlock tables")) {
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
DBQueryWarn("delete from experiment_resources where idx=$rsrcidx");
DBQueryWarn("delete from experiment_stats where exptidx=$exptidx");
die("*** $0:\n".
" DB error unlocking tables!");
tbdie("DB error unlocking tables!");
}
#
......@@ -883,8 +870,7 @@ sub ParseArgs()
$tempnsfile = $1;
}
else {
die("*** $0:\n".
" Bad data in nsfile: $tempnsfile\n");
tbdie("Bad data in nsfile: $tempnsfile");
}
#
......@@ -897,8 +883,7 @@ sub ParseArgs()
$tempnsfile = $1;
}
else {
die("*** $0:\n".
" Bad data returned by realpath: $translated\n");
tbdie("Bad data returned by realpath: $translated");
}
#
......@@ -913,9 +898,7 @@ sub ParseArgs()
! ($tempnsfile =~ /^\/proj/) &&
! ($tempnsfile =~ /^\/groups/) &&
! ($tempnsfile =~ /^\/users/)) {
print STDERR
"*** $0:\n".
" $tempnsfile does not resolve to an allowed directory!\n";
tberror("$tempnsfile does not resolve to an allowed directory!");
# Note positive status; so error goes to user not tbops.
exit(1);
}
......@@ -953,7 +936,7 @@ sub ParseArgs()
$pid = $1;
}
else {
die("Bad data in argument: $pid.");
tbdie("Bad data in argument: $pid.");
}
}
if (defined($options{"e"})) {
......@@ -963,11 +946,11 @@ sub ParseArgs()
$eid = $1;
}
else {
die("Bad data in argument: $eid.");
tbdie("Bad data in argument: $eid.");
}
if (! TBcheck_dbslot($eid, "experiments", "eid",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper experiment name (id)!\n");
tbdie("Improper experiment name (id)!");
}
}
if (defined($options{"g"})) {
......@@ -977,20 +960,20 @@ sub ParseArgs()
$gid = $1;
}
else {
die("Bad data in argument: $gid.");
tbdie("Bad data in argument: $gid.");
}
}
if (defined($options{"E"})) {
if (! TBcheck_dbslot($options{"E"}, "experiments", "expt_name",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper experiment description!\n");
tbdie("Improper experiment description!");
}
$description = DBQuoteSpecial($options{"E"});
}
if (defined($options{"S"})) {
if (! TBcheck_dbslot($options{"S"}, "experiments", "noswap_reason",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper noswap reason!\n");
tbdie("Improper noswap reason!");
}
$swappable = 0;
$noswap_reason = DBQuoteSpecial($options{"S"});
......@@ -998,7 +981,7 @@ sub ParseArgs()
if (defined($options{"L"})) {
if (! TBcheck_dbslot($options{"L"}, "experiments", "noidleswap_reason",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper noidleswap reason!\n");
tbdie("Improper noidleswap reason!");
}
$idleswap = 0;
$noidleswap_reason = DBQuoteSpecial($options{"L"});
......@@ -1006,7 +989,7 @@ sub ParseArgs()
if (defined($options{"l"})) {
if (! TBcheck_dbslot($options{"l"}, "experiments", "idleswap_timeout",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper idleswap timeout!\n");
tbdie("Improper idleswap timeout!");
}
$idleswap = 1;
$idleswaptime = $options{"l"};
......@@ -1014,7 +997,7 @@ sub ParseArgs()
if (defined($options{"a"})) {
if (! TBcheck_dbslot($options{"a"}, "experiments", "autoswap_timeout",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper autoswap timeout!\n");
tbdie("Improper autoswap timeout!");
}
$autoswap = 1;
$autoswaptime = $options{"a"};
......@@ -1022,7 +1005,7 @@ sub ParseArgs()
if (defined($options{"t"})) {
if (! TBcheck_dbslot($options{"t"}, "experiments", "linktest_level",
TBDB_CHECKDBSLOT_WARN|TBDB_CHECKDBSLOT_ERROR)) {
die("Improper linktest level!\n");
tbdie("Improper linktest level!");
}
$linktest = $options{"t"};
}
......@@ -1040,9 +1023,8 @@ sub fatal($)
{
my($mesg) = $_[0];
print "*** $0:\n";
print " $mesg\n";
print "Cleaning up and exiting with status $errorstat ...\n";
tberror $mesg;
tbinfo "Cleaning up and exiting with status $errorstat ...";
#
# This exit will drop into the END block below.
......
......@@ -52,8 +52,7 @@ if ($TESTMODE) {
}
if ($EUID != 0) {
die("*** $0:\n".
" Must be root! Maybe its a development version?\n");
tbdie("Must be root! Maybe its a development version?");
}
#
......@@ -123,13 +122,11 @@ else {
}
if (! ($expstate = ExpState($pid, $eid))) {
die("*** $0:\n".
" No such experiment $pid/$eid!\n");
tbdie("No such experiment $pid/$eid!");
}
if (! UNIX2DBUID($UID, \$dbuid)) {
die("*** $0:\n".
" You do not exist in the Emulab Database!\n");
tbdie("You do not exist in the Emulab Database!");
}
#
......@@ -137,8 +134,7 @@ if (! UNIX2DBUID($UID, \$dbuid)) {
# can do this.
#
if (! TBExptAccessCheck($UID, $pid, $eid, TB_EXPT_DESTROY)) {
die("*** $0:\n".
" You do not have permission to control the event system!\n");
tbdie("You do not have permission to control the event system!");
}
#
......@@ -149,8 +145,7 @@ if ($expstate ne EXPTSTATE_ACTIVE &&
$expstate ne EXPTSTATE_ACTIVATING &&
$expstate ne EXPTSTATE_MODIFY_RESWAP &&
$expstate ne EXPTSTATE_SWAPPING) {
die("*** $0:\n".
" Experiment $pid/$eid must active (or swapping)!\n");
tbdie("Experiment $pid/$eid must active (or swapping)!");
}
#
......@@ -158,8 +153,8 @@ if ($expstate ne EXPTSTATE_ACTIVE &&
# the experiment, balk unless force mode is on.
#
if ($action eq "start" && !$force && !ExpNodes($pid, $eid)) {
print("*** There are no nodes in $pid/$eid. ".
"Not starting a scheduler.\n");
tbnotice("There are no nodes in $pid/$eid. ".
"Not starting a scheduler.");
exit(0);
}
......@@ -176,8 +171,7 @@ my $gid = ExpGroup($pid, $eid);
my ($unix_gid, $unix_gidname);
if (! TBGroupUnixInfo($pid, $gid, \$unix_gid, \$unix_gidname)) {
die("*** $0:\n".
" Could not get unix group info for $pid/$gid!\n");
tbdie("Could not get unix group info for $pid/$gid!");
}
#
......@@ -202,5 +196,4 @@ if ($UNIFIED || $DBIFACE) {
else {
exec("sshtb -host $CONTROL $cmd");
}
die("*** $0:\n".
" Could not exec '$cmd'\n");
tbdie("Could not exec '$cmd'");