Commit 7d2036d3 authored by Leigh Stoller's avatar Leigh Stoller

Add "disabled" flag to the tiplines table.

parent c33c5c15
...@@ -3675,6 +3675,7 @@ CREATE TABLE `tiplines` ( ...@@ -3675,6 +3675,7 @@ CREATE TABLE `tiplines` (
`tipname` varchar(32) NOT NULL default '', `tipname` varchar(32) NOT NULL default '',
`node_id` varchar(32) NOT NULL default '', `node_id` varchar(32) NOT NULL default '',
`server` varchar(64) NOT NULL default '', `server` varchar(64) NOT NULL default '',
`disabled` tinyint(1) NOT NULL default '0',
`portnum` int(11) NOT NULL default '0', `portnum` int(11) NOT NULL default '0',
`keylen` smallint(6) NOT NULL default '0', `keylen` smallint(6) NOT NULL default '0',
`keydata` text, `keydata` text,
......
#
# Add a disabled slot to tiplines table.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (! DBSlotExists("tiplines", "disabled")) {
DBQueryFatal("alter table tiplines add ".
" `disabled` tinyint(1) NOT NULL default '0' ".
" after server");
}
return 0;
}
1;
#!/usr/bin/perl -wT #!/usr/bin/perl -wT
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2008 University of Utah and the Flux Group. # Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
use English; use English;
use strict;
# #
# usage: console_setup node [node node ...] # usage: console_setup node [node node ...]
...@@ -67,6 +66,7 @@ if ($EUID != 0) { ...@@ -67,6 +66,7 @@ if ($EUID != 0) {
# #
foreach my $node (@nodes) { foreach my $node (@nodes) {
my($db_result); my($db_result);
my $pid;
# #
# Untaint the argument. # Untaint the argument.
...@@ -84,8 +84,8 @@ foreach my $node (@nodes) { ...@@ -84,8 +84,8 @@ foreach my $node (@nodes) {
# case we are done. This query could probably be rolled into the # case we are done. This query could probably be rolled into the
# next query, but that would be confusing. # next query, but that would be confusing.
# #
$tiplines_result = my $tiplines_result =
DBQueryFatal("select tipname,server from tiplines ". DBQueryFatal("select tipname,server,disabled from tiplines ".
"where node_id='$node' and ". "where node_id='$node' and ".
"server!='' and keydata is not null"); "server!='' and keydata is not null");
...@@ -121,6 +121,16 @@ foreach my $node (@nodes) { ...@@ -121,6 +121,16 @@ foreach my $node (@nodes) {
while (@row = $tiplines_result->fetchrow_array()) { while (@row = $tiplines_result->fetchrow_array()) {
my $tipname = $row[0]; my $tipname = $row[0];
my $server = $row[1]; my $server = $row[1];
my $disabled= $row[2];
#
# Let people know that a console line is disabled cause
# otherwise we will all forgot about it.
#
if ($disabled) {
print "Skipping disabled tipline: $tipname on $server ...\n";
next;
}
if (defined($cmdargs{$server})) { if (defined($cmdargs{$server})) {
$cmdargs{$server} = $cmdargs{$server} . " $tipname $pid"; $cmdargs{$server} = $cmdargs{$server} . " $tipname $pid";
......
...@@ -1046,7 +1046,7 @@ sub DumpDBGoo() ...@@ -1046,7 +1046,7 @@ sub DumpDBGoo()
" Could not dump table reserved\n"); " Could not dump table reserved\n");
# Copy tiplines table for all nodes so web form gives us a console icon! # Copy tiplines table for all nodes so web form gives us a console icon!
DBQueryWarn("select t.tipname,t.node_id,'',0,0,NULL ". DBQueryWarn("select t.tipname,t.node_id,'',t.disabled,0,0,NULL ".
"from reserved as r ". "from reserved as r ".
"left join virt_nodes as v on v.vname=r.vname and ". "left join virt_nodes as v on v.vname=r.vname and ".
" v.pid=r.pid and v.eid=r.eid ". " v.pid=r.pid and v.eid=r.eid ".
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group. # Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -377,6 +377,12 @@ sub tipconnect($) { ...@@ -377,6 +377,12 @@ sub tipconnect($) {
$portnum = $powerid_row{'portnum'}; $portnum = $powerid_row{'portnum'};
$keylen = $powerid_row{'keylen'}; $keylen = $powerid_row{'keylen'};
$keydata = $powerid_row{'keydata'}; $keydata = $powerid_row{'keydata'};
$disabled= $powerid_row{'disabled'};
if ($disabled) {
print STDERR "*** $controller tipline is disabled\n";
return 0;
}
if ($debug) { if ($debug) {
print "tipconnect: $server $portnum $keylen $keydata\n"; print "tipconnect: $server $portnum $keylen $keydata\n";
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2006-2010 University of Utah and the Flux Group. # Copyright (c) 2006-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include_once("osinfo_defs.php"); include_once("osinfo_defs.php");
...@@ -295,7 +295,7 @@ class Node ...@@ -295,7 +295,7 @@ class Node
$query_result = $query_result =
DBQueryFatal("select tipname from tiplines ". DBQueryFatal("select tipname from tiplines ".
"where node_id='$node_id'"); "where node_id='$node_id' and disabled=0");
return mysql_num_rows($query_result); return mysql_num_rows($query_result);
} }
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2010 University of Utah and the Flux Group. # Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
include("defs.php3"); include("defs.php3");
...@@ -61,8 +61,9 @@ if ($ELABINELAB) { ...@@ -61,8 +61,9 @@ if ($ELABINELAB) {
} }
else { else {
$query_result = DBQueryFatal("SELECT server, portnum, keylen, keydata " . $query_result =
"FROM tiplines WHERE node_id='$node_id'" ); DBQueryFatal("SELECT server, portnum, keylen, keydata, disabled " .
"FROM tiplines WHERE node_id='$node_id'" );
if (mysql_num_rows($query_result) == 0) { if (mysql_num_rows($query_result) == 0) {
USERERROR("The node $node_id does not exist, ". USERERROR("The node $node_id does not exist, ".
...@@ -73,6 +74,11 @@ else { ...@@ -73,6 +74,11 @@ else {
$portnum = $row["portnum"]; $portnum = $row["portnum"];
$keylen = $row["keylen"]; $keylen = $row["keylen"];
$keydata = $row["keydata"]; $keydata = $row["keydata"];
$disabled= $row["disabled"];
if ($disabled) {
USERERROR("The tipline for $node_id is currently disabled", 1);
}
# #
# Read in the fingerprint of the capture certificate # Read in the fingerprint of the capture certificate
......
<?php <?php
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2007, 2009 University of Utah and the Flux Group. # Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
# #
...@@ -143,7 +143,8 @@ function SHOWNODES($pid, $eid, $sortby, $showclass) { ...@@ -143,7 +143,8 @@ function SHOWNODES($pid, $eid, $sortby, $showclass) {
"left join node_types as nt on nt.type=n.type ". "left join node_types as nt on nt.type=n.type ".
"left join node_status as ns on ns.node_id=r.node_id ". "left join node_status as ns on ns.node_id=r.node_id ".
"left join os_info as oi on n.def_boot_osid=oi.osid ". "left join os_info as oi on n.def_boot_osid=oi.osid ".
"left join tiplines as tip on tip.node_id=r.node_id ". "left join tiplines as tip on tip.node_id=r.node_id and ".
" tip.disabled=0 ".
"inner join nodelogtemp as t on t.node_id=r.node_id ". "inner join nodelogtemp as t on t.node_id=r.node_id ".
"left join nodelog as nl on nl.node_id=r.node_id and nl.reported=t.reported ". "left join nodelog as nl on nl.node_id=r.node_id and nl.reported=t.reported ".
...@@ -165,7 +166,8 @@ function SHOWNODES($pid, $eid, $sortby, $showclass) { ...@@ -165,7 +166,8 @@ function SHOWNODES($pid, $eid, $sortby, $showclass) {
"left join node_types as nt on nt.type=n.type ". "left join node_types as nt on nt.type=n.type ".
"left join node_status as ns on ns.node_id=r.node_id ". "left join node_status as ns on ns.node_id=r.node_id ".
"left join os_info as oi on n.def_boot_osid=oi.osid ". "left join os_info as oi on n.def_boot_osid=oi.osid ".
"left join tiplines as tip on tip.node_id=r.node_id ". "left join tiplines as tip on tip.node_id=r.node_id and ".
" tip.disabled=0 ".
"WHERE r.eid='$eid' and r.pid='$pid' ". "WHERE r.eid='$eid' and r.pid='$pid' ".
"$classclause $noclassclause". "$classclause $noclassclause".
"ORDER BY $sortclause"); "ORDER BY $sortclause");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment