shownode.php3 2.86 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
}

#
# 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)) {
Leigh B. Stoller's avatar
Leigh B. Stoller committed
43
        USERERROR("You do not have permission to access node $node_id!", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
44 45 46
    }
}

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 113 114 115 116
if (TBNodeAccessCheck($uid, $node_id, $TB_NODEACCESS_LOADIMAGE)) {
    WRITESUBMENUBUTTON("Create a Disk Image",
		       "newimageid_ez.php3?formfields[node]=$node_id");
}

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

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

SUBPAGEEND();
131

Leigh B. Stoller's avatar
Leigh B. Stoller committed
132 133 134 135 136
#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>
Chad Barb's avatar
Chad Barb committed
137 138 139 140