Commit ea057c14 authored by Leigh Stoller's avatar Leigh Stoller

Very silly page to display a node_type. Hey, Mike requested this, what

can I say? This page is public, and linked from various places.
parent a2f3f1bd
......@@ -1062,6 +1062,24 @@ function TBValidNodeName($node)
return 1;
}
#
# Confirm a valid node type
#
# usage TBValidNodeType($type)
# returns 1 if valid
# returns 0 if not valid
#
function TBValidNodeType($type)
{
$query_result =
DBQueryFatal("select type from node_types where type='$type'");
if (mysql_num_rows($query_result) == 0) {
return 0;
}
return 1;
}
#
# Return mail addresses for project_root and group_root people.
#
......
......@@ -13,8 +13,8 @@
<ul>
<a name="tbpcs"></a>
<a name="tbpc850"></a>
<li>128 "pc850" PC nodes (<b>pc41-pc168</b>), consisting of:
<li>128 <a href=shownodetype.php3?node_type=pc850>pc850</a>
PC nodes (<b>pc41-pc168</b>), consisting of:
<ul>
<li> 850MHz Intel Pentium III processors.
<li> Based on the
......@@ -43,7 +43,8 @@ Intel EtherExpress Pro</a> 10/100Mbps Ethernet ports:
<p>
<a name="tbpc600"></a>
<li>40 "pc600" PC nodes (<b>pc1-40</b>), consisting of:
<li>40 <a href=shownodetype.php3?node_type=pc600>pc600</a>
PC nodes (<b>pc1-40</b>), consisting of:
<ul>
<li> 600MHz Intel Pentium III "Coppermine" processors.
......
......@@ -31,7 +31,6 @@ $isadmin = ISADMIN($uid);
echo "<b>Show: <a href='nodecontrol_list.php3?showtype=pcs'>pcs</a>,
<a href='nodecontrol_list.php3?showtype=widearea'>widearea</a>,
<a href='nodecontrol_list.php3?showtype=virtnodes'>virtual</a>,
<a href='nodecontrol_list.php3?showtype=sharks'>sharks</a>,
<a href='nodecontrol_list.php3?showtype=all'>all</a>.
</b><br><br>\n";
......@@ -124,15 +123,14 @@ while ($row = mysql_fetch_array($query_result)) {
$status = $row[status];
$type = $row[type];
if (! isset($freetypes[$type])) {
$freetypes[$type] = 0;
}
switch ($status) {
case "up":
$num_up++;
if (!$pid) {
$num_free++;
if (! isset($freetypes[$type])) {
$freetypes[$type] = 0;
}
$freetypes[$type]++;
}
break;
......@@ -188,7 +186,8 @@ echo "<table>
foreach($freetypes as $key => $value) {
echo "<tr>
<td align=right><b><font color=green>$key</font></b></td>
<td align=right><a href=shownodetype.php3?node_type=$type>
$key</a></td>
<td align=left>$value</td>
</tr>\n";
}
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
#
# Standard Testbed Header
#
PAGEHEADER("Node Type Information");
#
# Anyone can access this info, its a PUBLIC PAGE!
#
#
# Verify form arguments.
#
if (!isset($node_type) ||
strcmp($node_type, "") == 0) {
USERERROR("You must provide a node type.", 1);
}
#
# Check to make sure that this is a valid nodeid
#
if (! TBValidNodeType($node_type)) {
USERERROR("$node_type is not a valid node type!", 1);
}
$query_result =
DBQueryFatal("select * from node_types ".
"where type='$node_type'");
if (! mysql_num_rows($query_result) != 0) {
TBERROR("No entry for node_type $node_type!", 1);
}
$noderow = mysql_fetch_assoc($query_result);
echo "<font size=+2>".
"Node Type <b>$node_type</b>";
echo "<table border=2 cellpadding=0 cellspacing=2
align=center>\n";
$class = $noderow["class"];
$proc = $noderow["proc"];
$speed = $noderow["speed"];
$RAM = $noderow["RAM"];
$HD = $noderow["HD"];
$max_interfaces = $noderow["max_interfaces"];
$osid = $noderow["osid"];
$imageid = $noderow["imageid"];
$imageable = $noderow["imageable"];
$delay_capacity = $noderow["delay_capacity"];
$virtnode_capacity = $noderow["virtnode_capacity"];
$delay_osid = $noderow["delay_osid"];
$jail_osid = $noderow["jail_osid"];
$isvirtnode = $noderow["isvirtnode"];
$isremotenode = $noderow["isremotenode"];
TBOSInfo($osid, $osname, $pid);
TBOSInfo($jail_osid, $jail_osname, $pid);
TBOSInfo($delay_osid, $delay_osname, $pid);
TBImageInfo($imageid, $imagename, $pid);
echo "<tr>
<td>Type:</td>
<td class=left>$node_type</td>
</tr>\n";
echo "<tr>
<td>Class:</td>
<td class=left>$class</td>
</tr>\n";
if ($isremotenode) {
echo "<tr>
<td>Remote:</td>
<td class=left>Yes</td>
</tr>\n";
}
if ($isvirtnode) {
echo "<tr>
<td>Virtual:</td>
<td class=left>Yes</td>
</tr>\n";
}
echo "<tr>
<td>Processor:</td>
<td class=left>$proc</td>
</tr>\n";
echo "<tr>
<td>Speed:</td>
<td class=left>$speed MHZ</td>
</tr>\n";
echo "<tr>
<td>RAM:</td>
<td class=left>$RAM MB</td>
</tr>\n";
echo "<tr>
<td>Disk Size:</td>
<td class=left>$HD MB</td>
</tr>\n";
echo "<tr>
<td>Interfaces:</td>
<td class=left>$max_interfaces</td>
</tr>\n";
echo "<tr>
<td>Delay Capacity:</td>
<td class=left>$delay_capacity</td>
</tr>\n";
echo "<tr>
<td>Jail Capacity:</td>
<td class=left>$virtnode_capacity</td>
</tr>\n";
echo "<tr>
<td>Default OSID:</td>
<td class=left>$osname</td>
</tr>\n";
echo "<tr>
<td>Jail OSID:</td>
<td class=left>$jail_osname</td>
</tr>\n";
echo "<tr>
<td>Delay OSID:</td>
<td class=left>$delay_osname</td>
</tr>\n";
echo "<tr>
<td>Default ImageID:</td>
<td class=left>$imagename</td>
</tr>\n";
echo "</table>\n";
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>
......@@ -51,7 +51,7 @@ if ($output == "xml") {
PAGEHEADER("Node Up/Down Status");
$query_result =
DBQueryFatal("SELECT n.node_id, n.type, ns.status FROM nodes as n ".
DBQueryFatal("SELECT n.node_id,n.type,ns.status,nt.class FROM nodes as n ".
"left join node_types as nt on nt.type=n.type ".
"left join node_status as ns on ns.node_id=n.node_id ".
"WHERE nt.class!='shark' and role='testnode'".
......@@ -141,13 +141,20 @@ while ($r = mysql_fetch_array($query_result)) {
$node_id = $r["node_id"];
$type = $r["type"];
$status = $r["status"];
$class = $r["class"];
if ($type != $lasttype) {
if ($lasttype != "") { # Doesn't need to happen the first time
print("</table>\n\n");
}
print("<h3>$type</h3>\n");
if ($class == "pc") {
print("<a href=shownodetype.php3?node_type=$type>".
"<h4>$type</h4></a>\n");
}
else {
print("<h4>$type</h4>\n");
}
print("<table class=\"nogrid\" ".
"cellspacing=0 border=0 cellpadding=5>\n");
......
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