Commit 0b7c593c authored by Leigh Stoller's avatar Leigh Stoller

Another stats bug fix; do not count virtual nodes a pnodes for the

resource record. This has really messed up the counts for anything
with plab nodes (there are too few jail node experiments to worry
about) so need to come up with something to fix the resource records.
parent ff21d454
......@@ -2092,35 +2092,41 @@ sub PostSwap($$$$)
($which eq $EXPT_SWAPMOD &&
$self->state() eq libdb::EXPTSTATE_ACTIVE())) {
$query_result =
DBQueryWarn("select r.node_id,n.type,r.erole, ".
" r.vname,n.phys_nodeid ".
DBQueryWarn("select r.node_id,n.type,r.erole,r.vname, ".
" n.phys_nodeid,nt.isremotenode,nt.isvirtnode ".
" from reserved as r ".
"left join nodes as n on r.node_id=n.node_id ".
"left join node_types as nt on nt.type=n.type ".
"where r.exptidx='$exptidx' and ".
" (n.role='testnode' or n.role='virtnode')");
return -1
if (! $query_result);
$pnodes = $query_result->numrows;
DBQueryWarn("update experiment_resources set pnodes=$pnodes ".
"where idx=$rsrcidx")
or return -1;
# Count up the unique *local* pnodes.
my %pnodemap = ();
# Generate the pmapping insert.
my @mappings = ();
while (my ($node_id,$type,$erole,$vname,$physnode) =
while (my ($node_id,$type,$erole,$vname,$physnode,$isrem,$isvirt) =
$query_result->fetchrow_array()) {
push(@mappings,
"($rsrcidx, '$vname', '$physnode', '$type', '$erole')");
# We want just local physical nodes in this counter.
$pnodemap{$physnode} = $physnode
if (! ($isrem || $isvirt));
}
if (@mappings) {
DBQueryWarn("insert into experiment_pmapping values ".
join(",", @mappings))
or return -1;
}
$pnodes = scalar(keys(%pnodemap));
DBQueryWarn("update experiment_resources set pnodes=$pnodes ".
"where idx=$rsrcidx")
or return -1;
}
#
......
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