shownode.php3 2.69 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-2003 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
29
30
31
32
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);
}

#
# Check to make sure that this is a valid nodeid
#
33
34
if (! TBValidNodeName($node_id)) {
    USERERROR("$node_id is not a valid node name!", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
35
36
37
38
39
40
41
42
43
44
45
46
}

#
# 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 modify node $node_id!", 1);
    }
}

Chad Barb's avatar
   
Chad Barb committed
47
48
49
echo "<font size=+2>".
     "Node <b>$node_id</b>";

50
51
52
53
$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
54

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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
71
72
}	

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

75
76
SUBPAGESTART();
SUBMENUSTART("Node Options");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
77

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

87
88
89
#
# SSH to option.
# 
90
if (isset($pid)) {
91
92
93
94
95
    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
96
97
98
#
# Edit option
#
Chad Barb's avatar
Chad Barb committed
99
WRITESUBMENUBUTTON("Edit Node Info",
100
		   "nodecontrol_form.php3?node_id=$node_id");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
101

102
if (TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_REBOOT)) {
103
104
105
106
107
    if (isset($pid)) {
	WRITESUBMENUBUTTON("Update Node",
			   "updateaccounts.php3?pid=$pid&eid=$eid".
			   "&nodeid=$node_id");
    }
108
109
110
111
    WRITESUBMENUBUTTON("Reboot Node",
		       "boot.php3?node_id=$node_id");
}

112
if ($isadmin) {
113
    WRITESUBMENUBUTTON("Show Node Log",
114
115
116
		       "shownodelog.php3?node_id=$node_id");
    WRITESUBMENUBUTTON("Free Node",
		       "freenode.php3?node_id=$node_id");
117
}
118
119
120
121
122
123
124
125
SUBMENUEND();

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

SUBPAGEEND();
126

Leigh B. Stoller's avatar
Leigh B. Stoller committed
127
128
129
130
131
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
Chad Barb's avatar
Chad Barb committed
132
133
134
135