shownode.php3 4.28 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5 6
# All rights reserved.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
7
include("defs.php3");
8
include_once("node_defs.php");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
9 10 11 12 13 14 15 16 17

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

#
# Only known and logged in users can do this.
#
18 19 20
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
21 22

#
23
# Verify page arguments.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
#
25 26 27 28
$reqargs = RequiredPageArguments("node", PAGEARG_NODE);

# Need these below
$node_id = $node->node_id();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
29

30 31 32
echo "<font size=+2>".
     "Node <b>$node_id</b></font>";

Leigh B. Stoller's avatar
Leigh B. Stoller committed
33 34 35 36
#
# Admin users can look at any node, but normal users can only control
# nodes in their own experiments.
#
37
if (! $isadmin &&
38
    ! $node->AccessCheck($this_user, $TB_NODEACCESS_MODIFYINFO)) {
39

40 41 42 43 44
    $power_id = "";
    $query_result = DBQueryFatal("select power_id from outlets ".
				 "where node_id='$node_id'");
    if (mysql_num_rows($query_result) > 0) {
	$row = mysql_fetch_array($query_result);
45
	$power_id = $row["power_id"];
46 47
    }
    if (STUDLY() && ($power_id == "mail")) {
48 49 50 51 52 53
	    SUBPAGESTART();
	    
	    SUBMENUSTART("Node Options");
	    WRITESUBMENUBUTTON("Update Power State",
			       "powertime.php3?node_id=$node_id");
	    SUBMENUEND();
54
	    $node->Show(SHOWNODE_NOPERM);
55 56 57
	    SUBPAGEEND();
    }
    else {
58
	    $node->Show(SHOWNODE_NOPERM);
59
    }
60 61
    PAGEFOOTER();
    return;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
62 63
}

64 65 66 67 68
# If reserved, more menu options.
if (($experiment = $node->Reservation())) {
    $pid   = $experiment->pid();
    $eid   = $experiment->eid();
    $vname = $node->VirtName();
69
}
70
if ($experiment && $vname != "") {
71 72 73 74 75 76
    echo " (<b>".
	 "   $vname.".
	 "   <a href='showexp.php3?pid=$pid&eid=$eid'>$eid</a>.".
	 "   <a href='showproject.php3?pid=$pid'>$pid</a>.".
	 "       $OURDOMAIN".
	 "  </b>)";
Chad Barb's avatar
 
Chad Barb committed
77 78
}	

79
echo "</font><br><br>\n";
Chad Barb's avatar
 
Chad Barb committed
80

81 82
SUBPAGESTART();
SUBMENUSTART("Node Options");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
83

Chad Barb's avatar
Chad Barb committed
84 85 86
#
# Tip to node option
#
87
if ($node->HasSerialConsole()) {
Chad Barb's avatar
Chad Barb committed
88
    WRITESUBMENUBUTTON("Connect to Serial Line</a> " . 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
89
	"<a href=\"faq.php3#tiptunnel\">(howto)",
Chad Barb's avatar
Chad Barb committed
90
	"nodetipacl.php3?node_id=$node_id");
91 92

    WRITESUBMENUBUTTON("Show Console Log",
93
		       "showconlog.php3?node_id=$node_id&linecount=500");
Chad Barb's avatar
Chad Barb committed
94 95
}

96 97 98
#
# SSH to option.
# 
99
if ($experiment) {
100 101 102 103 104
    WRITESUBMENUBUTTON("SSH to node</a> ".
		       "<a href='docwrapper.php3?docname=ssh-mime.html'>".
		       "(howto)", "nodessh.php3?node_id=$node_id");
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
105 106 107
#
# Edit option
#
Chad Barb's avatar
Chad Barb committed
108
WRITESUBMENUBUTTON("Edit Node Info",
109
		   "nodecontrol_form.php3?node_id=$node_id");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
110

111 112 113
if ($isadmin ||
    $node->AccessCheck($this_user, $TB_NODEACCESS_REBOOT)) {
    if ($experiment) {
114 115 116 117
	WRITESUBMENUBUTTON("Update Node",
			   "updateaccounts.php3?pid=$pid&eid=$eid".
			   "&nodeid=$node_id");
    }
118 119
    WRITESUBMENUBUTTON("Reboot Node",
		       "boot.php3?node_id=$node_id");
120 121 122

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

125
if ($node->AccessCheck($this_user, $TB_NODEACCESS_LOADIMAGE)) {
126
    WRITESUBMENUBUTTON("Create a Disk Image",
127
		       "newimageid_ez.php3?formfields[node_id]=$node_id");
128 129
}

130 131 132
if (($isadmin ||
     $node->AccessCheck($this_user, $TB_NODEACCESS_READINFO)) &&
    ($node->TypeClass() == "robot")) {
Timothy Stack's avatar
 
Timothy Stack committed
133
    WRITESUBMENUBUTTON("Show Telemetry",
134
		       "telemetry.php3?node_id=$node_id",
Timothy Stack's avatar
 
Timothy Stack committed
135 136 137
		       "telemetry");
}

138
if ($isadmin || OPSGUY()) {
139
    WRITESUBMENUBUTTON("Show Node Log",
140
		       "shownodelog.php3?node_id=$node_id");
141 142
    WRITESUBMENUBUTTON("Show Node History",
		       "shownodehistory.php3?node_id=$node_id");
143
}
144
if ($experiment && ($isadmin || (OPSGUY()) && $pid == $TBOPSPID)) {
145 146
    WRITESUBMENUBUTTON("Free Node",
		       "freenode.php3?node_id=$node_id");
147 148
}

149
if ($isadmin || STUDLY() || OPSGUY()) {
150 151
    WRITESUBMENUBUTTON("Set Node Location",
		       "setnodeloc.php3?node_id=$node_id");
Timothy Stack's avatar
 
Timothy Stack committed
152 153
    WRITESUBMENUBUTTON("Update Power State",
		       "powertime.php3?node_id=$node_id");
154
}
Kirk Webb's avatar
 
Kirk Webb committed
155 156

if ($isadmin || STUDLY() || OPSGUY()) {
Kirk Webb's avatar
 
Kirk Webb committed
157
    WRITESUBMENUBUTTON("Modify Node Attributes",
Kirk Webb's avatar
 
Kirk Webb committed
158 159 160
                       "modnodeattributes_form.php3?node_id=$node_id");
}

161
if ($isadmin) {
162
    if (!$node->reserved_pid()) {
163
	WRITESUBMENUBUTTON("Pre-Reserve Node",
Russ Fish's avatar
Russ Fish committed
164
			   "prereserve_node.php3?node_id=$node_id");
165 166 167
    }
    else {
	WRITESUBMENUBUTTON("Clear Pre-Reserve",
Russ Fish's avatar
Russ Fish committed
168
			   "prereserve_node.php3?node_id=$node_id&clear=1");
169 170 171
    }
}

172 173 174 175 176
SUBMENUEND();

#
# Dump record.
# 
177
$node->Show(SHOWNODE_NOFLAGS);
178 179

SUBPAGEEND();
180

Leigh B. Stoller's avatar
Leigh B. Stoller committed
181 182 183 184 185
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
Chad Barb's avatar
Chad Barb committed
186 187 188 189