Commit 53a11517 authored by Shashi Guruprasad's avatar Shashi Guruprasad

Merge all files except ipassign (done in a separate commit)

from commvirtsig-branch into main trunk

Two testsuite tests fail: tbcmd and vtypes . Need to fix.
parent 67e2c8c5
...@@ -22,6 +22,7 @@ use vars qw(@ISA @EXPORT); ...@@ -22,6 +22,7 @@ use vars qw(@ISA @EXPORT);
@ISA = "Exporter"; @ISA = "Exporter";
@EXPORT = @EXPORT =
qw ( NODERELOADING_PID NODERELOADING_EID NODEDEAD_PID NODEDEAD_EID qw ( NODERELOADING_PID NODERELOADING_EID NODEDEAD_PID NODEDEAD_EID
OLDRESERVED_PID OLDRESERVED_EID
NODEBOOTSTATUS_OKAY NODEBOOTSTATUS_FAILED NODEBOOTSTATUS_UNKNOWN NODEBOOTSTATUS_OKAY NODEBOOTSTATUS_FAILED NODEBOOTSTATUS_UNKNOWN
NODESTARTSTATUS_NOSTATUS PROJMEMBERTRUST_NONE PROJMEMBERTRUST_USER NODESTARTSTATUS_NOSTATUS PROJMEMBERTRUST_NONE PROJMEMBERTRUST_USER
PROJMEMBERTRUST_ROOT PROJMEMBERTRUST_GROUPROOT PROJMEMBERTRUST_ROOT PROJMEMBERTRUST_GROUPROOT
...@@ -142,10 +143,10 @@ use vars qw(@ISA @EXPORT); ...@@ -142,10 +143,10 @@ use vars qw(@ISA @EXPORT);
TBAdmin TBProjAccessCheck TBNodeAccessCheck TBOSIDAccessCheck TBAdmin TBProjAccessCheck TBNodeAccessCheck TBOSIDAccessCheck
TBImageIDAccessCheck TBExptAccessCheck ExpLeader MarkNodeDown TBImageIDAccessCheck TBExptAccessCheck ExpLeader MarkNodeDown
SetNodeBootStatus OSFeatureSupported IsShelved NodeidToExp SetNodeBootStatus OSFeatureSupported IsShelved NodeidToExp NodeidToExpOldReserved
UserDBInfo DBQuery DBQueryFatal DBQueryWarn DBWarn DBFatal UserDBInfo DBQuery DBQueryFatal DBQueryWarn DBWarn DBFatal
DBQuoteSpecial UNIX2DBUID ExpState SetExpState ProjLeader DBQuoteSpecial UNIX2DBUID ExpState SetExpState ProjLeader
ExpNodes DBDateTime DefaultImageID GroupLeader TBGroupUnixInfo ExpNodes ExpNodesOldReserved DBDateTime DefaultImageID GroupLeader TBGroupUnixInfo
TBValidNodeLogType TBValidNodeName TBSetNodeLogEntry TBValidNodeLogType TBValidNodeName TBSetNodeLogEntry
TBSetSchedReload MapNodeOSID TBLockExp TBUnLockExp TBSetExpSwapTime TBSetSchedReload MapNodeOSID TBLockExp TBUnLockExp TBSetExpSwapTime
TBUnixGroupList TBOSID TBOSMaxConcurrent TBOSCountInstances TBUnixGroupList TBOSID TBOSMaxConcurrent TBOSCountInstances
...@@ -294,6 +295,8 @@ sub PLABMOND_PID() { $TBOPSPID; } ...@@ -294,6 +295,8 @@ sub PLABMOND_PID() { $TBOPSPID; }
sub PLABMOND_EID() { "plab-monitor"; } sub PLABMOND_EID() { "plab-monitor"; }
sub PLABHOLDING_PID() { $TBOPSPID; } sub PLABHOLDING_PID() { $TBOPSPID; }
sub PLABHOLDING_EID() { "plabnodes"; } sub PLABHOLDING_EID() { "plabnodes"; }
sub OLDRESERVED_PID() { $TBOPSPID; }
sub OLDRESERVED_EID() { "oldreserved"; }
sub PROJROOT() { $PROJROOT; } sub PROJROOT() { $PROJROOT; }
sub GROUPROOT() { $GROUPROOT; } sub GROUPROOT() { $GROUPROOT; }
sub USERROOT() { $USERROOT; } sub USERROOT() { $USERROOT; }
...@@ -1444,6 +1447,53 @@ sub TBGetCancelFlag($$$) ...@@ -1444,6 +1447,53 @@ sub TBGetCancelFlag($$$)
return 1; return 1;
} }
#
# Return a list of all the nodes in an experiment
# that were moved to OLDRESERVED_PID/OLDRESERVED_EID
# holding reservation
#
# usage: ExpNodesOldReserved(char *pid, char *eid)
# returns the list if a valid pid/eid.
# returns 0 if an invalid pid/eid or if an error.
#
sub ExpNodesOldReserved($$)
{
my($pid, $eid) = @_;
my(@row);
my(@nodes);
my $oldreserved_pid = OLDRESERVED_PID;
my $oldreserved_eid = OLDRESERVED_EID;
my $query_result =
DBQueryWarn("select r.node_id from reserved as r ".
"left join nodes as n on n.node_id=r.node_id ".
"left join node_types as nt on nt.type=n.type ".
"where (r.pid='$oldreserved_pid' and r.old_pid='$pid') ".
"and (r.pid='$oldreserved_eid' and r.old_eid='$eid') ");
if (! $query_result or
$query_result->numrows == 0) {
return ();
}
while (@row = $query_result->fetchrow_array()) {
my $node = $row[0];
#
# Taint check. I do not understand this sillyness, but if I
# taint check these node names, I avoid warnings throughout.
#
if ($node =~ /^([-\w]+)$/) {
$node = $1;
push(@nodes, $node);
}
else {
print "*** $0: WARNING: Bad node name: $node.\n";
}
}
return @nodes;
}
# #
# Return a list of all the nodes in an experiment. # Return a list of all the nodes in an experiment.
# #
...@@ -1627,6 +1677,34 @@ sub IsShelved ($;$$) { ...@@ -1627,6 +1677,34 @@ sub IsShelved ($;$$) {
return 0; return 0;
} }
#
# Map nodeid to its pid/eid in the oldreserved holding reservation
#
# usage: NodeidToExpOldReserved(char *nodeid, \$pid, \$eid, \$vname)
# returns 1 if the node is reserved.
# returns 0 if the node is not reserved.
#
sub NodeidToExpOldReserved ($$$) {
my($nodeid, $pid, $eid) = @_;
my $oldreserved_pid = OLDRESERVED_PID;
my $oldreserved_eid = OLDRESERVED_EID;
my $query_result =
DBQueryWarn("select old_pid,old_eid from reserved ".
"where node_id='$nodeid' and pid='$oldreserved_pid' ".
"and eid='$oldreserved_eid'");
if (! $query_result ||
! $query_result->num_rows) {
return 0;
}
my @row = $query_result->fetchrow_array();
$$pid = $row[0];
$$eid = $row[1];
return 1;
}
# #
# Map nodeid to its pid/eid/vname. vname is optional. # Map nodeid to its pid/eid/vname. vname is optional.
# #
......
...@@ -52,6 +52,8 @@ my $eid = shift; ...@@ -52,6 +52,8 @@ my $eid = shift;
my @node_names=@ARGV; my @node_names=@ARGV;
my @vals = (); my @vals = ();
my @nodes= (); my @nodes= ();
my $oldreserved_pid = OLDRESERVED_PID;
my $oldreserved_eid = OLDRESERVED_EID;
if ($debug) { print "Expt '$eid', proj '$pid'\n"; } if ($debug) { print "Expt '$eid', proj '$pid'\n"; }
...@@ -102,11 +104,16 @@ foreach my $n (@node_names) { ...@@ -102,11 +104,16 @@ foreach my $n (@node_names) {
if (($r_pid eq $pid) && ($r_eid eq $eid)) { if (($r_pid eq $pid) && ($r_eid eq $eid)) {
print "You have already reserved node '$n'.\n"; print "You have already reserved node '$n'.\n";
# Do not increment error code since that throws off tbprerun. # Do not increment error code since that throws off tbprerun.
next;
} elsif(NodeidToExpOldReserved($n, \$r_pid, \$r_eid) &&
(($r_pid eq $pid) && ($r_eid eq $eid)) ) {
print "You have already reserved node '$n' which was moved to ".
"a holding reservation: $oldreserved_pid/$oldreserved_eid.\n";
} else { } else {
print "Someone else has already reserved node '$n'.\n"; print "Someone else has already reserved node '$n'.\n";
$noalloc++; $noalloc++;
next;
} }
next; # Go on to the next node if this one is reserved
} }
my $result = DBQueryFatal("select * from nodes where node_id='$n'"); my $result = DBQueryFatal("select * from nodes where node_id='$n'");
...@@ -130,7 +137,7 @@ foreach my $n (@node_names) { ...@@ -130,7 +137,7 @@ foreach my $n (@node_names) {
# End shark hack # End shark hack
} else { } else {
# its not a shark - just add it in... # its not a shark - just add it in...
push(@vals,"('$n','$pid','$eid','$n')"); push(@vals,"('$n','$pid','$eid','$n','','')");
push(@nodes,"$n"); push(@nodes,"$n");
} }
} }
...@@ -156,7 +163,7 @@ if (!$error && (!$noalloc || $partial) && @vals) { ...@@ -156,7 +163,7 @@ if (!$error && (!$noalloc || $partial) && @vals) {
if ($debug) { if ($debug) {
print "Reserving nodes...\n"; print "Reserving nodes...\n";
} }
$cmd = "insert into reserved (node_id,pid,eid,vname) values ". $cmd = "replace into reserved (node_id,pid,eid,vname,old_pid,old_eid) values ".
join(",",@vals); join(",",@vals);
if (!DBQueryWarn($cmd)) { if (!DBQueryWarn($cmd)) {
$error++; $error++;
......
...@@ -17,10 +17,11 @@ use Getopt::Std; ...@@ -17,10 +17,11 @@ use Getopt::Std;
# #
sub usage () sub usage ()
{ {
die("Usage: nfree [-x] <pid> <eid> [<node> <node> <...>]\n". die("Usage: nfree [-x] [-o] <pid> <eid> [<node> <node> <...>]\n".
"Releases all nodes in the specified experiment.\n". "Releases all nodes in the specified experiment.\n".
"If nodes are listed, nfree releases only those nodes.\n". "If nodes are listed, nfree releases only those nodes.\n".
" '-x' frees all virtual nodes on any physical node that gets freed.\n" " '-x' frees all virtual nodes on any physical node that gets freed.\n".
" '-o' Moves nodes into a oldreserved holding experiment.\n"
); );
} }
...@@ -38,6 +39,8 @@ my $osselect = "$TB/bin/os_select"; ...@@ -38,6 +39,8 @@ my $osselect = "$TB/bin/os_select";
my $reloadpid = "emulab-ops"; my $reloadpid = "emulab-ops";
my $pendingeid = "reloadpending"; my $pendingeid = "reloadpending";
my $reloadeid = "reloading"; my $reloadeid = "reloading";
my $oldreserved_pid = OLDRESERVED_PID;
my $oldreserved_eid = OLDRESERVED_EID;
my @nodes; my @nodes;
my @freed_nodes=(); my @freed_nodes=();
...@@ -53,7 +56,7 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'}; ...@@ -53,7 +56,7 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Parse command arguments. Once we return from getopts, all that should # Parse command arguments. Once we return from getopts, all that should
# left are the required arguments. # left are the required arguments.
# #
my $optlist = "x"; my $optlist = "xo";
%options = (); %options = ();
...@@ -62,10 +65,14 @@ if (! getopts($optlist, \%options)) { ...@@ -62,10 +65,14 @@ if (! getopts($optlist, \%options)) {
} }
my $freeDependantVirtuals = 0; my $freeDependantVirtuals = 0;
my $moveToOldReserved = 0;
if (defined($options{"x"})) { if (defined($options{"x"})) {
$freeDependantVirtuals = 1; $freeDependantVirtuals = 1;
} }
if (defined($options{"o"})) {
$moveToOldReserved = 1;
}
if (@ARGV < 2) { if (@ARGV < 2) {
usage(); usage();
...@@ -133,6 +140,9 @@ if (@ARGV) { ...@@ -133,6 +140,9 @@ if (@ARGV) {
} else { } else {
print "Releasing all nodes from experiment '$eid' in project '$pid'.\n"; print "Releasing all nodes from experiment '$eid' in project '$pid'.\n";
@nodes = ExpNodes($pid, $eid); @nodes = ExpNodes($pid, $eid);
if (! $moveToOldReserved ) {
push( @nodes, ExpNodesOldReserved($pid, $eid) );
}
} }
###################################################################### ######################################################################
...@@ -172,20 +182,39 @@ foreach my $n (@nodes) { ...@@ -172,20 +182,39 @@ foreach my $n (@nodes) {
next; next;
} }
# Move to locked reservation. Node is not free, but is no longer if ( $moveToOldReserved ) {
# owned by the pid/eid, so cannot be mucked with. # Move to holding reservation. Node is not free, but is no longer
if (! DBQueryWarn("update reserved " . # owned by the pid/eid, so cannot be mucked with.
"set vname='$n', pid='$reloadpid', eid='$lockedeid' ". if (! DBQueryWarn("update reserved " .
"where node_id='$n'")) { "set vname='$n', pid='$oldreserved_pid', ".
print "*** WARNING: Error locking down node $n!\n"; "eid='$oldreserved_eid', old_pid='$pid', ".
next; "old_eid='$eid' where node_id='$n'")) {
print "*** WARNING: Error moving node $n to holding pid/eid: ".
"$oldreserved_pid/$oldreserved_eid\n";
next;
}
} else {
# Move to locked reservation. Node is not free, but is no longer
# owned by the pid/eid, so cannot be mucked with.
if (! DBQueryWarn("update reserved " .
"set vname='$n', pid='$reloadpid', eid='$lockedeid', ".
"old_pid='', old_eid='' ".
"where node_id='$n'")) {
print "*** WARNING: Error locking down node $n!\n";
next;
}
push(@freed_nodes, $n);
} }
push(@freed_nodes, $n);
} }
DBQueryFatal("unlock tables"); DBQueryFatal("unlock tables");
# We are done if called with a -o
if( $moveToOldReserved ) {
exit($error);
}
###################################################################### ######################################################################
# Step 2 # Step 2
# #
......
...@@ -77,10 +77,13 @@ my %experiment_fields = ("multiplex_factor" => 1, ...@@ -77,10 +77,13 @@ my %experiment_fields = ("multiplex_factor" => 1,
"wa_plr_solverweight" => 1, "wa_plr_solverweight" => 1,
"cpu_usage" => 1, "cpu_usage" => 1,
"mem_usage" => 1, "mem_usage" => 1,
"allowfixnode" => 1,
"veth_encapsulate" => 1, "veth_encapsulate" => 1,
"jail_osname" => 1, "jail_osname" => 1,
"delay_osname" => 1, "delay_osname" => 1,
"sync_server" => 1); "sync_server" => 1,
"use_ipassign" => 1,
"ipassign_args" => 1);
# #
# Turn off line buffering on output # Turn off line buffering on output
...@@ -227,7 +230,7 @@ sub readXML($$$) { ...@@ -227,7 +230,7 @@ sub readXML($$$) {
$count += scalar(@{$virtual_tables{$table}}) $count += scalar(@{$virtual_tables{$table}})
if (defined($virtual_tables{$table})); if (defined($virtual_tables{$table}));
} }
if ($count > 10000) { if ($count > 100000) {
fatal("Too many rows of data!"); fatal("Too many rows of data!");
} }
......
...@@ -39,7 +39,8 @@ my $TB = "@prefix@"; ...@@ -39,7 +39,8 @@ my $TB = "@prefix@";
"readycount" => "$TB/bin/readycount", "readycount" => "$TB/bin/readycount",
"eventsys_control" => "$TB/bin/eventsys_control", "eventsys_control" => "$TB/bin/eventsys_control",
"batchexp" => "$TB/bin/batchexp", "batchexp" => "$TB/bin/batchexp",
"nscheck" => "$TB/bin/nscheck" "nscheck" => "$TB/bin/nscheck",
"swapexp" => "$TB/bin/swapexp",
); );
# Need to provide a simple path, because some scripts we call need one # Need to provide a simple path, because some scripts we call need one
......
This diff is collapsed.
...@@ -213,6 +213,12 @@ namespace eval GLOBALS { ...@@ -213,6 +213,12 @@ namespace eval GLOBALS {
# The name of the sync_server # The name of the sync_server
variable sync_server {} variable sync_server {}
# Whether or not use use ipassign
variable use_ipassign 0
# Arguments to pass to ipassign
variable ipassign_args {}
# For remote nodes. The solver weights. # For remote nodes. The solver weights.
variable wa_delay_solverweight 1 variable wa_delay_solverweight 1
variable wa_bw_solverweight 7 variable wa_bw_solverweight 7
...@@ -230,6 +236,9 @@ namespace eval GLOBALS { ...@@ -230,6 +236,9 @@ namespace eval GLOBALS {
variable cpu_usage 3 variable cpu_usage 3
variable mem_usage 0 variable mem_usage 0
# Flag to disable doing a fix-node
variable fix_current_resources 1
# Control veth encapsulation # Control veth encapsulation
variable veth_encapsulate 1 variable veth_encapsulate 1
......
...@@ -245,8 +245,11 @@ Simulator instproc run {} { ...@@ -245,8 +245,11 @@ Simulator instproc run {} {
var_import ::GLOBALS::forcelinkdelays var_import ::GLOBALS::forcelinkdelays
var_import ::GLOBALS::multiplex_factor var_import ::GLOBALS::multiplex_factor
var_import ::GLOBALS::sync_server var_import ::GLOBALS::sync_server
var_import ::GLOBALS::use_ipassign
var_import ::GLOBALS::ipassign_args
var_import ::GLOBALS::cpu_usage var_import ::GLOBALS::cpu_usage
var_import ::GLOBALS::mem_usage var_import ::GLOBALS::mem_usage
var_import ::GLOBALS::fix_current_resources
var_import ::GLOBALS::veth_encapsulate var_import ::GLOBALS::veth_encapsulate
var_import ::GLOBALS::jail_osname var_import ::GLOBALS::jail_osname
var_import ::GLOBALS::delay_osname var_import ::GLOBALS::delay_osname
...@@ -254,8 +257,10 @@ Simulator instproc run {} { ...@@ -254,8 +257,10 @@ Simulator instproc run {} {
var_import ::TBCOMPAT::eventtypes var_import ::TBCOMPAT::eventtypes
# Fill out IPs # Fill out IPs
foreach obj [concat [array names lanlink_list]] { if {! $use_ipassign } {
$obj fill_ips foreach obj [concat [array names lanlink_list]] {
$obj fill_ips
}
} }
# Go through the list of nodes, and find subnode hosts - we have to add a # Go through the list of nodes, and find subnode hosts - we have to add a
...@@ -336,8 +341,8 @@ Simulator instproc run {} { ...@@ -336,8 +341,8 @@ Simulator instproc run {} {
$prog updatedb "sql" $prog updatedb "sql"
} }
set fields [list "mem_usage" "cpu_usage" "forcelinkdelays" "uselinkdelays" "usewatunnels" "uselatestwadata" "wa_delay_solverweight" "wa_bw_solverweight" "wa_plr_solverweight" "veth_encapsulate"] set fields [list "mem_usage" "cpu_usage" "forcelinkdelays" "uselinkdelays" "usewatunnels" "uselatestwadata" "wa_delay_solverweight" "wa_bw_solverweight" "wa_plr_solverweight" "veth_encapsulate" "allowfixnode"]
set values [list $mem_usage $cpu_usage $forcelinkdelays $uselinkdelays $usewatunnels $uselatestwadata $wa_delay_solverweight $wa_bw_solverweight $wa_plr_solverweight $veth_encapsulate] set values [list $mem_usage $cpu_usage $forcelinkdelays $uselinkdelays $usewatunnels $uselatestwadata $wa_delay_solverweight $wa_bw_solverweight $wa_plr_solverweight $veth_encapsulate $fix_current_resources]
if { $multiplex_factor != {} } { if { $multiplex_factor != {} } {
lappend fields "multiplex_factor" lappend fields "multiplex_factor"
...@@ -352,6 +357,14 @@ Simulator instproc run {} { ...@@ -352,6 +357,14 @@ Simulator instproc run {} {
lappend values $default_sync_server lappend values $default_sync_server
} }
lappend fields "use_ipassign"
lappend values $use_ipassign
if { $ipassign_args != {} } {
lappend fields "ipassign_args"
lappend values $ipassign_args
}
if { $jail_osname != {} } { if { $jail_osname != {} } {
lappend fields "jail_osname" lappend fields "jail_osname"
lappend values $jail_osname lappend values $jail_osname
......
...@@ -652,6 +652,25 @@ proc tb-set-sync-server {node} { ...@@ -652,6 +652,25 @@ proc tb-set-sync-server {node} {
set sync_server $node set sync_server $node
} }
#
# Turn on or of the ipassign program for IP address assignment and route
# calculation
#
proc tb-use-ipassign {onoff} {
var_import ::GLOBALS::use_ipassign
set use_ipassign $onoff
}
#
# Give arguments for ipassign
#
proc tb-set-ipassign-args {stuff} {
var_import ::GLOBALS::ipassign_args
set ipassign_args $stuff
}
# #
# Set the startup command for a node. Replaces the tb-set-node-startup # Set the startup command for a node. Replaces the tb-set-node-startup
# command above, but we have to keep that one around for a while. This # command above, but we have to keep that one around for a while. This
...@@ -699,6 +718,17 @@ proc tb-bind-parent {sub phys} { ...@@ -699,6 +718,17 @@ proc tb-bind-parent {sub phys} {
tb-fix-node $sub $phys tb-fix-node $sub $phys
} }
proc tb-fix-current-resources {onoff} {
var_import ::GLOBALS::fix_current_resources
if {$onoff != 0 && $onoff != 1} {
perror "\[tb-fix-current-resources] $onoff must be 0/1"
return
}
set fix_current_resources $onoff
}
# #
# Control veth encapsulation. # Control veth encapsulation.
# #
......
...@@ -67,6 +67,7 @@ my $dbg = 0; ...@@ -67,6 +67,7 @@ my $dbg = 0;
my $failed = 0; my $failed = 0;
my $failedvnodes= 0; my $failedvnodes= 0;
my $failedplab = 0; my $failedplab = 0;
my $canceled = 0;
my %nodes = (); my %nodes = ();
my %vnodes = (); my %vnodes = ();
my %vnodephosts = (); my %vnodephosts = ();
...@@ -207,9 +208,13 @@ while (my %row = $db_result->fetchhash()) { ...@@ -207,9 +208,13 @@ while (my %row = $db_result->fetchhash()) {
TBGetNodeAllocState( $node, \$nodeAllocState ); TBGetNodeAllocState( $node, \$nodeAllocState );
$nodes{$node} = $node; $nodes{$node} = $node;
$nodeAllocStates{$node} = $nodeAllocState; $nodeAllocStates{$node} = $nodeAllocState;
# only reboot node if assign_wrapper just pulled it into expt. if ($nodeAllocState eq TBDB_ALLOCSTATE_RES_RECONFIG()) {
# (e.g. it isnt ALLOCSTATE_RES_READY) # Terrible use of state machine.
if ($nodeAllocState ne TBDB_ALLOCSTATE_RES_READY()) { $reconfigs{$node} = 1;
}
elsif ($nodeAllocState ne TBDB_ALLOCSTATE_RES_READY()) {
# only reboot node if assign_wrapper just pulled it into expt.
# (e.g. it isnt ALLOCSTATE_RES_READY)
$reboots{$node} = 1; $reboots{$node} = 1;
} }
} }
...@@ -469,8 +474,9 @@ if (!$TESTMODE) { ...@@ -469,8 +474,9 @@ if (!$TESTMODE) {
foreach my $node (@list) { foreach my $node (@list) {
TBSetNodeAllocState( $node, TBDB_ALLOCSTATE_RES_RELOAD() ); TBSetNodeAllocState( $node, TBDB_ALLOCSTATE_RES_RELOAD() );
$nodeAllocStates{$node} = TBDB_ALLOCSTATE_RES_RELOAD(); $nodeAllocStates{$node} = TBDB_ALLOCSTATE_RES_RELOAD();
# No point in rebooting, obviously, but it does reboot! # No point in reboot/reconfig obviously, since node will reboot!
delete $reboots{$node}; delete $reboots{$node};
delete $reconfigs{$node};
$rebooted{$node} = 1; $rebooted{$node} = 1;
} }
...@@ -479,6 +485,9 @@ if (!$TESTMODE) { ...@@ -479,6 +485,9 @@ if (!$TESTMODE) {
ForkCmd("$os_load -m $imageid @list"); ForkCmd("$os_load -m $imageid @list");
} }
#
# Fire off the reboots.
#
if (keys(%reboots)) { if (keys(%reboots)) {
foreach my $node (keys(%reboots)) { foreach my $node (keys(%reboots)) {
if ($nodeAllocStates{$node} eq TBDB_ALLOCSTATE_RES_INIT_CLEAN()) { if ($nodeAllocStates{$node} eq TBDB_ALLOCSTATE_RES_INIT_CLEAN()) {
...@@ -497,30 +506,10 @@ if (!$TESTMODE) { ...@@ -497,30 +506,10 @@ if (!$TESTMODE) {
} }
# #
# Any nodes that were not reloaded or rebooted, get a reconfig. They # Fire off the reconfigs.
# must have been in the experiment before, but we check the allocstate
# anyway.
# #
foreach my $node (keys(%nodes)) {
next
if (exists($rebooted{$node}) ||
$nodeAllocStates{$node} ne TBDB_ALLOCSTATE_RES_READY());
# Currently, only do this for NORMALv2 images. Need a way to
# know this is allowed!
my $mode;
if (!TBGetNodeOpMode($node, \$mode)) {
print "*** Error getting operational mode for $node!\n";
next;
}
next
if ($mode ne "NORMALv2");
$reconfigs{$node} = $node;
}
if (keys(%reconfigs)) { if (keys(%reconfigs)) {
$cmd = "$nodereboot -r -d " . join(" ", keys(%reconfigs)); $cmd = "$nodereboot -r " . join(" ", keys(%reconfigs));
$pids{$cmd} = ForkCmd($cmd); $pids{$cmd} = ForkCmd($cmd);
} }
...@@ -598,7 +587,19 @@ while ( @nodelist ) { ...@@ -598,7 +587,19 @@ while ( @nodelist ) {
next; next;
} }
if ($retries{$node}) { #
# Check for cancelation. Do not want to retry the reboots if the
# swap was canceled.
#
if (!$canceled) {
TBGetCancelFlag($pid, $eid, \$canceled);
if ($canceled) {
print "*** Swap canceled; will terminate os_setup early!\n";
}
}
if ($retries{$node} && !$canceled) {
$retries{$node} -= 1; $retries{$node} -= 1;
print "*** Rebooting $node and waiting again ...\n"; print "*** Rebooting $node and waiting again ...\n";
...@@ -694,7 +695,10 @@ foreach my $vnode (@vnodelist) { ...@@ -694,7 +695,10 @@ foreach my $vnode (@vnodelist) {
# XXX - Don't bother if something above failed. A waste of time and # XXX - Don't bother if something above failed. A waste of time and
# usually leads to cascading errors. # usually leads to cascading errors.
# #
if ($failed && @vnodelist) { if ($canceled && @vnodelist) {
print "*** Skipping virtual node setup since swapin was canceled!\n";
}
elsif ($failed && @vnodelist) {
print "*** Skipping virtual node setup since there were previous ". print "*** Skipping virtual node setup since there were previous ".
"failures!\n"; "failures!\n";
} }
...@@ -799,7 +803,7 @@ TBDebugTimeStamp("os_setup finished"); ...@@ -799,7 +803,7 @@ TBDebugTimeStamp("os_setup finished");
# No retry if vnodes failed. Indicates a fatal problem. # No retry if vnodes failed. Indicates a fatal problem.
exit(-1) exit(-1)
if ($failedvnodes); if ($failedvnodes || $canceled);
exit(1) exit(1)
if ($failed || $failedplab); if ($failed || $failedplab);
exit 0; exit 0;
......
...@@ -229,7 +229,8 @@ if (defined($exempt_eid)) { ...@@ -229,7 +229,8 @@ if (defined($exempt_eid)) {
$result = $result =
DBQueryFatal("select a.node_id,a.type,a.phys_nodeid,t.class,t.issubnode," . DBQueryFatal("select a.node_id,a.type,a.phys_nodeid,t.class,t.issubnode," .
"a.def_boot_osid from nodes as a ". "a.def_boot_osid, (b.pid is not null and b.eid is not null) " .
"from nodes as a ".
"left join reserved as b on a.node_id=b.node_id ". "left join reserved as b on a.node_id=b.node_id ".
"left join reserved as m on a.phys_nodeid=m.node_id ". "left join reserved as m on a.phys_nodeid=m.node_id ".
"left join nodes as np on a.phys_nodeid=np.node_id ". "left join nodes as np on a.phys_nodeid=np.node_id ".
...@@ -243,7 +244,7 @@ $result = ...@@ -243,7 +244,7 @@ $result =
# to use all nodes), or if there is no entry in the perms table for # to use all nodes), or if there is no entry in the perms table for
# the type/class of node. # the type/class of node.
# #
while (($node,$type,$physnode,$class,$issubnode,$def_boot_osid) while (($node,$type,$physnode,$class,$issubnode,$def_boot_osid,$reserved)
= $result->fetchrow_array) { = $result->fetchrow_array) {
$nodes{$node} = $type $nodes{$node} = $type
if (!defined($pid) || if (!defined($pid) ||
...@@ -252,6 +253,12 @@ while (($node,$type,$physnode,$class,$issubnode,$def_boot_osid) ...@@ -252,6 +253,12 @@ while (($node,$type,$physnode,$class,$issubnode,$def_boot_osid)
$subnode_of{$node} = $physnode; $subnode_of{$node} = $physnode;
} }
$node_def_boot_osid{$node} = $def_boot_osid; $node_def_boot_osid{$node} = $def_boot_osid;
if ($reserved) {
$is_reserved{$node} = 1;
} else {
$is_reserved{$node} = 0;
}
} }
foreach $node (keys(%nodes)) { foreach $node (keys(%nodes)) {
...@@ -328,6 +335,9 @@ foreach $node (keys(%nodes)) { ...@@ -328,6 +335,9 @@ foreach $node (keys(%nodes)) {
push @features, "?+ram:$ram"; push @features, "?+ram:$ram";
# This number can be use for fine-tuning packing # This number can be use for fine-tuning packing
push @features, "?+virtpercent:100";