Commit 8551d9a7 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

A bunch of little changes to make the Redhat 9.0 image work in a

passable manner. Mostly this change overwrites Mike's changes for
dealing with the pump race. Rather than setting ONBOOT="yes" for all
interfaces (which is what triggers the pump race), only set the control
interface to ONBOOT="yes", all the others get ONBOOT="no" so that
ifup will not be called on them. Also remove the hostname set from the
ifcfg scripts since that totally messes up dhclient-script, which is what
is used in Redhat 9.0 (instead of pump).

The problem with ONBOOT="no" is that the interfaces will not get
probed if ifup is not called. This messes up testbed ifconfig later.
So, added an rc.linux script that does just the probe for all interfaces.
This script is called from rc.bootsetup, if rc."osname" exists.
parent 1e8832a9
......@@ -11,7 +11,7 @@
package librc;
use Exporter;
@ISA = "Exporter";
@EXPORT = qw(fatal warning scriptname);
@EXPORT = qw(fatal warning scriptname logit);
# Must come after package declaration!
use English;
......@@ -31,6 +31,17 @@ BEGIN
import emulabpaths;
}
#
# Log something to the console. The image will setup syslogd.conf so that
# local5.err goes to the console!
#
sub logit($$)
{
my ($tag, $msg) = @_;
system("logger -p local5.err -i -t $tag '$msg'");
}
#
# Fatal error. Display and die.
#
......
......@@ -547,6 +547,12 @@ sub docleanup()
{
my $pdb = $PASSDB . ".db";
my $gdb = $GROUPDB . ".db";
# RHL9 sillyness; they do not append the .db suffix!
unlink $PASSDB
if (-e $PASSDB);
unlink $GROUPDB
if (-e $GROUPDB);
unlink $pdb
if (-e $pdb);
......
......@@ -7,6 +7,7 @@
use English;
use Getopt::Std;
use POSIX ":sys_wait_h";
use POSIX qw(setsid);
sub usage()
{
......@@ -134,6 +135,32 @@ sub doboot()
my ($pid, $eid, $vname) = check_nickname();
#
# Now daemonize and let the boot continue. We have to disconnect and
# change our session id so that we do not killed off (nor the trafgen
# children) when boot script terminates. This cause the trafgen does not
# properly disconnect and it gets killed once /etc/rc exits. Not sure
# exactly why this is, but this is how I deal with it! The downside is
# that we cannot report errors to the caller. We have to catch them
# later, somehow.
#
if (TBBackGround($LOGFILE)) {
sleep(2);
exit(0);
}
# Fully disconnect from bootup.
setsid();
#
# Write our pid to a file so we can be killed later.
#
system("echo '$PID' > $PIDFILE") == 0
or fatal("Could not create $PIDFILE!");
$SIG{TERM} = \&Pcleanup;
$SIG{INT} = \&Pcleanup;
$SIG{HUP} = \&Pcleanup;
# We connect to the local elvind and talk to the master via the proxy.
my $cmdline = "$BINDIR/trafgen -s localhost ";
if ($pid) {
......@@ -198,44 +225,26 @@ sub doboot()
}
#
# Quick check to see if any trafgens exited.
# Loop, waiting for children to exit. They are not supposed to, so if
# they do its an error. Log that to the console in the hope that someone
# is looking!
#
while ((my $childpid = waitpid(-1, &WNOHANG)) != 0) {
while ((my $childpid = waitpid(-1, 0)) != 0) {
foreach my $name (keys(%trafgenpids)) {
if ($trafgenpids{$name} == $childpid) {
warning("Trafgen $name failed to run properly!");
logit("trafgen", "Trafgen $name has exited with status $?");
delete($trafgenpids{$name});
last;
}
}
$errors++;
# No more running, might as well stop now.
last
if (! scalar(keys(%trafgenpids)));
sleep(1);
}
#
# Now daemonize and let the boot continue.
#
if (TBBackGround($LOGFILE)) {
exit($errors);
}
#
# Write our pid to a file so we can be killed later.
#
system("echo '$PID' > $PIDFILE") == 0
or fatal("Could not create $PIDFILE!");
$SIG{TERM} = \&Pcleanup;
$SIG{INT} = \&Pcleanup;
$SIG{HUP} = \&Pcleanup;
#
# Just wait. We will die via the signal handler above.
#
while (1) {
sleep(10000);
}
return;
logit("trafgen", "All trafgens have exited!");
exit($errors);
}
#
......
......@@ -6,6 +6,7 @@
#
use English;
use Getopt::Std;
use POSIX qw(setsid);
sub usage()
{
......@@ -263,6 +264,9 @@ sub doboot()
$SIG{INT} = 'IGNORE';
$SIG{HUP} = 'DEFAULT';
open(STDIN, "</dev/null") or
fatal("opening /dev/null for STDIN: $!");
# Redirect stdout/stderr to log file.
open(STDOUT, ">>$log")
or fatal("Could not redirect STDOUT");
......
......@@ -114,6 +114,18 @@ sub doboot()
fatal("Could not determine the name of the boss server!");
}
#
# Check for an os dependent initialization script.
#
my $os_script = "rc." . lc($OSNAME);
if (-x "$RCDIR/$os_script") {
system("$RCDIR/$os_script");
if ($?) {
fatal("Error running $RCDIR/$os_script");
}
}
#
# Check for kernel rename first. Probably not required so early.
#
......@@ -135,9 +147,7 @@ sub doboot()
if (-x "$RCDIR/rc.ipod") {
print("Setting up Ping of Death\n");
system("$RCDIR/rc.ipod");
if ($?) {
fatal("Error running $RCDIR/rc.ipod");
}
# This is allowed to fail; ipod might not be supported.
}
print("Informing Emulab Control that we have rebooted\n");
......
......@@ -73,6 +73,8 @@ etc-install: dir-install sysetc-remove sysetc-install
sysetc-install: dir-install
$(INSTALL) -m 644 ./pump.conf $(SYSETCDIR)/pump.conf
$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
$(SYSETCDIR)/dhclient-exit-hooks
$(INSTALL) -m 644 $(SRCDIR)/modules.conf $(SYSETCDIR)/modules.conf
$(INSTALL) -m 755 $(SRCDIR)/ifcfg-eth0 \
$(SYSETCDIR)/sysconfig/network-scripts/ifcfg-eth0
......@@ -108,18 +110,21 @@ sysetc-remove:
script-install: dir-install
$(INSTALL) -m 755 $(SRCDIR)/liblocsetup.pm $(BINDIR)/liblocsetup.pm
$(INSTALL) -m 755 $(SRCDIR)/rc.linux $(BINDIR)/rc/rc.linux
$(INSTALL) -m 755 $(SRCDIR)/rc.ipod $(BINDIR)/rc/rc.ipod
$(INSTALL) -m 755 $(SRCDIR)/prepare $(BINDIR)/prepare
$(INSTALL) -m 755 $(SRCDIR)/ixpboot $(BINDIR)/ixpboot
$(INSTALL) -m 755 $(SRCDIR)/rc.ixp $(BINDIR)/rc/rc.ixp
$(INSTALL) -m 755 $(SRCDIR)/sethostname $(BINDIR)/sethostname
$(INSTALL) -m 755 $(SRCDIR)/sethostname.dhclient \
$(BINDIR)/sethostname.dhclient
$(INSTALL) -m 755 $(SRCDIR)/rc.healthd $(BINDIR)/rc/rc.healthd
$(INSTALL) -m 755 $(SRCDIR)/chipset.awk $(BINDIR)/chipset.awk
$(INSTALL) -m 755 $(SRCDIR)/cpuspeed.awk $(BINDIR)/cpuspeed.awk
$(INSTALL) -m 755 $(SRCDIR)/delaysetup $(BINDIR)/delaysetup
$(INSTALL) -m 755 $(SRCDIR)/nodetype $(BINDIR)/nodetype
$(INSTALL) -m 755 $(SRCDIR)/control_interface \
$(BINDIR)/control_interface
$(BINDIR)/control_interface
sfs-install:
$(INSTALL) -m 755 -o root -g wheel -d $(DESTDIR)/etc/sfs
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# A note about Linux. Redhat 9.0 appears to use dhclient instead of pump.
# We maintain/install both variants though to make life easier.
#
date >> $LOGDIR/dhclient.log
echo "$reason" >> $LOGDIR/dhclient.log
#
# Remember our server IP, real hostname, router IP, etc.
#
if [ x$reason = xREBOOT ] || [ x$reason = xBOUND ] || \
[ x$reason = xRENEW ] || [ x$reason = xREBIND ]; then
echo $new_dhcp_server_identifier > $BOOTDIR/bossip
echo $new_host_name > $BOOTDIR/realname
echo $new_routers > $BOOTDIR/routerip
echo $new_ip_address > $BOOTDIR/myip
echo $new_subnet_mask > $BOOTDIR/mynetmask
#
# See if the Testbed configuration software wants to change the hostname.
#
$BINDIR/sethostname.dhclient >>$LOGDIR/dhclient.log 2>&1
#
# Once we have an IP address, we can stop dhclient so that it doesn't get
# in the way
#
# I'd love to use the dhclient.pid file, but it helpfully has not been
# created at this point
#killall dhclient
fi
exit 0
......@@ -4,10 +4,11 @@ DEVICE="eth0"
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
NEEDHOSTNAME=""
hostname emulab-localhost
ONBOOT="yes"
else
ONBOOT="no"
fi
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
......
......@@ -4,10 +4,11 @@ DEVICE="eth1"
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
NEEDHOSTNAME=""
hostname emulab-localhost
ONBOOT="yes"
else
ONBOOT="no"
fi
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
......
......@@ -4,10 +4,11 @@ DEVICE="eth2"
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
NEEDHOSTNAME=""
hostname emulab-localhost
ONBOOT="yes"
else
ONBOOT="no"
fi
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
......
......@@ -4,10 +4,11 @@ DEVICE="eth3"
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
NEEDHOSTNAME=""
hostname emulab-localhost
ONBOOT="yes"
else
ONBOOT="no"
fi
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
......
......@@ -4,10 +4,11 @@ DEVICE="eth4"
if [ "`control_interface`" = "$DEVICE" ]; then
BOOTPROTO="dhcp"
NEEDHOSTNAME=""
hostname emulab-localhost
ONBOOT="yes"
else
ONBOOT="no"
fi
ONBOOT="yes"
IPADDR=""
NETMASK=""
IPXNETNUM_802_2=""
......
#/bin/sh -
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2004 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# Probe all of the network interfaces to make sure they are brought online.
# This is absurd. I use the support function located in the network-functions
# sh script.
#
. /etc/sysconfig/network-scripts/network-functions
#
# Probe a bunch of ethX devices. We setup /etc/modules.conf so that all
# network cards are so named. is_available will not do anything if the
# device type is already probed, or if no such device type exists.
#
echo "Probing a bunch of ethX devices ..."
is_available eth0
is_available eth1
is_available eth2
is_available eth3
is_available eth4
is_available eth5
is_available eth6
exit 0
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -60,6 +60,20 @@ if (! $nickname) {
}
$nickname = lc($nickname);
# Taint check to make perl happy
if ($nickname =~ /^([-\w\.]+)$/) {
$nickname = $1;
}
else {
die("Bad data in nickname: '$nickname'\n");
}
if ($domain =~ /^([-\w\.]+)$/) {
$domain = $1;
}
else {
die("Bad data in nickname: '$domain'\n");
}
print STDOUT "Resetting hostname to ${nickname}${domain} ... ";
if (system("hostname", "${nickname}${domain}")) {
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2004 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
#
# Set the hostname for the node according to the current experiment.
# Run from /etc/dhclient-exit-hooks.
#
# usage: sethostname
#
# A note about Linux. Redhat 9.0 appears to use dhclient instead of pump.
# We maintain/install both variants though to make life easier.
#
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
#
# Turn off line buffering on output
#
$| = 1;
#
# Load the OS independent support library. It will load the OS dependent
# library and initialize itself.
#
use libsetup;
use libtmcc;
#
# We assume that we are in the same domain as our boss node
#
my $bossname = tmccbossname();
if ($bossname =~ /^[^\.]+\.(.*)$/) {
$domain = ".$1";
}
else {
$domain = ".foo.net";
}
my $nickname = whatsmynickname();
if (! $nickname) {
print STDOUT "No Testbed nickname available!\n";
exit(0);
}
$nickname = lc($nickname);
# Taint check to make perl happy
if ($nickname =~ /^([-\w\.]+)$/) {
$nickname = $1;
}
else {
die("Bad data in nickname: '$nickname'\n");
}
if ($domain =~ /^([-\w\.]+)$/) {
$domain = $1;
}
else {
die("Bad data in nickname: '$domain'\n");
}
#
# Set hostname. This output is redirected to log file by caller.
#
print STDOUT "Resetting hostname to ${nickname}${domain} ... ";
system("/bin/hostname ${nickname}${domain}");
if ($?) {
print STDOUT "*** FAILED!\n";
exit 1;
}
print STDOUT "Done!\n";
exit 0;
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