shownode.php3 3.44 KB
Newer Older
Leigh Stoller's avatar
Leigh Stoller committed
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh Stoller committed
5 6
# All rights reserved.
#
Leigh Stoller's avatar
Leigh Stoller committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
include("defs.php3");
include("showstuff.php3");

#
# Standard Testbed Header
#
PAGEHEADER("Node Information");

#
# Only known and logged in users can do this.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);

#
# Verify form arguments.
# 
if (!isset($node_id) ||
    strcmp($node_id, "") == 0) {
    USERERROR("You must provide a node ID.", 1);
}
29 30 31
if (!TBvalid_node_id($node_id)) {
    PAGEARGERROR("Illegal characters in arguments");
}
Leigh Stoller's avatar
Leigh Stoller committed
32 33 34 35

#
# Check to make sure that this is a valid nodeid
#
36 37
if (! TBValidNodeName($node_id)) {
    USERERROR("$node_id is not a valid node name!", 1);
Leigh Stoller's avatar
Leigh Stoller committed
38 39
}

40 41 42
echo "<font size=+2>".
     "Node <b>$node_id</b></font>";

Leigh Stoller's avatar
Leigh Stoller committed
43 44 45 46
#
# Admin users can look at any node, but normal users can only control
# nodes in their own experiments.
#
47 48 49 50 51
if (! $isadmin &&
    ! TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_MODIFYINFO)) {
    SHOWNODE($node_id, SHOWNODE_NOPERM);
    PAGEFOOTER();
    return;
Leigh Stoller's avatar
Leigh Stoller committed
52 53
}

54 55 56 57
$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 ".
		 "where n.node_id='$node_id'");
58

59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
if (! mysql_num_rows($query_result) != 0) {
    TBERROR("Node $node id does not have a nodes table entry!", 1);
}

$row = mysql_fetch_array($query_result);
$vname		= $row[vname];
$pid 		= $row[pid];
$eid		= $row[eid];

if (isset($pid) && $vname != "") {
    echo " (<b>".
	 "   $vname.".
	 "   <a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>.".
	 "   <a href='showproject.php3?pid=$pid'>$pid</a>.".
	 "       $OURDOMAIN".
	 "  </b>)";
75 76
}	

77
echo "</font><br><br>\n";
78

79 80
SUBPAGESTART();
SUBMENUSTART("Node Options");
Leigh Stoller's avatar
Leigh Stoller committed
81

Chad Barb's avatar
Chad Barb committed
82 83 84
#
# Tip to node option
#
85
if (TBHasSerialConsole($node_id)) {
Chad Barb's avatar
Chad Barb committed
86 87 88 89 90
    WRITESUBMENUBUTTON("Connect to Serial Line</a> " . 
	"<a href=\"faq.php3#UTT-TUNNEL\">(howto)",
	"nodetipacl.php3?node_id=$node_id");
}

91 92 93
#
# SSH to option.
# 
94
if (isset($pid)) {
95 96 97 98 99
    WRITESUBMENUBUTTON("SSH to node</a> ".
		       "<a href='docwrapper.php3?docname=ssh-mime.html'>".
		       "(howto)", "nodessh.php3?node_id=$node_id");
}

Leigh Stoller's avatar
Leigh Stoller committed
100 101 102
#
# Edit option
#
Chad Barb's avatar
Chad Barb committed
103
WRITESUBMENUBUTTON("Edit Node Info",
104
		   "nodecontrol_form.php3?node_id=$node_id");
Leigh Stoller's avatar
Leigh Stoller committed
105

106
if ($isadmin || TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_REBOOT)) {
107 108 109 110 111
    if (isset($pid)) {
	WRITESUBMENUBUTTON("Update Node",
			   "updateaccounts.php3?pid=$pid&eid=$eid".
			   "&nodeid=$node_id");
    }
112 113
    WRITESUBMENUBUTTON("Reboot Node",
		       "boot.php3?node_id=$node_id");
114 115 116

    WRITESUBMENUBUTTON("Show Boot Log",
		       "bootlog.php3?node_id=$node_id");
117 118
}

119 120 121 122 123
if (TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_LOADIMAGE)) {
    WRITESUBMENUBUTTON("Create a Disk Image",
		       "newimageid_ez.php3?formfields[node]=$node_id");
}

124 125 126 127 128 129 130
if (($isadmin || TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_READINFO)) &&
    (TBNodeClass($node_id) == "robot")) {
    WRITESUBMENUBUTTON("Show Telemetry",
		       "telemetry.php3?node=$node_id",
		       "telemetry");
}

131
if ($isadmin) {
132
    WRITESUBMENUBUTTON("Show Node Log",
133
		       "shownodelog.php3?node_id=$node_id");
134 135
    WRITESUBMENUBUTTON("Show Node History",
		       "shownodehistory.php3?node_id=$node_id");
136 137
    WRITESUBMENUBUTTON("Free Node",
		       "freenode.php3?node_id=$node_id");
138 139
    WRITESUBMENUBUTTON("Set Node Location",
		       "setnodeloc.php3?node_id=$node_id");
140
}
141 142 143 144 145 146 147 148
SUBMENUEND();

#
# Dump record.
# 
SHOWNODE($node_id);

SUBPAGEEND();
149

Leigh Stoller's avatar
Leigh Stoller committed
150 151 152 153 154
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
Chad Barb's avatar
Chad Barb committed
155 156 157 158