Commit b031d1a7 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Hmm, a questionable change that I needed cause of ElabInElab and swapmod.

When doing a swapmod, nodes already reserved to the experiment are "moved"
(via update) to a holding reservation. Fine.  After assign runs, the old
nodes are moved back, but this time by an insert into the table, which
causes them to lose some fields that I do not want them to lose! This might
really mean that these fields do not belong in the reserved table, but I do
not want to ponder this right now. Instead I do another update bringing
them back into the original experiment.

I left comment indicating that this is under review (and why this commit is
seperate from the rest of the swapmod changes).
parent 08f0e7f7
......@@ -73,7 +73,8 @@ my @node_names = @ARGV;
my $error = 0;
my $noalloc = 0;
my @vals = ();
my @newvals = ();
my @oldnodes = ();
my @nodes = ();
my @need_consetup = 0;
my @need_history = ();
......@@ -151,6 +152,8 @@ foreach my $n (@node_names) {
elsif (NodeidToExpOldReserved($n, \$r_pid, \$r_eid) &&
(($r_pid eq $pid) && ($r_eid eq $eid))) {
print "Already reserved in holding reservation: '$n'\n";
push(@oldnodes, $n);
else {
print "Someone else has already reserved node '$n'.\n";
......@@ -166,25 +169,37 @@ foreach my $n (@node_names) {
# Add info the list of nodes to reserve; done in a single query below.
push(@vals, "('$n','$pid','$eid','$n','','')");
push(@newvals, "('$n','$pid','$eid','$n','','')");
push(@nodes, "$n");
TBDebugTimeStamp("nalloc checked all nodes");
if ($debug) {
print "List Ready: @vals\nError=$error\n";
print "List Ready: @newvals\nError=$error\n";
# Now make the reservations in the DB.
if ((!$noalloc || $partial) && @vals) {
if ((!$noalloc || $partial) && (@newvals || @oldnodes)) {
print "Reserving nodes...\n"
if ($debug);
if (! DBQueryWarn("replace into reserved ".
if (@newvals &&
! DBQueryWarn("replace into reserved ".
" (node_id,pid,eid,vname,old_pid,old_eid) ".
"values ". join(",",@vals))) {
"values ". join(",",@newvals))) {
# Do this instead of creating new entries so as not to lose any
# other info in the reserved table entries. I think this might be;
# wrong; might need to rethink this.
foreach my $node (@oldnodes) {
if (!DBQueryWarn("update reserved " .
"set pid='$pid',eid='$eid', ".
" old_pid='', old_eid='' ".
"where node_id='$node'")) {
TBDebugTimeStamp("nalloc allocated all nodes");
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