Commit 38facc58 authored by Austin Clements's avatar Austin Clements

Added knowledge of Plab nodes. In most cases, they work the same way

that jails do.  sshtb can now handle vnodeid's, and must be given a
vnodeid if it's a Plab node, because the username will differ
depending on this.
parent 8ac5565f
......@@ -145,7 +145,7 @@ use Exporter;
TBSaveExpLogFiles TBExptWorkDir TBExptUserDir TBExptLogDir
TBExptDestroy TBIPtoNodeID TBNodeBootReset TBNodeStateWait
TBLeaderMailList ExpGroup TBExptSetSwapUID TBExptSetThumbNail
TBNodeAllocCheck
TBNodeAllocCheck TBPlabNodeUsername
TBExptRemoveVirtualState TBExptBackupVirtualState
TBExptRestoreVirtualState
......@@ -2254,18 +2254,20 @@ sub TBIsNodeRemote($)
}
#
# Is a node virtual (or "multiplexed"). Optionally return jailflag.
# Is a node virtual (or "multiplexed"). Optionally return jailflag and a
# Plab flag.
#
# usage TBIsNodeVirtual(char *node, int *jailed)
# usage TBIsNodeVirtual(char *node, int *jailed, int *plabbed)
# Returns 1 if yes.
# Returns 0 if no.
#
sub TBIsNodeVirtual($;$)
sub TBIsNodeVirtual($;$$)
{
my ($nodeid, $jailed) = @_;
my ($nodeid, $jailed, $plabbed) = @_;
my $query_result =
DBQueryFatal("select isvirtnode,n.jailflag from nodes as n ".
DBQueryFatal("select isvirtnode,n.jailflag,t.isplabdslice ".
"from nodes as n ".
"left join node_types as t on t.type=n.type ".
"where n.node_id='$nodeid'");
......@@ -2277,9 +2279,39 @@ sub TBIsNodeVirtual($;$)
if (defined($jailed)) {
$$jailed = $row[1];
}
if (defined($plabbed)) {
$$plabbed = $row[2];
}
return($row[0]);
}
#
# Get the username used to log in to a particular vnode allocated on Plab
#
# usage TBPlabNodeUsername(char *node, char \*username)
# Returns 1 if successful
# Returns 0 if node is not allocated with Plab
#
sub TBPlabNodeUsername($$)
{
my ($nodeid, $username) = @_;
my $query_result =
DBQueryFatal("select slicename from plab_slice_nodes ".
"where node_id='$nodeid'");
if (! $query_result->num_rows) {
return 0;
}
my @row = $query_result->fetchrow_array();
if (defined($row[0])) {
$$username = $row[0];
return 1;
}
return 0;
}
#
# Set/Clear the current logfile for an experiment. The idea is to provide
# a way to look at what is going on from the web interface!
......
......@@ -50,7 +50,7 @@ if (@ARGV > 0) {
select pid,eid,r.node_id,max(tstamp) as t from reserved as r
left join node_idlestats as n on r.node_id=n.node_id
where r.node_id not like \"sh%\" and r.node_id not like \"wireless%\"
and r.node_id not like \"%ron%\"
and r.node_id not like \"%ron%\" and r.node_id not like \"%plab%\"
group by pid,eid,node_id
having t is null or (unix_timestamp(now())-unix_timestamp(t) >= $t*60)
order by pid,eid,node_id");
......
......@@ -189,10 +189,10 @@ my %realnodes = ();
my %virtnodes = ();
foreach my $node ( @nodes ) {
my $jailed;
my ($jailed, $plab);
if (TBIsNodeVirtual($node, \$jailed)) {
if (! $jailed) {
if (TBIsNodeVirtual($node, \$jailed, \$plab)) {
if (! $jailed && ! $plab) {
print "*** Skipping old style (non-jail) virtual node $node ...\n";
next;
}
......@@ -568,7 +568,7 @@ sub RebootVNode($$) {
#
$UID = 0;
exec("$ssh -host $pnode $CLIENT_BIN/vnodesetup -r -j $vnode");
exec("$ssh -host $vnode $CLIENT_BIN/vnodesetup -r -j $vnode");
exit(0);
}
......
......@@ -226,7 +226,7 @@ foreach my $node ( @nodes ) {
#
my $maxpids = 0;
foreach my $node ( @nodes ) {
my $jailed;
my ($jailed, $plab);
#
# widearea and jailed nodes auto update. Skip them.
......@@ -236,8 +236,8 @@ foreach my $node ( @nodes ) {
next;
}
# eventually all virtual nodes will be jailed ...
if (TBIsNodeVirtual($node, \$jailed)) {
if ($jailed) {
if (TBIsNodeVirtual($node, \$jailed, \$plab)) {
if ($jailed || $plab) {
push(@autonodes, $node);
}
next;
......
......@@ -159,17 +159,17 @@ while (my %row = $db_result->fetchhash()) {
my $type = $row{'type'};
my $bootpath = 0;
my $jailnode = 0;
my $plabnode = 0;
#
# VIRTNODE HACK: Virtual nodes are special. Jailed vnodes can do quite
# a bit, and so run them through the checks below.
#
if (TBIsNodeVirtual($node, \$jailed)) {
$vnodes{$node} = $jailed;
if (! $jailed) {
if (TBIsNodeVirtual($node, \$jailnode, \$plabnode)) {
$vnodes{$node} = ($jailnode || $plabnode);
if (! $jailnode && ! $plabnode) {
next;
}
$jailnode = 1;
}
else {
my $nodeAllocState;
......@@ -274,7 +274,7 @@ while (my %row = $db_result->fetchhash()) {
# associated with it, which means the same thing; we don't worry about
# it.
#
if (!$bootpath && !$jailnode) {
if (!$bootpath && !$jailnode && !$plabnode) {
#
# These checks are not necessary if the front end and web page
# are doing the right thing, but lets be careful anyway.
......
......@@ -127,10 +127,10 @@ foreach my $node ( @nodes ) {
# Must duplicate a check that would be done in node_reboot if we
# gave it the entire list. No point in rebooting local jails.
#
my $jailed;
my ($jailed, $plab);
if (TBIsNodeVirtual($node, \$jailed)) {
if (! $jailed) {
if (TBIsNodeVirtual($node, \$jailed, \$plab)) {
if (! $jailed && ! $plab) {
next;
}
if (! TBIsNodeRemote($node)) {
......
......@@ -80,17 +80,34 @@ if (!defined($hostname)) {
#
my $cmd;
if (! TBValidNodeName($hostname) || !TBIsNodeRemote($hostname)) {
if ($UNIFIED && ($hostname eq $BOSSNODE || $hostname eq $USERNODE ||
$hostname eq $FSNODE)) {
$cmd = "@ARGV";
} else {
$cmd = "$SSH $SSH_ARGS @args $hostname @ARGV";
}
if ($UNIFIED && ($hostname eq $BOSSNODE || $hostname eq $USERNODE ||
$hostname eq $FSNODE)) {
$cmd = "@ARGV";
}
else {
$cmd = "$SSH $SSH_ARGS @args -l emulabman $hostname @ARGV";
my $user;
if (TBValidNodeName($hostname)) {
my ($jailed, $plab, $physhost);
if (TBIsNodeVirtual($hostname, \$jailed, \$plab)) {
if ($plab) {
TBPlabNodeUsername($hostname, \$user);
}
TBPhysNodeID($hostname, \$physhost);
$hostname = $physhost;
}
elsif (TBIsNodeRemote($hostname)) {
$user = "emulabman";
}
}
$cmd = "$SSH $SSH_ARGS @args ";
if (defined($user)) {
$cmd .= "-l $user ";
}
$cmd .= "$hostname @ARGV";
}
if ($debug) {
print "$cmd\n";
}
......
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