shownode.php3 2.94 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-2004 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
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 B. Stoller's avatar
Leigh B. 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 B. Stoller's avatar
Leigh B. Stoller committed
38
39
}

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

Leigh B. Stoller's avatar
Leigh B. 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 B. Stoller's avatar
Leigh B. 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'");
Chad Barb's avatar
   
Chad Barb committed
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>)";
Chad Barb's avatar
   
Chad Barb committed
75
76
}	

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

79
80
SUBPAGESTART();
SUBMENUSTART("Node Options");
Leigh B. Stoller's avatar
Leigh B. 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 B. Stoller's avatar
Leigh B. 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 B. Stoller's avatar
Leigh B. Stoller committed
105

106
if (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
114
115
    WRITESUBMENUBUTTON("Reboot Node",
		       "boot.php3?node_id=$node_id");
}

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

121
if ($isadmin) {
122
    WRITESUBMENUBUTTON("Show Node Log",
123
124
125
		       "shownodelog.php3?node_id=$node_id");
    WRITESUBMENUBUTTON("Free Node",
		       "freenode.php3?node_id=$node_id");
126
}
127
128
129
130
131
132
133
134
SUBMENUEND();

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

SUBPAGEEND();
135

Leigh B. Stoller's avatar
Leigh B. Stoller committed
136
137
138
139
140
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
Chad Barb's avatar
Chad Barb committed
141
142
143
144