Commit a8b43197 authored by Robert Ricci's avatar Robert Ricci

Change the way we handle the nextosid column in the os_info table -

resolve it using a library function that will go through multiple
levels of indirction, so that we can point FBSD-JAIL at FBSD-STD.
parent f34bb634
......@@ -150,6 +150,7 @@ use vars qw(@ISA @EXPORT);
TBValidNodeLogType TBValidNodeName TBSetNodeLogEntry
TBSetSchedReload MapNodeOSID TBLockExp TBUnLockExp TBSetExpSwapTime
TBUnixGroupList TBOSID TBOSMaxConcurrent TBOSCountInstances
TBResolveNextOSID
TBOSLoadMaxOkay TBImageLoadMaxOkay TBImageID ExpSwapper
TBdbfork VnameToNodeid TBExpLocked
TBIsNodeRemote TBExptSetLogFile TBExptClearLogFile TBExptGetLogFile
......@@ -1915,6 +1916,46 @@ sub TBOSCountInstances ($;@)
return $current_count;
}
#
# Resolve a 'generic' OSID (ie. FBSD-STD) to a real OSID
#
# Note: It's okay to call this function with a 'real' OSID, but it would be
# waseful to do so.
#
# usage: TBResolveNextOSID(char *osid)
# returns: The 'real' OSID that the OSID resolves to, or undef if there is a
# problem (ie. unknown OSID)
#
sub TBResolveNextOSID($)
{
my ($osid) = @_;
my $next_osid = $osid;
my $input_osid = $osid;
my $count = 0;
do {
#
# Just a guard to make sure we don't end up in a loop
#
if ($count++ > 10) {
warn "Resolving $input_osid: Circular reference\n";
}
$osid = $next_osid;
my $result = DBQueryWarn("select nextosid from os_info where
osid='$osid';");
if ($result->num_rows() != 1) {
warn "Resolving $input_osid: Unable to fetch os_info for $osid!\n";
return undef;
}
($next_osid) = $result->fetchrow();
} while ($next_osid);
return $osid;
}
#
# Check whether or not it's permissible, given max_concurrent restrictions, to
# load an OSID onto a number of nodes - the nodes themselves can be passed, so
......
......@@ -354,7 +354,7 @@ while (my %row = $db_result->fetchhash()) {
"*** $0:\n".
" No mapping can be made for $osid ($node)!");
}
my $nextosid = $osid_row{'nextosid'};
my $nextosid = TBResolveNextOSID($osid);
#
# See if the nextosid is already on the disk. If not,
......
......@@ -252,14 +252,15 @@ while (my ($osid,$type) = $result->fetchrow()) {
# We also have to resolve the 'generic' OSIDs, which use the nextosid field to
# redirect to another OSID
#
$result = DBQueryFatal("select osid, nextosid from os_info where " .
$result = DBQueryFatal("select osid from os_info where " .
"nextosid is not null");
while (my ($osid, $nextosid) = $result->fetchrow()) {
while (my ($osid) = $result->fetchrow()) {
#
# Check to see if they were allowed to use the real OSID
#
if ($osid_node_types{$nextosid}) {
foreach my $type (@{$osid_node_types{$nextosid}}) {
my $realosid = TBResolveNextOSID($osid);
if ($osid_node_types{$realosid}) {
foreach my $type (@{$osid_node_types{$realosid}}) {
push @{$node_type_osids{$type}}, $osid;
}
}
......
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