All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

shownode.php3 5.15 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
# Copyright (c) 2000-2019 University of Utah and the Flux Group.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# 
# {{{EMULAB-LICENSE
# 
# This file is part of the Emulab network testbed software.
# 
# This file is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
# 
# This file is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
# License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with this file.  If not, see <http://www.gnu.org/licenses/>.
# 
# }}}
Leigh B. Stoller's avatar
Leigh B. Stoller committed
23
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
include("defs.php3");
25
include_once("node_defs.php");
26
include_once("imageid_defs.php");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
27 28 29 30

#
# Only known and logged in users can do this.
#
31 32 33
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
Leigh B. Stoller's avatar
Leigh B. Stoller committed
34 35

#
36
# Verify page arguments.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
37
#
38
$reqargs = RequiredPageArguments("node", PAGEARG_NODE);
39
$optargs = OptionalPageArguments("classic", PAGEARG_BOOLEAN);
40 41 42

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

44
if (!$classic) {
45
    header("Location: portal/show-node.php?node_id=$node_id");
46 47 48
    return;
}

49 50 51 52
#
# Standard Testbed Header
#
PAGEHEADER("Node $node_id");
53

Leigh B. Stoller's avatar
Leigh B. Stoller committed
54 55 56 57
#
# Admin users can look at any node, but normal users can only control
# nodes in their own experiments.
#
58
if (! $isadmin &&
59
    ! $node->AccessCheck($this_user, $TB_NODEACCESS_MODIFYINFO)) {
60

61 62 63 64 65
    $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);
66
	$power_id = $row["power_id"];
67 68
    }
    if (STUDLY() && ($power_id == "mail")) {
69 70 71 72 73
	    SUBPAGESTART();
	    SUBMENUSTART("Node Options");
	    WRITESUBMENUBUTTON("Update Power State",
			       "powertime.php3?node_id=$node_id");
	    SUBMENUEND();
74
	    $node->Show(SHOWNODE_NOPERM);
75 76 77
	    SUBPAGEEND();
    }
    else {
78
	    $node->Show(SHOWNODE_NOPERM);
79
    }
80 81
    PAGEFOOTER();
    return;
Leigh B. Stoller's avatar
Leigh B. Stoller committed
82 83
}

84 85 86 87 88
# If reserved, more menu options.
if (($experiment = $node->Reservation())) {
    $pid   = $experiment->pid();
    $eid   = $experiment->eid();
    $vname = $node->VirtName();
89
}
Chad Barb's avatar
 
Chad Barb committed
90

91 92
SUBPAGESTART();
SUBMENUSTART("Node Options");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
93

Chad Barb's avatar
Chad Barb committed
94 95 96
#
# Tip to node option
#
97
if ($node->HasSerialConsole()) {
Chad Barb's avatar
Chad Barb committed
98
    WRITESUBMENUBUTTON("Connect to Serial Line</a> " . 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
99
	"<a href=\"faq.php3#tiptunnel\">(howto)",
Chad Barb's avatar
Chad Barb committed
100
	"nodetipacl.php3?node_id=$node_id");
101

102
    WRITESUBMENUBUTTON("Report a Problem" ,
103 104
		       "reportnode.php3?node_id=$node_id");

105
    WRITESUBMENUBUTTON("Show Console Log",
106
		       "showconlog.php3?node_id=$node_id&linecount=500");
Chad Barb's avatar
Chad Barb committed
107 108
}

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
if ($node->AccessCheck($this_user, $TB_NODEACCESS_LOADIMAGE)) {
    $baseimage = $node->def_boot_image();

    if ($baseimage &&
	$baseimage->AccessCheck($this_user, $TB_IMAGEID_DESTROY)) {
	WRITESUBMENUBUTTON("Create a Disk Image",
			   "loadimage.php3?target=$node_id" .
			   "&imageid=" . $baseimage->imageid() .
			   "&version=" . $baseimage->version());
    }
    else {
	#
	# This can happen for virtual nodes which are running the
	# defaut osid. User must create a new descriptor.
	#
	WRITESUBMENUBUTTON("Create a Disk Image",
			   "newimageid_ez.php3?node_id=$node_id");
    }
}

129 130 131
#
# SSH to option.
# 
132
if ($experiment) {
Leigh B Stoller's avatar
Leigh B Stoller committed
133 134 135
    $sshurl = $node->sshurl($uid);
    WRITESUBMENUBUTTON("SSH URL", $sshurl);
    
136
    WRITESUBMENUBUTTON("SSH to node</a> ".
137
		       "<a href='$WIKIDOCURL/ssh_mine'>".
138 139 140
		       "(howto)", "nodessh.php3?node_id=$node_id");
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
141 142 143
#
# Edit option
#
Chad Barb's avatar
Chad Barb committed
144
WRITESUBMENUBUTTON("Edit Node Info",
145
		   "nodecontrol_form.php3?node_id=$node_id");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
146

147 148 149
if ($isadmin ||
    $node->AccessCheck($this_user, $TB_NODEACCESS_REBOOT)) {
    if ($experiment) {
150 151 152 153
	WRITESUBMENUBUTTON("Update Node",
			   "updateaccounts.php3?pid=$pid&eid=$eid".
			   "&nodeid=$node_id");
    }
154 155
    WRITESUBMENUBUTTON("Reboot Node",
		       "boot.php3?node_id=$node_id");
156 157 158

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

161 162 163
if (($isadmin ||
     $node->AccessCheck($this_user, $TB_NODEACCESS_READINFO)) &&
    ($node->TypeClass() == "robot")) {
Timothy Stack's avatar
 
Timothy Stack committed
164
    WRITESUBMENUBUTTON("Show Telemetry",
165
		       "telemetry.php3?node_id=$node_id",
Timothy Stack's avatar
 
Timothy Stack committed
166 167 168
		       "telemetry");
}

169
if ($isadmin || OPSGUY()) {
170
    WRITESUBMENUBUTTON("Show Node Log",
171
		       "shownodelog.php3?node_id=$node_id");
172 173
    WRITESUBMENUBUTTON("Show Node History",
		       "shownodehistory.php3?node_id=$node_id");
174
}
175
if ($experiment && ($isadmin || (OPSGUY()) && $pid == $TBOPSPID)) {
176 177
    WRITESUBMENUBUTTON("Free Node",
		       "freenode.php3?node_id=$node_id");
178 179
}

180
if ($isadmin || STUDLY() || OPSGUY()) {
181 182
    WRITESUBMENUBUTTON("Set Node Location",
		       "setnodeloc.php3?node_id=$node_id");
Timothy Stack's avatar
 
Timothy Stack committed
183 184
    WRITESUBMENUBUTTON("Update Power State",
		       "powertime.php3?node_id=$node_id");
185
}
Kirk Webb's avatar
 
Kirk Webb committed
186 187

if ($isadmin || STUDLY() || OPSGUY()) {
Kirk Webb's avatar
 
Kirk Webb committed
188
    WRITESUBMENUBUTTON("Modify Node Attributes",
Kirk Webb's avatar
 
Kirk Webb committed
189 190 191
                       "modnodeattributes_form.php3?node_id=$node_id");
}

192 193 194 195 196
SUBMENUEND();

#
# Dump record.
# 
197
$node->Show(SHOWNODE_NOFLAGS);
198 199

SUBPAGEEND();
200

Leigh B. Stoller's avatar
Leigh B. Stoller committed
201 202 203 204 205
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
Chad Barb's avatar
Chad Barb committed
206 207 208 209