shownodetype.php3 4.54 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<?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>".
Leigh Stoller's avatar
Leigh Stoller committed
43 44
     "Node Type <b>$node_type</b>".
     "</font>\n";
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110

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>
111
      <td class=left>$HD GB</td>
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
          </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";

Leigh Stoller's avatar
Leigh Stoller committed
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
#
# Suck out info for all the nodes of this type. We are going to show
# just a list of dots, in two color mode.
# 
$query_result =
    DBQueryFatal("select n.node_id,r.pid ".
		 "from nodes as n ".
		 "left join node_types as nt on n.type=nt.type ".
		 "left join reserved as r on n.node_id=r.node_id ".
		 "where nt.type='$node_type' and ".
		 "      (role='testnode' or role='virtnode') ".
		 "ORDER BY priority");


if (mysql_num_rows($query_result)) {
    echo "<br>
          <center>
          <table class=nogrid cellspacing=0 border=0 cellpadding=5>\n";

    $maxcolumns = 4;
    $column     = 0;
    
    while ($row = mysql_fetch_array($query_result)) {
	$node_id = $row["node_id"];
	$pid     = $row["pid"];

	if ($column == 0) {
	    echo "<tr>\n";
	}
	$column++;

	echo "<td align=left><nobr>\n";

	if (!$pid) {
	    echo "<img src=\"/autostatus-icons/greenball.gif\" alt=free>\n";
	}
	else {
	    echo "<img src=\"/autostatus-icons/redball.gif\" alt=reserved>\n";
	}
	echo "&nbsp;";
#	echo "<a href=shownode.php3?node_id=$node_id>";
	echo "$node_id";
#	echo "</a>";
	echo "</nobr>
              </td>\n";
	
	if ($column == $maxcolumns) {
	    echo "</tr>\n";
	    $column = 0;
	}
    }
    echo "</table>\n";
    echo "<br>
          <img src=\"/autostatus-icons/greenball.gif\" alt=free>&nbsp;Free
          &nbsp &nbsp &nbsp
          <img src=\"/autostatus-icons/redball.gif\" alt=free>&nbsp;Reserved
          </center>\n";
}

210 211 212 213 214 215 216 217 218
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>