All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 4299cfcc authored by Leigh B Stoller's avatar Leigh B Stoller

Another fix for the portal when not the Portal; construct status

blob for the picker from local state.
parent b52421db
......@@ -932,7 +932,30 @@ class ExtensionInfo
# $amlist, $fedlist, and $status are all output arrays
function CalculateAggregateStatus(&$amlist, &$fedlist, &$status) {
global $TBMAINSITE, $DEFAULT_AGGREGATE_URN, $CHECKLOGIN_USER;
$am_array = Instance::DefaultAggregateList();
#
# If not the Cloudlab Portal then we get local status only.
#
if (!$TBMAINSITE) {
$aggregate = $am_array[$DEFAULT_AGGREGATE_URN];
$urn = $aggregate->urn();
$am = $aggregate->name();
$amlist[$urn] = $am;
$freevms = $vmcount = 0;
TBVMCounts($vmcount, $freevms);
$status[$urn] = array(
"rawPCsAvailable" => TBFreePCs($CHECKLOGIN_USER),
"rawPCsTotal" => TBTotalPCs(),
"VMsAvailable" => $freevms,
"VMsTotal" => $vmcount,
"health" => 100,
"status" => "SUCCESS");
return;
}
while (list($ignore, $aggregate) = each($am_array)) {
$urn = $aggregate->urn();
$am = $aggregate->name();
......
<?php
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -466,6 +466,67 @@ function TBFreePCs($target = null)
return $total;
}
#
# Number of PCs.
#
function TBTotalPCs()
{
$total = 0;
$query_result =
DBQueryFatal("select a.type,count(a.node_id) from nodes as a ".
"left join node_types as nt on a.type=nt.type ".
"left join node_type_attributes as attr on ".
" attr.type=a.type and ".
" attr.attrkey='noshowfreenodes' ".
"where a.role='testnode' and ".
" attr.attrvalue is null and ".
" nt.class = 'pc' ".
"group by a.type");
if (mysql_num_rows($query_result) == 0) {
return 0;
}
while ($row = mysql_fetch_row($query_result)) {
$type = $row[0];
$count = $row[1];
$total += $count;
}
return $total;
}
#
# Number of total/free shared VMs.
#
function TBVMCounts(&$total, &$free)
{
$query_result =
DBQueryFatal("select n.node_id,aux.count,r.erole from nodes as n ".
"left join reserved as r on r.node_id=n.node_id ".
"left join node_auxtypes as aux on ".
" aux.node_id=n.node_id and aux.type='pcvm' ".
"where r.erole='sharedhost'");
if (mysql_num_rows($query_result) == 0) {
$total = 0;
$free = 0;
}
while ($row = mysql_fetch_row($query_result)) {
$node_id = $row[0];
$count = $row[1];
if (isset($count)) {
$total += $count;
$used_result =
DBQueryFatal("select count(node_id) from nodes ".
"where phys_nodeid='$node_id'");
$urow = mysql_fetch_row($used_result);
$ucount = $urow[0];
$free += $count - $ucount;
}
}
return;
}
#
# Number of logged in users
#
......
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