Commit f99a377a authored by Leigh Stoller's avatar Leigh Stoller

Minor change to SHOWNODE() routine, which is called from various

places. Change $short optional argument to a flags argument, and add a
NOPERM flag, which allows display of a node to people without
permission to view that node. The display is cut back to node type,
and a couple of other things that are not private. I also added a
section on the Interfaces of a node, using the interfaces table for
the node, joined with the interface_types and interface_capabilities
tables. This gives more specific information about a node then is
possible using the generic node_types table.
parent 21489966
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -72,7 +72,7 @@ if (!$confirmed) {
sure you want to reboot node '$node_id?'
</h2>\n";
SHOWNODE($node_id, 1);
SHOWNODE($node_id, SHOWNODE_SHORT);
}
else {
echo "<font size=+2>Experiment <b>".
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2002, 2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -71,7 +71,7 @@ if (!$confirmed) {
sure you want to free node '$node_id?'
</h2>\n";
SHOWNODE($node_id);
SHOWNODE($node_id, SHOWNODE_NOFLAGS);
echo "<form action='freenode.php3?node_id=$node_id' method=post>";
echo "<b><input type=submit name=confirmed value=Confirm></b>\n";
......
......@@ -84,7 +84,7 @@ echo "<center>
<h3>Node parameters successfully modified!</h3><p>
</center>\n";
SHOWNODE($node_id);
SHOWNODE($node_id, SHOWNODE_NOFLAGS);
#
# Edit option.
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -26,6 +26,9 @@ if (!isset($node_id) ||
strcmp($node_id, "") == 0) {
USERERROR("You must provide a node ID.", 1);
}
if (!TBvalid_node_id($node_id)) {
PAGEARGERROR("Illegal characters in arguments");
}
#
# Check to make sure that this is a valid nodeid
......@@ -34,19 +37,20 @@ if (! TBValidNodeName($node_id)) {
USERERROR("$node_id is not a valid node name!", 1);
}
echo "<font size=+2>".
"Node <b>$node_id</b></font>";
#
# Admin users can look at any node, but normal users can only control
# nodes in their own experiments.
#
if (! $isadmin) {
if (! TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_MODIFYINFO)) {
USERERROR("You do not have permission to access node $node_id!", 1);
}
if (! $isadmin &&
! TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_MODIFYINFO)) {
SHOWNODE($node_id, SHOWNODE_NOPERM);
PAGEFOOTER();
return;
}
echo "<font size=+2>".
"Node <b>$node_id</b>";
$query_result =
DBQueryFatal("select r.vname,r.pid,r.eid from nodes as n ".
"left join reserved as r on n.node_id=r.node_id ".
......
......@@ -198,7 +198,7 @@ function SHOWGROUP($pid, $gid) {
#
# Generate the table.
#
#
echo "<tr>
<td>GID: </td>
<td class=\"left\">
......@@ -627,6 +627,7 @@ function SHOWEXP($pid, $eid, $short = 0) {
$mem_usage = $exprow["mem_usage"];
$cpu_usage = $exprow["cpu_usage"];
$exp_slice = $exprow[slicename];
$linktest = $exprow["linktest_level"];
$autoswap_hrs= ($autoswap_timeout/60.0);
$idleswap_hrs= ($idleswap_timeout/60.0);
......@@ -849,6 +850,12 @@ function SHOWEXP($pid, $eid, $short = 0) {
<td class=\"left\">$syncserver</td>
</tr>\n";
}
if ($linktest) {
echo "<tr>
<td>Linktest Level: </td>
<td class=\"left\">$linktest</td>
</tr>\n";
}
}
echo "</table>\n";
......@@ -955,13 +962,13 @@ function SHOWEXPLIST($type,$id,$gid = "") {
"at least one node in the experiment has not <br>reported ".
"on its proper schedule.\n";
if ($parens) {
# don't show this unless we did it... most users shouldn't ever
# do not show this unless we did it... most users should not ever
# need to know that some expts have their idleness ignored
echo "Values are in parenthesis for idle-ignore experiments.\n";
}
echo "</ol></font></td></tr></table>\n";
}
}
}
#
......@@ -1564,7 +1571,7 @@ function SHOWOSIDEXPTS($pid, $osname, $uid) {
#
# Gotta make sure that the user actually has the right to see this
# experiment - summarize all the experiments that he/she can't see
# experiment - summarize all the experiments that he/she cannot see
# at the bottom
#
if (!TBExptAccessCheck($uid,$pid,$eid,$TB_EXPT_READINFO)) {
......@@ -1589,7 +1596,14 @@ function SHOWOSIDEXPTS($pid, $osname, $uid) {
#
# Show node record.
#
function SHOWNODE($node_id, $short = 0) {
define("SHOWNODE_NOFLAGS", 0);
define("SHOWNODE_SHORT", 1);
define("SHOWNODE_NOPERM", 2);
function SHOWNODE($node_id, $flags = 0) {
$short = ($flags & SHOWNODE_SHORT ? 1 : 0);
$noperm = ($flags & SHOWNODE_NOPERM ? 1 : 0);
$query_result =
DBQueryFatal("select n.*,na.*,r.vname,r.pid,r.eid,i.IP, ".
"greatest(last_tty_act,last_net_act,last_cpu_act,".
......@@ -1649,7 +1663,7 @@ function SHOWNODE($node_id, $short = 0) {
$last_report = $row[last_report];
$rsrvrole = $row[rsrvrole];
$phys_IP = $row[phys_IP];
if (!$def_boot_cmd_line)
$def_boot_cmd_line = "&nbsp";
if (!$next_boot_cmd_line)
......@@ -1680,7 +1694,7 @@ function SHOWNODE($node_id, $short = 0) {
}
}
if (!$short) {
if (!$short && !$noperm) {
if ($vname) {
echo "<tr>
<td>Virtual Name:</td>
......@@ -1705,10 +1719,11 @@ function SHOWNODE($node_id, $short = 0) {
echo "<tr>
<td>Node Type:</td>
<td class=left>$type</td>
<td class=left>
<A href='shownodetype.php3?node_type=$type'>$type</td>
</tr>\n";
if (!$short) {
if (!$short && !$noperm) {
echo "<tr>
<td>Def Boot OS:</td>
<td class=left>";
......@@ -1794,7 +1809,7 @@ function SHOWNODE($node_id, $short = 0) {
}
}
if (!$short) {
if (!$short && !$noperm) {
if (!$isvirtnode && !$isremotenode) {
echo "<tr>
<td>Def Boot Command&nbsp;Line:</td>
......@@ -1852,24 +1867,22 @@ function SHOWNODE($node_id, $short = 0) {
<td class=left>$sshdport</td>
</tr>\n";
}
}
echo "<tr>
<td>Startup Command:</td>
<td class=left>$startupcmd</td>
</tr>\n";
echo "<tr>
<td>Startup Command:</td>
<td class=left>$startupcmd</td>
</tr>\n";
echo "<tr>
<td>Tarballs:</td>
<td class=left>$tarballs</td>
</tr>\n";
echo "<tr>
<td>Tarballs:</td>
<td class=left>$tarballs</td>
</tr>\n";
echo "<tr>
<td>RPMs:</td>
<td class=left>$rpms</td>
</tr>\n";
echo "<tr>
<td>RPMs:</td>
<td class=left>$rpms</td>
</tr>\n";
if (!$short) {
if (!$isvirtnode && !$isremotenode) {
echo "<tr>
<td>Router Type:</td>
......@@ -1954,8 +1967,41 @@ function SHOWNODE($node_id, $short = 0) {
}
}
}
echo "</table>\n";
if (!$short) {
#
# Get interface info.
#
echo "<tr>
<td align=center colspan=2>Interface Info</td>
</tr>\n";
echo "<tr><th>Interface</th><th>Model; protocols</th>\n";
$query_result =
DBQueryFatal("select i.*,it.*,c.* from interfaces as i ".
"left join interface_types as it on ".
" i.interface_type=it.type ".
"left join interface_capabilities as c on ".
" i.interface_type=c.type and ".
" c.capkey='protocols' ".
"where i.node_id='$node_id' and ".
" i.role='" . TBDB_IFACEROLE_EXPERIMENT . "'".
"order by iface");
while ($row = mysql_fetch_array($query_result)) {
$iface = $row["iface"];
$type = $row["type"];
$man = $row["manufacturuer"];
$model = $row["model"];
$protocols = $row["capval"];
echo "<tr>
<td>$iface:&nbsp </td>
<td class=left>$type ($man $model; $protocols)</td>
</tr>\n";
}
}
echo "</table>\n";
}
#
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -96,7 +96,7 @@ if (!$confirmed) {
echo "</h2>\n";
if (isset($nodeid)) {
SHOWNODE($nodeid, 1);
SHOWNODE($nodeid, SHOWNODE_SHORT);
}
else {
SHOWEXP($pid, $eid, 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