Commit 65a39cd5 authored by Mike Hibler's avatar Mike Hibler

Changes to respect the "imageable" field of the node_types table:

 - os_load will not attempt to load a non-imagable node, it will
   be skipped without error
 - nfree will respect imageable even with an entry in scheduled_reloads
 - reload_daemon will free any non-imageable nodes that happen to make
   it into reloadpending/reloading
parent 525d0d6b
...@@ -159,7 +159,7 @@ use vars qw(@ISA @EXPORT); ...@@ -159,7 +159,7 @@ use vars qw(@ISA @EXPORT);
TBOSLoadMaxOkay TBImageLoadMaxOkay TBImageID ExpSwapper TBOSLoadMaxOkay TBImageLoadMaxOkay TBImageID ExpSwapper
TBdbfork TBDBDisconnect VnameToNodeid TBExpLocked TBdbfork TBDBDisconnect VnameToNodeid TBExpLocked
TBIsNodeRemote TBExptSetLogFile TBExptClearLogFile TBExptGetLogFile TBIsNodeRemote TBExptSetLogFile TBExptClearLogFile TBExptGetLogFile
TBIsNodeVirtual TBControlNetIP TBPhysNodeID TBIsNodeImageable TBIsNodeVirtual TBControlNetIP TBPhysNodeID
TBExptOpenLogFile TBExptCloseLogFile TBExptCreateLogFile TBExptOpenLogFile TBExptCloseLogFile TBExptCreateLogFile
TBNodeUpdateAccountsByPid TBNodeUpdateAccountsByType TBNodeUpdateAccountsByPid TBNodeUpdateAccountsByType
TBNodeUpdateAccountsByUID TBNodeUpdateAccountsByUID
...@@ -2609,6 +2609,30 @@ sub TBGetNodeAllocState($$) ...@@ -2609,6 +2609,30 @@ sub TBGetNodeAllocState($$)
return 1; return 1;
} }
#
# Is a node imageable?
#
# usage TBIsNodeImageable(char *node)
# Returns 1 if yes.
# Returns 0 if no.
#
sub TBIsNodeImageable($)
{
my ($nodeid) = @_;
my $query_result =
DBQueryFatal("select nt.imageable from nodes as n ".
"left join node_types as nt on nt.type=n.type ".
"where n.node_id='$nodeid'");
if (! $query_result->num_rows) {
return 0;
}
my @row = $query_result->fetchrow_array();
return($row[0]);
}
# #
# Is a node remote? # Is a node remote?
# #
......
...@@ -351,10 +351,17 @@ foreach my $n (@freed_nodes) { ...@@ -351,10 +351,17 @@ foreach my $n (@freed_nodes) {
$result = $result =
DBQueryFatal("select node_id,image_id from scheduled_reloads " . DBQueryFatal("select node_id,image_id from scheduled_reloads " .
"where node_id='$n'"); "where node_id='$n'");
my $inreloads = $result->numrows();
# XXX
if ($inreloads && !$isimageable) {
print "WARNING: non-imageable node $n in scheduled_reloads\n";
$inreloads = 0;
}
if (!$TESTMODE && if (!$TESTMODE &&
((!$isvirt && $imageable) || # XXX force reload hack! ((!$isvirt && $imageable) || # XXX force reload hack!
$result->numrows() || $mustzero{$n} || $inreloads || $mustzero{$n} ||
TBNodeType($n) eq "garcia")) { # XXX Garcia hack TBNodeType($n) eq "garcia")) { # XXX Garcia hack
print "Moving $n to $reloadpid/$pendingeid.\n"; print "Moving $n to $reloadpid/$pendingeid.\n";
......
...@@ -203,11 +203,13 @@ if (defined($options{"m"})) { ...@@ -203,11 +203,13 @@ if (defined($options{"m"})) {
} }
} }
# VIRTNODE HACK: Virtual nodes are special. Do not reload! #
# Weed out non-imageable nodes (e.g., virtnodes, emotes, etc.)
#
my @temp = (); my @temp = ();
foreach my $node ( @nodes ) { foreach my $node ( @nodes ) {
if (TBIsNodeVirtual($node)) { if (!TBIsNodeImageable($node)) {
print "*** reload ($node): Skipping virtual node.\n"; print "*** reload ($node): cannot image node, skipped.\n";
next; next;
} }
push(@temp, $node); push(@temp, $node);
......
...@@ -234,7 +234,7 @@ while (1) { ...@@ -234,7 +234,7 @@ while (1) {
my $CLASSCLAUSE = "(n.class='pc' or n.class='pct')"; my $CLASSCLAUSE = "(n.class='pc' or n.class='pct')";
$query_result = $query_result =
DBQueryWarn("select a.node_id,b.pid,b.eid,b.mustwipe ". DBQueryWarn("select a.node_id,b.pid,b.eid,b.mustwipe,n.imageable ".
"from reserved as b ". "from reserved as b ".
"left join nodes as a on a.node_id=b.node_id ". "left join nodes as a on a.node_id=b.node_id ".
"left join last_reservation as l on l.node_id=a.node_id ". "left join last_reservation as l on l.node_id=a.node_id ".
...@@ -262,14 +262,33 @@ while (1) { ...@@ -262,14 +262,33 @@ while (1) {
$pid = $hrow{'pid'}; $pid = $hrow{'pid'};
$eid = $hrow{'eid'}; $eid = $hrow{'eid'};
$mustwipe = $hrow{'mustwipe'}; $mustwipe = $hrow{'mustwipe'};
$imageable = $hrow{'imageable'};
# XXX Garcia Hack
if (!$imageable && TBNodeType($node) eq "garcia") {
$imageable = 1;
}
# XXX End Garcia Hack
#
# If any non-imageable nodes made it this far, just free them now
#
if (!$imageable) {
print "Skipping non-imageable node $node\n";
freefromreloading($node);
next;
}
if ($pid eq $RELOADPID && $eid eq $PENDINGEID) { if ($pid eq $RELOADPID && $eid eq $PENDINGEID) {
push(@pending_list, [$node,$mustwipe]); push(@pending_list, [$node,$mustwipe]);
} else { } else {
push(@other_list, [$node,$mustwipe]); push(@other_list, [$node,$mustwipe]);
} }
} }
my $nodes = join(" ", map { $_->[0] } @pending_list, @other_list); my $nodes = join(" ", map { $_->[0] } @pending_list, @other_list);
if (!$nodes) {
next;
}
print "Trying to reload $nodes at ".`date`; print "Trying to reload $nodes at ".`date`;
# #
...@@ -422,7 +441,7 @@ while (1) { ...@@ -422,7 +441,7 @@ while (1) {
# #
# This should not fail, but it does when the DB gets busy. # This should not fail, but it does when the DB gets busy.
# #
notify("$os_load failed on $nodelist. ". notify("$os_load $os_load_flags failed on $nodelist. ".
"That is not supposed to happen.\n". "That is not supposed to happen.\n".
"Attempting to recover from this unfortunate ". "Attempting to recover from this unfortunate ".
"situation!\n"); "situation!\n");
...@@ -486,7 +505,7 @@ sub freefromreloading($) { ...@@ -486,7 +505,7 @@ sub freefromreloading($) {
DBQueryFatal("delete from current_reloads where node_id='$node'"); DBQueryFatal("delete from current_reloads where node_id='$node'");
my ($pid,$eid); my ($pid,$eid);
NodeidToExp($node,\$pid,\$eid); NodeidToExp($node,\$pid,\$eid);
if (($pid eq NODERELOADING_PID) && ($eid eq NODERELOADING_EID)) { if ($pid eq $RELOADPID && ($eid eq $RELOADEID || $eid eq $PENDINGEID)) {
DBQueryFatal("delete from scheduled_reloads ". DBQueryFatal("delete from scheduled_reloads ".
"where node_id='$node'"); "where node_id='$node'");
DBQueryFatal("delete from reserved where node_id='$node'"); DBQueryFatal("delete from reserved where node_id='$node'");
......
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