Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
f3c23007
Commit
f3c23007
authored
Nov 12, 2010
by
Mike Hibler
Browse files
Merge remote branch 'mike/master' into tpm-tmcd
parents
e9a222db
24903113
Changes
13
Hide whitespace changes
Inline
Side-by-side
db/Image.pm.in
View file @
f3c23007
...
...
@@ -137,6 +137,30 @@ sub updated($) { return field($_[0], "updated"); }
sub
mbr_version
($)
{
return
field
($
_
[
0
],
"mbr_version"
);
}
sub
access_key
($)
{
return
field
($
_
[
0
],
"access_key"
);
}
#
#
Get
a
list
of
all
running
frisbee
images
.
#
sub
ActiveImages
($)
{
my
($
class
)
=
@
_
;
my
@
result
=
();
my
$
query_result
=
DBQueryWarn
(
"select imageid from images where frisbee_pid!=0"
);
return
undef
if
(
!defined($query_result));
while
(
my
($
imageid
)
=
$
query_result
->
fetchrow_array
())
{
my
$
image
=
Image
->
Lookup
($
imageid
);
if
(
!defined($image)) {
print
STDERR
"*** Could not find DB object for image $imageid
\n
"
;
return
undef
;
}
push
(@
result
,
$
image
);
}
return
\@
result
;
}
#
#
Refresh
a
class
instance
by
reloading
from
the
DB
.
#
...
...
db/audit.in
View file @
f3c23007
#!/usr/bin/perl -w
T
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-200
8
University of Utah and the Flux Group.
# Copyright (c) 2000-20
1
0 University of Utah and the Flux Group.
# All rights reserved.
#
use
English
;
...
...
@@ -200,12 +200,14 @@ if ($today == 7) {
if
(
!
(
$query_result
=
DBQueryWarn
("
select n.node_id from nodes as n
"
.
"
left join node_types as t on t.type=n.type
"
.
"
left join reserved as r on r.node_id=n.node_id
"
.
"
where (n.eventstate!='
"
.
TBDB_NODESTATE_ISUP
.
"
' and
"
.
"
n.eventstate!='
"
.
TBDB_NODESTATE_PXEWAIT
.
"
' and
"
.
"
n.eventstate!='
"
.
TBDB_NODESTATE_ALWAYSUP
.
"
' and
"
.
"
n.eventstate!='
"
.
TBDB_NODESTATE_POWEROFF
.
"
')
"
.
"
and r.pid is null and n.role='testnode'
")))
{
"
and r.pid is null and n.role='testnode' and
"
.
"
t.isfednode=0
")))
{
fatal
("
Error accessing the database.
");
}
...
...
db/idlemail.in
View file @
f3c23007
...
...
@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-200
7
University of Utah and the Flux Group.
# Copyright (c) 2000-20
1
0 University of Utah and the Flux Group.
# All rights reserved.
#
...
...
@@ -165,7 +165,7 @@ EOT
$time
=
$r
{'
idle_time
'};
$lastact
=
$r
{'
lastact
'};
$staleness
=
$r
{'
staleness
'};
if
(
$staleness
>=
600
)
{
# 10 minute stale limit
if
(
!
defined
(
$staleness
)
||
$staleness
>=
600
)
{
# 10 minute stale limit
$stale
=
1
;
}
...
...
@@ -283,7 +283,7 @@ EOT
$time
=
$r
{'
idle_time
'};
$lastact
=
$r
{'
lastact
'};
$staleness
=
$r
{'
staleness
'};
if
(
$staleness
>=
600
)
{
# 10 minute stale limit
if
(
!
defined
(
$staleness
)
||
$staleness
>=
600
)
{
# 10 minute stale limit
$stale
=
1
;
}
SendMessage
(
$pid
,
$pid
,
$eid
,
1
,
0
,
$nodes
,
$time
,
$lastact
,
$stale
,
...
...
@@ -363,7 +363,7 @@ EOT
$time
=
$r
{'
idle_time
'};
$lastact
=
$r
{'
lastact
'};
$staleness
=
$r
{'
staleness
'};
if
(
$staleness
>=
600
)
{
# 10 minute stale limit
if
(
!
defined
(
$staleness
)
||
$staleness
>=
600
)
{
# 10 minute stale limit
$stale
=
1
;
}
...
...
install/boss-install.in
View file @
f3c23007
...
...
@@ -112,6 +112,7 @@ my $BATCHEXP = "$PREFIX/bin/batchexp";
my
$NAMED_SETUP
=
"
$PREFIX
/sbin/named_setup
";
my
$ADDPUBKEY
=
"
$PREFIX
/sbin/addpubkey
";
my
$TBACCT
=
"
$PREFIX
/sbin/tbacct
";
my
$GENTOPOFILE
=
"
$PREFIX
/libexec/gentopofile
";
my
$WWWDIR
=
"
$PREFIX
/www
";
my
$CRACKLIB_DICT
=
"
/usr/local/lib/pw_dict.pwd
";
...
...
@@ -1622,6 +1623,11 @@ Phase "experiments", "Setting up system experiments", sub {
"
-L 'System Experiment'
"
.
"
-E '
$desc
- DO NOT DELETE'
"
.
"
-p
$pid
-e
$eid
");
#
# XXX create an empty topomap so that nodes booting up in
# one of these experiments won't fail in rc.topomap.
#
ExecQuiet
("
$SUDO
-u
$PROTOUSER
$GENTOPOFILE
$pid
$eid
");
};
}
};
...
...
install/update-testbed.in
View file @
f3c23007
...
...
@@ -45,6 +45,7 @@ my $PGENISUPPORT = @PROTOGENI_SUPPORT@;
my
$INSTALLUPDATE
=
"
$TB
/sbin/update-install
";
my
$SETSITEVAR
=
"
$TB
/sbin/setsitevar
";
my
$STARTUP
=
"
/usr/local/etc/rc.d/3.testbed.sh
";
my
$FRISBEE
=
"
$TB
/sbin/frisbeelauncher
";
my
$tempfile
=
"
/var/tmp/update.$$
";
# Protos
...
...
@@ -85,6 +86,7 @@ BEGIN
use
emdb
;
use
libEmulab
;
use
libtestbed
;
use
Image
;
#
# Parse command arguments.
...
...
@@ -305,6 +307,23 @@ if ($stopbed) {
Fatal
("
Could not stop testbed daemons. Stopping.
");
}
$stopped
=
1
;
my
$activeimages
=
Image
->
ActiveImages
();
if
(
defined
(
$activeimages
))
{
my
@activeimages
=
@
{
$activeimages
};
if
(
@activeimages
)
{
print
"
** Stopping running frisbee processes ...
\n
";
}
foreach
my
$image
(
@activeimages
)
{
my
$imageid
=
$image
->
imageid
();
print
"
-> Killing frisbee for
$image
...
\n
";
system
("
$FRISBEE
-k
$imageid
");
if
(
$?
)
{
Fatal
("
Could not stop frisbee for
$image
!
");
}
}
}
print
"
** Testbed is stopped. Proceeding to update
\n
";
#
...
...
install/updates/5/12
0 → 100644
View file @
f3c23007
#
# Create a null topomap for system experiments.
#
# This way, when a node happens to boot from disk while in one of these
# experiments (e.g., hwdown), it won't fail in rc.topomap. For new installs,
# this is now done by boss-install.
#
# Is this important? No, but it irritated me.
#
use strict;
use libinstall;
# XXX lifted from boss-install.in
my %EXPERIMENTS =
("hwdown" => {"pid" => "emulab-ops",
"description" => "Node reported as down"},
"reloading" => {"pid" => "emulab-ops",
"description" => "Nodes reloading images"},
"reloadpending" => {"pid" => "emulab-ops",
"description" => "Nodes waiting for reload"},
"oldreserved" => {"pid" => "emulab-ops",
"description" => "Nodes in limbo during swap modify"},
"nfree-leases" => {"pid" => "emulab-ops",
"description" => "Nodes in limbo during nfree"},
"nfree-locked" => {"pid" => "emulab-ops",
"description" => "Nodes in limbo during nfree"},
"opsnodes" => {"pid" => "emulab-ops",
"description" => "Nodes designated as Ops Nodes"},
"holding" => {"pid" => "emulab-ops",
"description" => "Nodes in a holding pattern"},
"shared-nodes" => {"pid" => "emulab-ops",
"description" => "Nodes in shared mode"},
"hwcheckup" => {"pid" => "emulab-ops",
"description" => "Nodes being testing after failure"},
);
my $SUDO = "/usr/local/bin/sudo";
my $GENTOPOFILE = "$TBROOT/libexec/gentopofile";
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
#
# If something should run in the pre-install phase.
#
if ($phase eq "pre") {
Phase "gentopo", "Creating NULL topomap for system experiments", sub {
foreach my $eid (keys(%EXPERIMENTS)) {
my $pid = $EXPERIMENTS{$eid}->{"pid"};
ExecQuiet("$SUDO -u $PROTOUSER $GENTOPOFILE $pid $eid");
}
};
}
#
# If something should run in the post-install phase.
#
if ($phase eq "post") {
}
return 0;
}
1;
install/updates/5/13
0 → 100644
View file @
f3c23007
#
# Install new port, for ProtoGENI.
#
use strict;
use libinstall;
sub InstallUpdate($$)
{
my ($version, $phase) = @_;
#
# If something should run in the pre-install phase.
#
if ($phase eq "pre") {
Phase "p5-XML-SemanticDiff", "Checking for p5-XML-SemanticDiff", sub {
DoneIfPackageInstalled("p5-XML-SemanticDiff");
ExecQuietFatal("cd $PORTSDIR/textproc/p5-XML-SemanticDiff; ".
"make MASTER_SITE_FREEBSD=1 -DBATCH install");
};
}
#
# If something should run in the post-install phase.
#
if ($phase eq "post") {
}
return 0;
}
1;
protogeni/lib/GeniAuthority.pm.in
View file @
f3c23007
...
...
@@ -344,7 +344,6 @@ sub Version($)
else
{
$
self
->{
'version'
}
=
$
response
->
value
()->{
'api'
};
$
self
->{
'apilevel'
}
=
$
response
->
value
()->{
'level'
};
$
self
->{
'apilevel'
}
=
0
;
$
self
->{
'api'
}
=
"CM"
;
}
}
...
...
protogeni/lib/GeniTicket.pm.in
View file @
f3c23007
...
...
@@ -169,7 +169,7 @@ sub Create($$$$)
# For now, all tickets expire very quickly ...
#
$self->{'
redeem_before
'} =
POSIX::strftime("20%y-%m-%dT%H:%M:%S", localtime(time() + (
5
*60)));
POSIX::strftime("20%y-%m-%dT%H:%M:%S", localtime(time() + (
10
*60)));
#
# Locally generated tickets need a local DB index, which can be the
...
...
protogeni/updates/16
0 → 100644
View file @
f3c23007
#
#
#
use strict;
use GeniDB;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBSetDefault($dbhandle);
DBQueryFatal( "ALTER TABLE `geni_authorities` " .
"MODIFY `type` enum( 'sa', 'ma', 'ch', 'cm', 'ses', 'am' ) " .
"NOT NULL DEFAULT 'sa'" );
return 0;
}
1;
tmcd/common/config/rc.topomap
View file @
f3c23007
...
...
@@ -126,13 +126,16 @@ sub docleanup()
}
#
# Get topomap
# Get topomap and assorted linktest files.
# Right now we first try to fetch across NFS. Failing that we use tmcc.
# Eventually we should get this via http or frisbee.
#
# Failure to get the topomap is considered fatal, not so with linktest files.
#
sub
dotopomap
()
{
#
# Copy over the topomap so that it is locally resident. We will eventually
# get this via a tarfile instead of NFS.
# Copy over the topomap so that it is locally resident.
#
my
$datadir
=
EXPDIR
()
.
"
/tbdata
";
my
$topomap
=
"
$datadir
/topomap.gz
";
...
...
@@ -169,40 +172,25 @@ sub dotopomap()
if
(
!
-
e
$tempmap
)
{
#
# Try using tmcc. It returns compressed data so do it directly.
# XXX note that tmcc does not return a meaningful exit value.
#
system
(
TMCCBIN
()
.
"
$optarg
$urnarg
topomap >
$tempmap
");
#
# tmcc does not really return useful error codes.
#
if
(
$?
)
{
fatal
("
Could not get topomap from tmcd or from NFS
");
}
}
if
(
!
-
e
$templt
)
{
#
# Try using tmcc. It returns compressed data so do it directly.
# XXX note that tmcc does not return a meaningful exit value.
#
system
(
TMCCBIN
()
.
"
$optarg
$urnarg
ltmap >
$templt
");
#
# tmcc does not really return useful error codes.
#
if
(
$?
)
{
fatal
("
Could not get ltmap from tmcd or from NFS
");
}
}
if
(
!
-
e
$templtp
)
{
#
# Try using tmcc. It returns compressed data so do it directly.
# XXX note that tmcc does not return a meaningful exit value.
#
system
(
TMCCBIN
()
.
"
$optarg
$urnarg
ltpmap >
$templtp
");
#
# tmcc does not really return useful error codes.
#
if
(
$?
)
{
fatal
("
Could not get ltpmap from tmcd or from NFS
");
}
}
if
(
-
s $tempmap) {
...
...
@@ -210,9 +198,14 @@ sub dotopomap()
if ($
?)
{
fatal
("
Could not unzip topomap
");
}
unlink
("
$tempmap
");
}
else
{
#
# We make this fatal since route setup depends on this file.
# We could let it go, in which case route setup would non-fatally
# fail, but then we also wouldn't run linktest (since the topomap
# is missing) so we might not detect that route setup failed.
#
fatal
("
Could not get topomap
");
}
...
...
@@ -221,7 +214,6 @@ sub dotopomap()
if ($
?)
{
fatal
("
Could not unzip ltmap
");
}
unlink
("
$templt
");
}
else
{
warning
("
Could not get ltmap
");
...
...
@@ -232,9 +224,12 @@ sub dotopomap()
if ($
?)
{
fatal
("
Could not unzip ltpmap
");
}
unlink
("
$templtp
");
}
else
{
warning
("
Could not get ltpmap
");
}
unlink
("
$tempmap
");
unlink
("
$templt
");
unlink
("
$templtp
");
}
tmcd/tmcd.c
View file @
f3c23007
...
...
@@ -8136,7 +8136,7 @@ COMMAND_PROTOTYPE(dotopomap)
reqp
->
pid
,
reqp
->
eid
);
if
((
fp
=
fopen
(
buf
,
"r"
))
==
NULL
)
{
errorc
(
"DOTOPOMAP: Could not open topomap for %s
:
"
,
errorc
(
"DOTOPOMAP: Could not open topomap for %s"
,
reqp
->
nodeid
);
return
1
;
}
...
...
@@ -8173,7 +8173,7 @@ COMMAND_PROTOTYPE(doltmap)
reqp
->
pid
,
reqp
->
eid
);
if
((
fp
=
fopen
(
buf
,
"r"
))
==
NULL
)
{
errorc
(
"DOLTMAP: Could not open ltmap for %s
:
"
,
errorc
(
"DOLTMAP: Could not open ltmap for %s"
,
reqp
->
nodeid
);
return
1
;
}
...
...
utils/testbed-control.in
View file @
f3c23007
...
...
@@ -28,6 +28,7 @@ my $TB = "@prefix@";
my
$TBOPS
=
"
@TBOPSEMAIL
@
";
my
$SETSITEVAR
=
"
$TB
/sbin/setsitevar
";
my
$STARTUP
=
"
/usr/local/etc/rc.d/3.testbed.sh
";
my
$FRISBEE
=
"
$TB
/sbin/frisbeelauncher
";
# Protos
sub
Fatal
($);
...
...
@@ -45,6 +46,7 @@ use lib "@prefix@/lib";
use
libdb
;
use
libtestbed
;
use
libEmulab
;
use
Image
;
#
# Parse command arguments.
...
...
@@ -161,6 +163,21 @@ system("$STARTUP stop >/dev/null 2>&1");
if
(
$?
)
{
Fatal
("
Could not stop testbed daemons. Stopping. Best to reboot!
");
}
my
$activeimages
=
Image
->
ActiveImages
();
if
(
defined
(
$activeimages
))
{
my
@activeimages
=
@
{
$activeimages
};
if
(
@activeimages
)
{
print
"
** Stopping running frisbee processes ...
\n
";
}
foreach
my
$image
(
@activeimages
)
{
my
$imageid
=
$image
->
imageid
();
print
"
-> Killing frisbee for
$image
...
\n
";
system
("
$FRISBEE
-k
$imageid
");
if
(
$?
)
{
Fatal
("
Could not stop frisbee for
$image
!
");
}
}
}
print
"
** Testbed is stopped. Safe to power off or reboot
\n
";
exit
(
0
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment