Commit ea73e3b0 authored by Mike Hibler's avatar Mike Hibler
Browse files

Make Linux delaysetup work for both 7.x and 9.0 for linkdelays.

Rename a couple of really misleading sounding functions and make
sure that linktest does get run for linkdelay nodes.
parent 3509a92b
......@@ -24,7 +24,7 @@ use Exporter;
TBDebugTimeStamp TBDebugTimeStampsOn
MFS REMOTE CONTROL JAILED PLAB LOCALROOTFS IXP USESFS
SIMTRAFGEN SIMHOST ISDELAYNODE JAILHOST
SIMTRAFGEN SIMHOST ISDELAYNODEPATH JAILHOST DELAYHOST
CONFDIR TMDELAY TMJAILNAME TMSIMRC TMCC
TMNICKNAME TMSTARTUPCMD FINDIF
......@@ -164,8 +164,8 @@ use liblocsetup;
sub TMCC() { "$BINDIR/tmcc"; }
sub FINDIF() { "$BINDIR/findif"; }
sub TMUSESFS() { "$BOOTDIR/usesfs"; }
sub ISSIMTRAFGEN() { "$BOOTDIR/simtrafgen"; }
sub ISDELAYNODE() { "$BOOTDIR/isdelaynode"; }
sub ISSIMTRAFGENPATH() { "$BOOTDIR/simtrafgen"; }
sub ISDELAYNODEPATH() { "$BOOTDIR/isdelaynode"; }
sub TMTOPOMAP() { "$BOOTDIR/topomap";}
#
......@@ -274,11 +274,14 @@ sub IXP() { if ($inixp) { return $vnodeid; } else { return 0; } }
# Are we hosting a simulator or maybe just a NSE based trafgen.
#
sub SIMHOST() { if ($role eq "simhost") { return 1; } else { return 0; } }
sub SIMTRAFGEN(){ if (-e ISSIMTRAFGEN()) { return 1; } else { return 0; } }
sub SIMTRAFGEN(){ if (-e ISSIMTRAFGENPATH()) { return 1; } else { return 0; } }
# A jail host?
sub JAILHOST() { if ($role eq "virthost") { return 1; } else { return 0; } }
# A delay host? Either a delay node or a node using linkdelays
sub DELAYHOST() { if (-e ISDELAYNODEPATH()) { return 1; } else { return 0; } }
#
# Is this node using SFS. Several scripts need to know this.
#
......@@ -291,7 +294,7 @@ sub cleanup_node ($) {
my ($scrub) = @_;
print STDOUT "Cleaning node; removing configuration files\n";
unlink TMUSESFS, TMROLE, ISSIMTRAFGEN;
unlink TMUSESFS, TMROLE, ISSIMTRAFGENPATH;
#
# If scrubbing, also remove the password/group files and DBs so
......@@ -779,7 +782,7 @@ sub gettrafgenconfig($)
# Flag node as doing NSE trafgens for other scripts.
#
if ($trafgen->{"GENERATOR"} eq "NSE") {
system("touch " . ISSIMTRAFGEN);
system("touch " . ISSIMTRAFGENPATH);
next;
}
}
......
......@@ -28,11 +28,15 @@ BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
use libsetup;
use libtmcc;
# XXX this only works if called after linkdelay setup as is the case here
sub LINKDELAYHOST() { if (-e TMLINKDELAY()) { return 1; } else { return 0; } }
#
# Exit if not a valid node to run linktest on.
#
exit(0)
if (MFS() || REMOTE() || SIMHOST() || JAILHOST() || ISDELAYNODE());
if (MFS() || REMOTE() || SIMHOST() || JAILHOST() ||
(DELAYHOST() && !LINKDELAYHOST()));
#
# Parse command arguments. Once we return from getopts, all that should be
......
......@@ -352,7 +352,7 @@ sub DelaySetup
# Touch this file so that we globally know that the node is a delay
# node. See routing setup. Need to avoid fastforwarding whenever we
# have link delays.
system("touch " . ISDELAYNODE());
system("touch " . ISDELAYNODEPATH());
#
# Now do kernel configuration. All of the above work is wasted,
......@@ -581,7 +581,7 @@ sub LinkDelaySetup
# Touch this file so that we globally know that the node is a delay
# node. See routing setup. Need to avoid fastforwarding whenever we
# have link delays.
system("touch " . ISDELAYNODE());
system("touch " . ISDELAYNODEPATH());
#
# Now do kernel configuration. All of the above work is wasted,
......
......@@ -390,7 +390,7 @@ sub os_setup()
sub os_routing_enable_forward()
{
my $cmd;
my $fname = libsetup::ISDELAYNODE();
my $fname = libsetup::ISDELAYNODEPATH();
if (REMOTE()) {
$cmd = "echo 'IP forwarding not turned on!'";
......
......@@ -62,12 +62,21 @@ if (@ARGV) {
#
# Delay node configuration goop.
#
my $KERNEL100 = "2.4.18-27.7.x";
my $KERNELJAIL = "";
my $KERNELLDELAY= "2.4.18-LINKDELAY"; # Link delay kernel.
# The kernel identifiers are just tags to differentiate kernels.
# These tags should be the LILO identifiers (labels) and the tag should
# appear somewher in the kernel name returned via osversion.
# XXX however because we gave no thought to kernel naming in 7.x, the
# default kernel doesn't adhere to this convention. So all we can do
# for sure is recognize that we are not running a linkdelay kernel and
# switch to it.
#
my $KERNEL100 = "emulab";
my $KERNELJAIL = "jail";
my $KERNELLDELAY= "linkdelay";
my $TMDELMAP = TMDELMAP; # Really comes from libloc.
my $TC = "/usr/local/bin/tc";
my $IPTABLES = "/usr/local/bin/iptables";
my $TC = "tc"; # May be in /usr/local/{sbin,bin}
my $IPTABLES = "iptables"; # May be in /usr/local/{sbin,bin}
# This should never happen!
if (REMOTE() || MFS()) {
......@@ -327,7 +336,7 @@ sub LinkDelaySetup()
# Touch this file so that we globally know that the node is a delay
# node.
system("touch " . ISDELAYNODE());
system("touch " . ISDELAYNODEPATH());
#
# Now do kernel configuration. All of the above work is wasted,
......@@ -351,31 +360,25 @@ sub checkkernel($)
{
my $kernel = shift;
my $VMLINUZ = "/boot/vmlinuz";
print STDOUT "Making sure node is running $kernel ... \n";
print STDOUT "Making sure node is running $kernel kernel... \n";
my $kernvers = `cat /proc/sys/kernel/osrelease`;
chomp $kernvers;
if (!$kernvers) {
print STDERR "Unable to determine running kernel version.\n";
return 1;
return;
}
if (! ($kernvers =~ /$kernel/)) {
if (-e "$VMLINUZ-$kernel") {
unlink($VMLINUZ) &&
symlink("$VMLINUZ-$kernel", $VMLINUZ) ||
do {
print STDERR "Error linking to new kernel\n";
return 1;
};
if (system ("/sbin/lilo")) {
print STDERR "Error running lilo.\n";
return 1;
}
if (!($kernvers =~ /$kernel/i)) {
# XXX only works for linkdelay right now
return if ($kernel ne $KERNELLDELAY);
my $lilocmd = "/sbin/lilo -D $kernel";
if (system ($lilocmd)) {
print STDERR "Error ($?) running '$lilocmd'\n";
return 1;
}
system("sync");
......
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