Commit 678356c2 authored by Mike Hibler's avatar Mike Hibler

Create NULL topomap for system experiments.

Yes this is silly, but it pissed me off.  Nodes that came up in a system
experiment like hwdown or reloading would wind up TBFAILED because rc.topomap
would fail.  Now boss-install will create a null map when these are setup.
An update script takes care of existing installs.
parent c161fc3a
...@@ -112,6 +112,7 @@ my $BATCHEXP = "$PREFIX/bin/batchexp"; ...@@ -112,6 +112,7 @@ my $BATCHEXP = "$PREFIX/bin/batchexp";
my $NAMED_SETUP = "$PREFIX/sbin/named_setup"; my $NAMED_SETUP = "$PREFIX/sbin/named_setup";
my $ADDPUBKEY = "$PREFIX/sbin/addpubkey"; my $ADDPUBKEY = "$PREFIX/sbin/addpubkey";
my $TBACCT = "$PREFIX/sbin/tbacct"; my $TBACCT = "$PREFIX/sbin/tbacct";
my $GENTOPOFILE = "$PREFIX/libexec/gentopofile";
my $WWWDIR = "$PREFIX/www"; my $WWWDIR = "$PREFIX/www";
my $CRACKLIB_DICT = "/usr/local/lib/pw_dict.pwd"; my $CRACKLIB_DICT = "/usr/local/lib/pw_dict.pwd";
...@@ -1622,6 +1623,11 @@ Phase "experiments", "Setting up system experiments", sub { ...@@ -1622,6 +1623,11 @@ Phase "experiments", "Setting up system experiments", sub {
" -L 'System Experiment' ". " -L 'System Experiment' ".
" -E '$desc - DO NOT DELETE' ". " -E '$desc - DO NOT DELETE' ".
" -p $pid -e $eid"); " -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");
}; };
} }
}; };
......
#
# 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;
...@@ -126,13 +126,16 @@ sub docleanup() ...@@ -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() sub dotopomap()
{ {
# #
# Copy over the topomap so that it is locally resident. We will eventually # Copy over the topomap so that it is locally resident.
# get this via a tarfile instead of NFS.
# #
my $datadir = EXPDIR() . "/tbdata"; my $datadir = EXPDIR() . "/tbdata";
my $topomap = "$datadir/topomap.gz"; my $topomap = "$datadir/topomap.gz";
...@@ -169,40 +172,25 @@ sub dotopomap() ...@@ -169,40 +172,25 @@ sub dotopomap()
if (! -e $tempmap) { if (! -e $tempmap) {
# #
# Try using tmcc. It returns compressed data so do it directly. # 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"); 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) { if (! -e $templt) {
# #
# Try using tmcc. It returns compressed data so do it directly. # 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"); 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) { if (! -e $templtp) {
# #
# Try using tmcc. It returns compressed data so do it directly. # 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"); 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) { if (-s $tempmap) {
...@@ -210,9 +198,14 @@ sub dotopomap() ...@@ -210,9 +198,14 @@ sub dotopomap()
if ($?) { if ($?) {
fatal("Could not unzip topomap"); fatal("Could not unzip topomap");
} }
unlink("$tempmap");
} }
else { 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"); fatal("Could not get topomap");
} }
...@@ -221,7 +214,6 @@ sub dotopomap() ...@@ -221,7 +214,6 @@ sub dotopomap()
if ($?) { if ($?) {
fatal("Could not unzip ltmap"); fatal("Could not unzip ltmap");
} }
unlink("$templt");
} }
else { else {
warning("Could not get ltmap"); warning("Could not get ltmap");
...@@ -232,9 +224,12 @@ sub dotopomap() ...@@ -232,9 +224,12 @@ sub dotopomap()
if ($?) { if ($?) {
fatal("Could not unzip ltpmap"); fatal("Could not unzip ltpmap");
} }
unlink("$templtp");
} }
else { else {
warning("Could not get ltpmap"); warning("Could not get ltpmap");
} }
unlink("$tempmap");
unlink("$templt");
unlink("$templtp");
} }
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