Commit 273f0f2c authored by Mike Hibler's avatar Mike Hibler

Reduce number of boottime TMCD calls:

 * ipodinfo and watchdoginfo are now fullconfig commands
 * ipod setup moved later in startup to take advantage of fullconfig
 * watchdog changed to use cached info on the first call
 * move firewall setup later to take advantage of fullconfig
Other stuff:
 * accounts/ipodinfo cache files protected 600

Along with Tim's changes, this should eliminate 4 more boot time calls!
parent f6be6f33
......@@ -96,7 +96,8 @@ elsif (WINDOWS()) {
);
}
else {
@bootscripts = ("rc.misc", "rc.localize", "rc.keys", "rc.mounts",
@bootscripts = ("rc.firewall",
"rc.misc", "rc.localize", "rc.keys", "rc.mounts",
"rc.topomap", "rc.accounts",
"rc.route", "rc.tunnels", "rc.ifconfig", "rc.delays",
"rc.hostnames", "rc.trace",
......
......@@ -73,12 +73,11 @@ sub firewallee();
#configtmcc("portnum", 7778);
#
# XXX At the moment, rc.firewall is run before bootsetup(), so we need to clear
# the cache manually or we might get bad config data. Note that nother side
# effect of running before bootsetup() is that we don't get the config through
# the 'fullconfig' call, it is a separate connection.
# XXX for debugging default rules: make sure we always fetch
# from boss so we can pick up changes without rebooting using
# "/usr/local/etc/emulab/rc/rc.firewall reconfig"
#
configtmcc("nocache", 1);
#configtmcc("nocache", 1);
# Allow default above.
if (@ARGV) {
......
......@@ -123,7 +123,7 @@ my %commandset =
"status" => {TAG => "status"},
"state" => {TAG => "state"},
"ifconfig" => {TAG => "ifconfig"},
"accounts" => {TAG => "accounts"},
"accounts" => {TAG => "accounts", PERM => "0600"},
"delay" => {TAG => "delay"},
"hostnames" => {TAG => "hostnames"},
"rpms" => {TAG => "rpms"},
......@@ -149,6 +149,7 @@ my %commandset =
"syncserver" => {TAG => "syncserver"},
"keyhash" => {TAG => "keyhash"},
"nodeid" => {TAG => "nodeid"},
"ipodinfo" => {TAG => "ipodinfo", PERM => "0600"},
"ntpinfo" => {TAG => "ntpinfo"},
"ntpdrift" => {TAG => "ntpdrift"},
"sdparams" => {TAG => "sdparams"},
......@@ -561,6 +562,20 @@ sub tmccgetconfig()
my $param = $1;
if (open(TD, "> $cdir/$param")) {
#
# Set the permission on the file first if necessary
# XXX the commandset hash is odd
#
foreach my $key (keys(%commandset)) {
my $tag = $commandset{$key}->{TAG};
if ($param eq $tag) {
if (defined($commandset{$key}->{PERM})) {
chmod(oct($commandset{$key}->{PERM}),
"$cdir/$param");
}
last;
}
}
while (@tmccresults) {
$str = shift(@tmccresults);
......
......@@ -187,16 +187,6 @@ sub doboot()
}
}
#
# Get the firewall up
#
if (-x "$RCDIR/rc.firewall") {
system("$RCDIR/rc.firewall");
if ($?) {
fatal("Error running $RCDIR/rc.firewall");
}
}
if (-x "$BINDIR/tbshutdown" && ! WINDOWS()) {
print("Starting up shutdown notification daemon\n");
system("$BINDIR/tbshutdown");
......@@ -205,12 +195,6 @@ sub doboot()
}
}
if (-x "$RCDIR/rc.ipod" && ! WINDOWS()) {
print("Setting up Ping of Death\n");
system("$RCDIR/rc.ipod");
# This is allowed to fail; ipod might not be supported.
}
print("Informing Emulab Control that we have rebooted\n");
if (tmcc(TMCCCMD_STATE, "TBSETUP") < 0) {
fatal("Error sending TBSETUP to Emulab Control!");
......@@ -223,6 +207,12 @@ sub doboot()
#
# This stuff is run regardless of reservation status.
#
if (-x "$RCDIR/rc.ipod" && ! WINDOWS()) {
print("Setting up Ping of Death\n");
system("$RCDIR/rc.ipod");
# This is allowed to fail; ipod might not be supported.
}
if (-x "$RCDIR/rc.healthd" && ! WINDOWS()) {
print("Starting node health monitoring daemon\n");
system("$RCDIR/rc.healthd start");
......
......@@ -398,8 +398,13 @@ sub setintervals($)
logmsg("setintervals: refetching intervals, retry=$retry{check}\n", 1);
}
#
# Note that the first watchdoginfo call will use the cache. The info
# should be fresh and it helps reduce the boottime load on the tmcd
# server.
#
my %tmccargs = ();
$tmccargs{nocache} = 1;
$tmccargs{nocache} = !$firsttime;
$tmccargs{timeout} = 3;
$tmccargs{useudp} = 1
if (!$trytcp || $retry{check} != $maxretries);
......
......@@ -294,7 +294,7 @@ struct command {
{ "vnodelist", FULLCONFIG_PHYS, 0, dovnodelist},
{ "subnodelist", FULLCONFIG_PHYS, 0, dosubnodelist},
{ "isalive", FULLCONFIG_NONE, F_REMUDP|F_MINLOG, doisalive},
{ "ipodinfo", FULLCONFIG_NONE, 0, doipodinfo},
{ "ipodinfo", FULLCONFIG_PHYS, 0, doipodinfo},
{ "ntpinfo", FULLCONFIG_PHYS, 0, dontpinfo},
{ "ntpdrift", FULLCONFIG_NONE, 0, dontpdrift},
{ "jailconfig", FULLCONFIG_VIRT, F_ALLOCATED, dojailconfig},
......@@ -309,7 +309,7 @@ struct command {
{ "routelist", FULLCONFIG_PHYS, F_ALLOCATED, doroutelist},
{ "role", FULLCONFIG_PHYS, F_ALLOCATED, dorole},
{ "rusage", FULLCONFIG_NONE, F_REMUDP|F_MINLOG, dorusage},
{ "watchdoginfo", FULLCONFIG_NONE, F_REMUDP|F_MINLOG, dodoginfo},
{ "watchdoginfo", FULLCONFIG_ALL, F_REMUDP|F_MINLOG, dodoginfo},
{ "hostkeys", FULLCONFIG_NONE, 0, dohostkeys},
{ "tmcctest", FULLCONFIG_NONE, F_MINLOG, dotmcctest},
{ "firewallinfo", FULLCONFIG_ALL, 0, dofwinfo},
......
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