Commit 6eacae5e authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add "nextosid" slot to os_info table, for chaining from a generic OSID

to a specific one, for the purposes of mapping things like FBSD-STD to
FBSD47-STD (the current OSID to use). This is technically more correct
than what os_setup used to do, which was map FBSD-STD to whatever
FreeBSD OSID was currently on the disk. Now it maps to a specific one,
and if that is not loaded, it sets up a reload.
parent 7655b031
......@@ -740,6 +740,7 @@ CREATE TABLE os_info (
shared tinyint(4) NOT NULL default '0',
mustclean tinyint(4) NOT NULL default '1',
op_mode varchar(20) NOT NULL default 'MINIMAL',
nextosid varchar(35) default NULL,
PRIMARY KEY (osname,pid),
KEY osid (osid),
KEY OS (OS)
......
......@@ -25,3 +25,20 @@
update node_types set disktype='ad' where type='pcL440GX';
update node_types set disktype='ad' where type='pc2000';
update node_types set disktype='ad' where type='pc601';
1.114 Add nextosid slot to os_info table for mapping the generic
osids (RHL-STD) to a specific one. Primarily used in os_setup
to figure out what to do with the generic names, but might also
be used someday to migrate people to newer versions?
alter table os_info add nextosid varchar(35) default NULL \
after op_mode;
update os_info set nextosid='RHL71-STD' where \
osid='RHL-STD';
update os_info set nextosid='emulab-ops-FBSD47-STD' where \
osid='FBSD-STD';
Note that the osids are a little odd on boss, where the early
ones had osid=osname. On other testbeds, need to check the
actual value of the osids.
......@@ -289,39 +289,51 @@ while (my %row = $db_result->fetchhash()) {
$osid_row{'version'} eq "") {
#
# A non-specific version. Try to map it.
# XXX - Should this use MapNodeOSID??
# A non-specific version. There needs to be a way to
# map it to another osid.
#
if (!defined($osid_row{'nextosid'})) {
die("*** $0:\n".
" No mapping can be made for $osid ($node)!\n");
}
my $nextosid = $osid_row{'nextosid'};
#
# See if the nextosid is already on the disk. If not,
# it needs to be loaded.
#
my $o_result =
DBQueryFatal("select o1.* from partitions as p ".
"left join os_info as o1 ".
" on o1.osid=p.osid ".
"left join os_info as o2 ".
" on o2.OS=o1.OS ".
"where p.node_id='$node' ".
" and o2.osid='$osid'");
if ($o_result->numrows == 0) {
die("*** $0:\n".
" No mapping can be made for $osid on $node!\n".
" Perhaps the disk needs reloading?\n");
DBQueryFatal("select osid from partitions as p ".
"where p.node_id='$node' and ".
" p.osid='$nextosid'");
if (! $o_result->numrows) {
#
# User wants a specific version of an OS, but its not
# loaded on the machine.
#
print "Mapping $osid on $node to $nextosid ".
"and setting up a reload.\n";
SetupReload($node, $nextosid, $type);
$osids{$node} = $nextosid;
}
else {
my %o_row = $o_result->fetchhash();
my $n_osid = $o_row{'osid'};
print "Mapping $osid on $node to $n_osid.\n";
#
# Already loaded.
#
print "Mapping $osid on $node to $nextosid.\n";
if ($dolastload &&
defined($row{'pid'}) && $row{'pid'} ne $pid) {
SetupReload($node, $n_osid, $type);
SetupReload($node, $nextosid, $type);
}
else {
system("$osselect $n_osid $node") and
system("$osselect $nextosid $node") and
die("*** Could not set boot OS to ".
"$n_osid for $node\n");
"$nextosid for $node\n");
}
$osids{$node} = $n_osid;
$osids{$node} = $nextosid;
}
}
else {
......@@ -570,7 +582,7 @@ elsif (@vnodelist) {
my $node = shift(@vnodelist);
my $wstart = $waitstart{$node};
if (!TBNodeStateWait($node, TBDB_NODESTATE_ISUP, $wstart, (60*3))) {
if (!TBNodeStateWait($node, TBDB_NODESTATE_ISUP, $wstart, (60*10))) {
print "$node is alive and well\n";
SetNodeBootStatus($node, NODEBOOTSTATUS_OKAY);
next;
......
......@@ -756,6 +756,7 @@ function SHOWOSINFO($osid) {
$creator = $osrow[creator];
$created = $osrow[created];
$mustclean = $osrow[mustclean];
$nextosid = $osrow[nextosid];
if (!$os_description)
$os_description = "&nbsp";
......@@ -858,6 +859,14 @@ function SHOWOSINFO($osid) {
echo " </td>
</tr>\n";
if ($nextosid) {
echo "<tr>
<td>Next Osid: </td>
<td class=left>
<A href='showosinfo.php3?osid=$nextosid'>$nextosid</A></td>
</tr>\n";
}
echo "<tr>
<td>Internal ID: </td>
<td class=\"left\">$osid</td>
......
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