Commit facc7acd authored by Leigh Stoller's avatar Leigh Stoller

Okay, first attempt to deal with os_setup waittimes on a per node_type

and per OSID basis.

* Added bios_waittime to node_types table and reboot_waittime to
  os_info table. Initialized them as follows:

        update node_types set bios_waittime=60 where class='pc';
        update os_info set reboot_waittime=150 where OS='Linux' or
	  OS='FreeBSD' or OS='NetBSD';
        update os_info set reboot_waittime=180 where OS=Windows';

* The bios waittime can be edited via the web interface.

* The reboot waittime can be set only by admin people right now; this
  is another case of something that maybe the user should not see
  cause its too much stuff? Instead, default values are established in
  www/osiddefs.php3.

* os_setup computes its per-node waitime as:

	(bios_waittime + reboot_waittime) * 2

  as per Mike's suggestion. If either value is not defined in the DB,
  it defaults the original 7 minute value.
parent 1f6a827d
......@@ -155,7 +155,7 @@ use vars qw(@ISA @EXPORT);
TBValidNodeLogType TBValidNodeName TBSetNodeLogEntry
TBSetSchedReload MapNodeOSID TBLockExp TBUnLockExp TBSetExpSwapTime
TBUnixGroupList TBOSID TBOSMaxConcurrent TBOSCountInstances
TBResolveNextOSID TBOsidToPid
TBResolveNextOSID TBOsidToPid TBOSIDRebootWaittime
TBOSLoadMaxOkay TBImageLoadMaxOkay TBImageID ExpSwapper
TBdbfork TBDBDisconnect VnameToNodeid TBExpLocked
TBIsNodeRemote TBExptSetLogFile TBExptClearLogFile TBExptGetLogFile
......@@ -169,7 +169,7 @@ use vars qw(@ISA @EXPORT);
TBNodeAllocCheck TBPlabNodeUsername MarkPhysNodeDown TBExptIsElabInElab
TBExptFirewall TBNodeFirewall TBSetExptFirewallVlan
TBNodeType TBNodeTypeProcInfo
TBNodeType TBNodeTypeProcInfo TBNodeTypeBiosWaittime
TBExptRemoveVirtualState TBExptBackupVirtualState
TBExptRestoreVirtualState
......@@ -2009,6 +2009,29 @@ sub TBOSMaxConcurrent ($)
return $row[0];
}
#
# Returns the reboot waittime.
#
# usage: TBOSIDRebootWaittime(char *osid)
# returns >= 1 if there is a waittime
# returns undef if there is no waittime
# returns 0 if not valid.
#
sub TBOSIDRebootWaittime ($)
{
my($osid) = @_;
my $query_result =
DBQueryFatal("select reboot_waittime from os_info where osid='$osid'");
if (! $query_result->num_rows) {
return 0;
}
my @row = $query_result->fetchrow_array();
return $row[0];
}
#
# Returns the number of nodes that are supposedly booting an OS. A list of
# nodes that should be excluded from this count can be given.
......@@ -3189,6 +3212,25 @@ sub TBNodeTypeProcInfo($)
return ($proc, $speed);
}
#
# Return a node's type bios waittime.
# returns >= 1 if there is a waittime
# returns undef if there is no waittime
# returns 0 if not valid.
#
sub TBNodeTypeBiosWaittime($)
{
my ($type) = @_;
my $query_result = DBQueryFatal("SELECT bios_waittime FROM node_types " .
"WHERE type='$type'");
if (! $query_result->num_rows) {
return 0;
}
my @row = $query_result->fetchrow_array();
return $row[0];
}
#
# Remove the virtual state of an experiment from the DB,
# returning the number of queries which didn't work.
......
......@@ -1072,6 +1072,7 @@ CREATE TABLE node_types (
simnode_capacity smallint(5) unsigned NOT NULL default '0',
trivlink_maxspeed int(11) unsigned NOT NULL default '0',
isrebootable tinyint(1) default '1',
bios_waittime int(10) unsigned default NULL,
PRIMARY KEY (type)
) TYPE=MyISAM;
......@@ -1282,6 +1283,7 @@ CREATE TABLE os_info (
nextosid varchar(35) default NULL,
max_concurrent int(11) default NULL,
mfs tinyint(4) NOT NULL default '0',
reboot_waittime int(10) unsigned default NULL,
PRIMARY KEY (osname,pid),
KEY osid (osid),
KEY OS (OS),
......
......@@ -2463,3 +2463,23 @@ last_net_act,last_cpu_act,last_ext_act);
alter table location_info add stamp int(10) unsigned default NULL;
1.316: Add bios_waittime to node_types table and reboot_waittime to
os_info table. Both in seconds.
alter table node_types add bios_waittime int(10) unsigned \
default NULL after isrebootable;
alter table os_info add reboot_waittime int(10) unsigned \
default NULL after mfs;
Insert bios wait times for your specific hardware types, or:
update node_types set bios_waittime=60 where class='pc';
Optionally update your os_info table with reboot times,
although os_setup will continue to use a default if not
specified.
update os_info set reboot_waittime=150 where OS='Linux' or
OS='FreeBSD' or OS='NetBSD';
update os_info set reboot_waittime=180 where OS=Windows';
......@@ -80,6 +80,9 @@ my %pnodevcount = ();
my %plabvnodes = ();
my %osids = ();
my %canfail = ();
my %bios_waittime = (); # Indexed by node_type.
my %reboot_waittime = (); # Indexed by osid.
my %node_types = (); # Indexed by node_id.
#
# Ah, Frisbee works so lets do auto reloading for nodes that do not have
......@@ -207,6 +210,7 @@ while (my %row = $db_result->fetchhash()) {
my $jailnode = $row{'jailflag'};
my $plabnode = $row{'isplabdslice'};
my $failmode = $row{'failureaction'};
my $bios_wait = $row{'bios_waittime'};
my $bootpath = 0;
#
......@@ -238,7 +242,9 @@ while (my %row = $db_result->fetchhash()) {
$reboots{$node} = 1;
}
}
$osids{$node} = $osid;
$osids{$node} = $osid;
$bios_waittime{$type} = $bios_wait;
$node_types{$node} = $type;
#
# Make sure the files specified in the paths exist. We mount the
......@@ -444,6 +450,15 @@ while (my %row = $db_result->fetchhash()) {
#
$canfail{$node} = (($failmode eq NODEFAILMODE_FATAL()) ? 0 : 1);
#
# Set the reboot waittime from the osid now that we have it
# finalized.
#
$osid = $osids{$node};
if (!exists($reboot_waittime{$osid})) {
$reboot_waittime{$osid} = TBOSIDRebootWaittime($osid);
}
print STDERR "$node - $osids{$node} - $canfail{$node}\n"
if $dbg;
}
......@@ -687,8 +702,16 @@ while ( @nodelist ) {
my $node = shift(@nodelist);
my $wstart = $waitstart{$node};
my $actual_state;
my $waittime = (60 * 7); # The default.
# Compute actual waittime.
if (defined($bios_waittime{$node_types{$node}}) &&
defined($reboot_waittime{$osids{$node}})) {
$waittime = ($bios_waittime{$node_types{$node}} +
$reboot_waittime{$osids{$node}}) * 2;
}
if (!TBNodeStateWait($node, $wstart, (60*7), \$actual_state,
if (!TBNodeStateWait($node, $wstart, $waittime, \$actual_state,
(TBDB_NODESTATE_TBFAILED, TBDB_NODESTATE_ISUP))) {
if ($actual_state eq TBDB_NODESTATE_TBFAILED) {
print "*** WARNING: $node reported a TBFAILED event; ".
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -255,6 +255,17 @@ function SPITFORM($node_type, $formfields, $errors)
</td>
</tr>\n";
echo "<tr>
<td>Bios reboot wait time:<br>
(in seconds)</td>
<td class=left>
<input type=text
name=\"formfields[bios_waittime]\"
value=\"" . $formfields[bios_waittime] . "\"
size=6>
</td>
</tr>\n";
echo "<tr>
<td>isvirtnode:</td>
<td class=left>
......@@ -363,6 +374,7 @@ if ($new_type) {
"delay_capacity" => 2, "disktype" => "ad", "isvirtnode" => 0,
"isremotenode" => 0, "issubnode" => 0, "isplabdslice" => 0,
"ismodelnet" => 0, "isjailed" => 0, "isdynamic" => 0,
"bios_waittime" => 0,
"issimnode" => 0, "simnode_capacity" => 20, "bootdisk_unit" => 0);
} else {
#
......@@ -617,6 +629,16 @@ if (isset($formfields[bootdisk_unit]) && $formfields[bootdisk_unit] != "") {
}
}
# bios_waittime
if (isset($formfields[bios_waittime]) && $formfields[bios_waittime] != "") {
if (! TBvalid_integer($formfields[bios_waittime])) {
$errors["bios_waittime"] = TBFieldErrorString();
}
else {
$inserts["bios_waittime"] = $formfields[bios_waittime];
}
}
# isvirtnode
if (isset($formfields[isvirtnode]) && $formfields[isvirtnode] != "") {
if (! TBvalid_boolean($formfields[isvirtnode])) {
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -576,6 +576,18 @@ function SPITFORM($formfields, $errors)
</td>
</tr>\n";
#
# Reboot waittime.
#
echo "<tr>
<td>Reboot Waittime (seconds):</td>
<td class=left>
<input type=text
name=\"formfields[reboot_waittime]\"
value=\"" . $formfields[reboot_waittime] . "\"
size=4 maxlength=4>
</td>
</tr>\n";
}
echo "<tr>
......@@ -975,6 +987,9 @@ if (isset($formfields[node]) &&
$node = $formfields[node];
}
#
# Max concurrent
#
if (isset($formfields[max_concurrent]) &&
strcmp($formfields[max_concurrent],"")) {
......@@ -987,6 +1002,29 @@ if (isset($formfields[max_concurrent]) &&
$max_concurrent = "NULL";
}
#
# Reboot waittime. Only admin users can set this. Grab default
# if not set.
#
if (isset($formfields[reboot_waittime]) &&
strcmp($formfields[reboot_waittime],"")) {
if (!$isadmin) {
$errors["Reboot Waittime"] = "Not enough permission";
}
elseif (!TBvalid_integer($formfields[reboot_waittime])) {
$errors["Reboot Waittime"] = TBFieldErrorString();
}
$reboot_waittime = $formfields[reboot_waittime];
}
else {
if (! array_key_exists($formfields[os_name], $osid_reboot_waitlist)) {
$errors["Reboot Waittime"] = "No default reboot waittime for OS";
}
else {
$reboot_waittime = $osid_reboot_waitlist[$formfields[os_name]];
}
}
#
# If any errors, respit the form with the current values and the
# error messages displayed. Iterate until happy.
......@@ -1137,11 +1175,12 @@ DBQueryFatal("INSERT INTO images ".
DBQueryFatal("INSERT INTO os_info ".
"(osname, osid, ezid, description, OS, version, path, magic, ".
" osfeatures, pid, creator, shared, created, op_mode, ".
" max_concurrent) ".
" max_concurrent, reboot_waittime) ".
"VALUES ".
" ('$imagename', '$imageid', 1, '$description', '$os_name', ".
" '$os_version', NULL, NULL, '$os_features', '$pid', ".
" '$uid', $global, now(), '$op_mode', $max_concurrent)");
" '$uid', $global, now(), '$op_mode', $max_concurrent, ".
" $reboot_waittime)");
for ($i = 0; $i < count($mtypes_array); $i++) {
DBQueryFatal("REPLACE INTO osidtoimageid ".
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -202,6 +202,27 @@ if (isset($nextosid)) {
}
}
#
# Check the reboot_waittime. Only admin users can set this. Grab default
# if not set.
#
if (isset($reboot_waittime) && $reboot_waittime != "") {
if (!$isadmin) {
USERERROR("Setting reboot waittime requires admin mode!", 1);
}
elseif (!TBvalid_integer($reboot_waittime)) {
USERERROR("Reboot Waittime: ". TBFieldErrorString(), 1);
}
}
else {
if (! array_key_exists($OS, $osid_reboot_waitlist)) {
USERERROR("Operating System (OS) - No default reboot waittime", 1);
}
else {
$reboot_waittime = $osid_reboot_waitlist[$OS];
}
}
#
# And insert the record!
#
......@@ -235,11 +256,12 @@ if (TBValidOSID($osid)) {
$query_result =
DBQueryFatal("INSERT INTO os_info ".
"(osname, osid, description,OS,version,path,magic,op_mode, ".
" osfeatures, pid, shared, creator, mustclean, created) ".
" osfeatures, pid, shared, creator, mustclean, created, ".
" reboot_waittime) ".
"VALUES ('$osname', '$osid', '$description', '$OS', ".
" '$os_version', $os_path, '$os_magic', '$op_mode', ".
" '$os_features', '$pid', $os_shared, ".
" '$uid', $os_mustclean, now())");
" '$uid', $os_mustclean, now(), $reboot_waittime)");
DBQueryFatal("unlock tables");
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2002, 2004, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -206,6 +206,13 @@ if ($isadmin) {
<td><input type=checkbox name=os_clean value=Yep> Yes</td>
</tr>\n";
#
# Reboot Waittime.
#
echo "<tr>
<td>Reboot Waittime (seconds)</td>
<td><input type=\"text\" name=\"os_reboot_waittime\" size=5>
</tr>\n";
WRITEOSIDMENU("NextOsid", "nextosid", $osid_result, "none");
}
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
# Stuff for OSIDs. All this stuff should come from the DB instead!
......@@ -36,6 +36,16 @@ $osid_opmodes["NORMAL"] = 1;
define("TBDB_DEFAULT_OSID_OPMODE", "NORMALv2");
define("TBDB_MINIMAL_OPMODE", "MINIMAL");
# Default OSID boot wait timeouts. User is not allowed to edit this.
$osid_reboot_waitlist = array();
$osid_reboot_waitlist["Linux"] = 120;
$osid_reboot_waitlist["FreeBSD"] = 120;
$osid_reboot_waitlist["NetBSD"] = 120;
$osid_reboot_waitlist["Windows"] = 180;
$osid_reboot_waitlist["TinyOS"] = 60;
$osid_reboot_waitlist["Oskit"] = 60;
$osid_reboot_waitlist["Other"] = 60;
#
# Helper function to write out a menu.
#
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -65,6 +65,7 @@ $delay_osid = $noderow["delay_osid"];
$jail_osid = $noderow["jail_osid"];
$isvirtnode = $noderow["isvirtnode"];
$isremotenode = $noderow["isremotenode"];
$bios_waittime = $noderow["bios_waittime"];
TBOSInfo($osid, $osname, $pid);
TBOSInfo($jail_osid, $jail_osname, $pid);
......@@ -120,6 +121,13 @@ echo "<tr>
<td class=left>$max_interfaces</td>
</tr>\n";
if (isset($bios_waittime)) {
echo "<tr>
<td>Bios Waittime:</td>
<td class=left>$bios_waittime</td>
</tr>\n";
}
echo "<tr>
<td>Delay Capacity:</td>
<td class=left>$delay_capacity</td>
......
......@@ -1261,6 +1261,7 @@ function SHOWOSINFO($osid) {
$mustclean = $osrow[mustclean];
$nextosid = $osrow[nextosid];
$max_concurrent = $osrow[max_concurrent];
$reboot_waittime= $osrow[reboot_waittime];
if (!$os_description)
$os_description = "&nbsp";
......@@ -1276,6 +1277,8 @@ function SHOWOSINFO($osid) {
$os_op_mode = "&nbsp";
if (!$created)
$created = "N/A";
if (!$reboot_waittime)
$reboot_waittime = "&nbsp";
#
# Generate the table.
......@@ -1346,6 +1349,11 @@ function SHOWOSINFO($osid) {
</tr>\n";
}
echo "<tr>
<td>Reboot Waittime: </td>
<td class=\"left\">$reboot_waittime</td>
</tr>\n";
echo "<tr>
<td>Shared?: </td>
<td class=left>\n";
......
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