Commit 9f3b1967 authored by Leigh Stoller's avatar Leigh Stoller

Fix the portal_monitor to calculate vcount and vfree so that the

web interface works properly for shared nodes. Note that we have the
same problem that jfed has; the advertisement does not tell us total
for shared nodes, only how many left.
parent b9b02d81
......@@ -316,6 +316,7 @@ sub CheckAggregates()
my $pcount = 0;
my $pavail = 0;
my $vcount = 0;
my $vfree = 0;
my %type_count = ();
my %type_avail = ();
......@@ -399,13 +400,20 @@ sub CheckAggregates()
next
if (!defined($slots) || $slots !~ /^\d+$/);
$vcount += $slots;
#
# Yuck, we do not get the total available on
# shared node, only how many still avail. Kludge
# it for now.
#
$vcount += 50;
$vfree += $slots;
}
}
}
}
}
print "$nickname: pcount:$pcount, pfree:$pavail, vcount:$vcount\n";
print "$nickname: pcount:$pcount, pfree:$pavail, ".
"vcount:$vcount vfree:$vfree\n";
foreach my $type (keys(%type_count)) {
my $count = $type_count{$type};
my $avail = $type_avail{$type};
......@@ -422,6 +430,7 @@ sub CheckAggregates()
$aggregate->pcount($pcount);
$aggregate->pfree($pavail);
$aggregate->vcount($vcount);
$aggregate->vfree($vfree);
}
}
return 0;
......
......@@ -98,6 +98,7 @@ class Aggregate
function pcount() { return $this->sfield('pcount'); }
function pfree() { return $this->sfield('pfree'); }
function vcount() { return $this->sfield('vcount'); }
function vfree() { return $this->sfield('vfree'); }
function last_error() { return $this->sfield('last_error'); }
# Hmm, how does one cause an error in a php constructor?
......
......@@ -920,7 +920,7 @@ function CalculateAggregateStatus(&$amlist, &$fedlist, &$status) {
$status[$urn] = array(
"rawPCsAvailable" => $aggregate->pfree(),
"rawPCsTotal" => $aggregate->pcount(),
"VMsAvailable" => "0",
"VMsAvailable" => $aggregate->vfree(),
"VMsTotal" => $aggregate->vcount(),
"health" => ($aggregate->status() == "up" ? 100 :
($aggregate->status() == "down" ?
......
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