Commit a389ec9a authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 0e61ae04 edc59d42
......@@ -2607,6 +2607,22 @@ sub OSSelect($$$$)
"where node_id='$nodeid'")
or return -1;
return -1
if ($self->ResetNextOpMode($debug) < 0);
return Refresh($self);
}
sub ResetNextOpMode($$)
{
my ($self,$debug) = @_;
my $nodeid = $self->node_id();
my $curmode = $self->op_mode();
# Why? When will this happen?
return 0
if (!$curmode);
#
# Determine what osid the node will now boot. We need to know this so we
# can set the next opmode. This call has to return *something* or we are
......@@ -2633,7 +2649,7 @@ sub OSSelect($$$$)
"where node_id='$nodeid'")
or return -1;
return Refresh($self);
return 0;
}
#
......
......@@ -102,8 +102,8 @@ my @PIDONLYTABLES = ("os_info");
my $q = DBQueryFatal("select pid_idx from projects ".
"where pid='$TBOPSPID'");
my ($npid) = $q->fetchrow_array();
my $q = DBQueryFatal("select gid_idx from groups ".
"where pid='$TBOPSPID' and gid=pid");
$q = DBQueryFatal("select gid_idx from groups ".
"where pid='$TBOPSPID' and gid=pid");
my ($ngid) = $q->fetchrow_array();
foreach my $table (@PIDGIDTABLES) {
......
......@@ -192,6 +192,11 @@ sub fetchhash($)
my $ref = $self->fetchrow_hashref();
return ($ref ? %$ref : ());
}
sub as_string($)
{
my ($self) = @_;
$self->dump_results();
}
# Not supported so generate an error.
sub dataseek($$)
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use Getopt::Std;
......@@ -61,6 +61,12 @@ while (my $arg = shift @ARGV) {
&debug("Node is $node");
&debug("Card is $card") if (defined $card);
printf("\n%9s %5s%s%s %9s %5s %5s %5s %3s %7s %7s\n",
"nodeid1", "card1",
$opt{I} ? " IP" : "",
$opt{m} ? " MAC" : "",
"nodeid2", "card2", "port2", "cable", "len", "wtype", "ntype");
my $query;
if ($opt{m} || $opt{I}) {
$query = "SELECT w.node_id1,w.card1,";
......@@ -96,7 +102,17 @@ while (my $arg = shift @ARGV) {
"$row[5] (length $row[6], color $wireinfo)\n";
}
} else {
print $result->as_string;
while (my @row = $result->fetchrow) {
my $i = 0;
printf("%9s %5d", $row[$i++], $row[$i++]);
printf("%16s", $row[$i++])
if ($opt{I});
printf(" %12s", $row[$i++])
if ($opt{m});
printf(" %9s %5d %5d %5d %3d %7s %7s\n",
$row[$i++], $row[$i++], $row[$i++], $row[$i++],
$row[$i++],$row[$i++],$row[$i++]);
}
}
}
......
#
# For building the client-side at Utah.
# Make sure we do not use ELVIN_COMPAT, we should never build images that
# way any more.
#
. defs-default
ELVIN_COMPAT=0
......@@ -685,7 +685,26 @@ sub Reload($$)
if (!((defined($self->nodeflag($nodeobject,'force'))
&& $self->nodeflag($nodeobject,'force'))
|| $self->nodeflag($nodeobject,'reconfig'))) {
$self->dprint(0,"Reload($node_id): no reload or reconfig to do, exiting!");
tbinfo "$self Reload($node_id): no reload or reconfig to do, simulating reloaddone instead!\n";
#
# BUT -- we need to simulate it from stated's perspective so that
# the reloads table is cleared.
#
TBSetNodeNextOpMode($node_id,TBDB_NODEOPMODE_RELOADPUSH);
TBSetNodeEventState($node_id,TBDB_NODESTATE_SHUTDOWN);
# give stated time to change op modes
sleep(4);
TBSetNodeEventState($node_id,TBDB_NODESTATE_RELOADSETUP);
TBSetNodeEventState($node_id,TBDB_NODESTATE_RELOADING);
TBSetNodeEventState($node_id,TBDB_NODESTATE_RELOADDONE);
# reset to teh op mode of the loaded image.
$nodeobject->Refresh();
$nodeobject->ResetNextOpMode($self->debug());
TBSetNodeEventState($node_id,TBDB_NODESTATE_SHUTDOWN);
TBSetNodeEventState($node_id,TBDB_NODESTATE_BOOTING);
TBSetNodeEventState($node_id,TBDB_NODESTATE_ISUP);
return 0;
}
......@@ -706,7 +725,26 @@ sub Reload($$)
if (!defined($self->nodeflag($nodeobject,'force'))
|| !$self->nodeflag($nodeobject,'force')) {
if ($self->nodeflag($nodeobject,'reconfig')) {
$self->dprint(1,"Reload($node_id): jumping straight to Reconfigure");
tbinfo "$self Reload($node_id): jumping straight to Reconfigure after simulating unnecessary reload\n";
#
# BUT -- we need to simulate it from stated's perspective so that
# the reloads table is cleared.
#
TBSetNodeNextOpMode($node_id,TBDB_NODEOPMODE_RELOADPUSH);
TBSetNodeEventState($node_id,TBDB_NODESTATE_SHUTDOWN);
# give stated time to change op modes
sleep(4);
TBSetNodeEventState($node_id,TBDB_NODESTATE_RELOADSETUP);
TBSetNodeEventState($node_id,TBDB_NODESTATE_RELOADING);
TBSetNodeEventState($node_id,TBDB_NODESTATE_RELOADDONE);
# reset to teh op mode of the loaded image.
$nodeobject->Refresh();
$nodeobject->ResetNextOpMode($self->debug());
TBSetNodeEventState($node_id,TBDB_NODESTATE_SHUTDOWN);
TBSetNodeEventState($node_id,TBDB_NODESTATE_BOOTING);
TBSetNodeEventState($node_id,TBDB_NODESTATE_ISUP);
$rc = $self->Reconfigure($nodeobject);
goto done;
}
......
......@@ -9,16 +9,6 @@
use English;
use Getopt::Std;
#
# This should run as root to make sure that it has permission to reboot nodes
# (since only root is allowed to power cycle nodes at any time - it's time-
# limited for anyone else)
#
if ($UID != 0) {
die("*** $0:\n".
" Only root can run this script!\n");
}
#
# Look for nodes to reload.
#
......@@ -75,7 +65,7 @@ sub fatal($);
sub notify($);
sub freefromreloading($);
my $os_load = "$TB/bin/os_load -s";
my $os_load = "$TB/bin/os_load -s -R";
my $sched_reload= "$TB/sbin/sched_reload";
my $reboot = "$TB/bin/node_reboot";
my $tbrsync = "$TB/bin/tbrsync";
......@@ -126,6 +116,16 @@ if (defined($options{"t"})) {
$logfile = "$logfile-$tag";
}
#
# This should run as root to make sure that it has permission to reboot nodes
# (since only root is allowed to power cycle nodes at any time - it's time-
# limited for anyone else)
#
if ($UID != 0 && !defined($tag)) {
die("*** $0:\n".
" Only root can run this script!\n");
}
#
# Only one please (for the default reload_daemon). If you specified
# a tag, it's your problem.
......
......@@ -164,7 +164,7 @@ sub doaction($@)
next
if (!-x "$BINDIR/rc/$script");
runbootscript(\%manifest,"$BINDIR/rc",$script,$what,"$optarg $bargs");
runbootscript(\%manifest,"$BINDIR/rc",$script,$what,"$optarg $bargs $what");
}
}
......
......@@ -1135,6 +1135,9 @@ sub getifconfig($;$)
my $setpat = q(INTERFACE_SETTING MAC=(\w*) );
$setpat .= q(KEY='([-\w\.\:]*)' VAL='([-\w\.\:]*)');
# XXX see very**3 special hack below
my $hastvirt = 0;
foreach my $str (@tmccresults) {
my $ifconfig = {};
......@@ -1243,6 +1246,7 @@ sub getifconfig($;$)
}
}
$hasvirt++;
$ifconfig->{"ISVIRT"} = 1;
$ifconfig->{"ITYPE"} = $ifacetype;
$ifconfig->{"IPADDR"} = $inet;
......@@ -1267,6 +1271,63 @@ sub getifconfig($;$)
}
}
#
# XXX "optimize" the interface list. We do this here rather than in the
# interface configuration script so that the delay/linkdelay scripts will
# get the same info.
#
# This is a very, very, very special case. If a non-encapsulating veth
# interface (veth-ne) maps 1-to-1 with an underlying physical interface,
# we want to just use the physical interface instead. This allows OSes
# (on physical nodes) which don't support a veth device (i.e., most of
# them) to talk to vnodes which are using veth-ne style.
#
# This can go away once we have separated the notion of multiplexing
# links from encapsulating links (a historical conflation) so that we
# don't have to force virtual devices onto physical nodes just because
# some virtual nodes in the same experiment require multiplexed links.
#
if ($hasvirt && !JAILED() && !GENVNODE() && !REMOTE() && !PLAB()) {
#
# Prelim: find out how many virt interfaces mapped to each phys
# interface and locate the entry for each phys interface.
#
my %vifcount = ();
my %pifs = ();
foreach my $ifconfig (@ifacelist) {
if ($ifconfig->{"ISVIRT"}) {
if ($ifconfig->{"PMAC"} ne "none") {
$vifcount{$ifconfig->{"PMAC"}}++;
}
} else {
$pifs{$ifconfig->{"MAC"}} = $ifconfig;
}
}
#
# Now for each 1-to-1 non-encap virt interface, move IP info
# onto physical interface, remember VMAC and toss veth entry.
#
my @nifacelist = ();
foreach my $ifconfig (@ifacelist) {
if ($ifconfig->{"ISVIRT"} && $ifconfig->{"ITYPE"} eq "veth" &&
$ifconfig->{"ENCAP"} == 0 && $ifconfig->{"PMAC"} ne "none" &&
$vifcount{$ifconfig->{"PMAC"}} == 1) {
my $pif = $pifs{$ifconfig->{"PMAC"}};
$pif->{"IPADDR"} = $ifconfig->{"IPADDR"};
$pif->{"IPMASK"} = $ifconfig->{"IPMASK"};
$pif->{"IFACE"} = $ifconfig->{"IFACE"};
$pif->{"RTABID"} = $ifconfig->{"RTABID"};
$pif->{"LAN"} = $ifconfig->{"LAN"};
$pif->{"FROMVMAC"} = $ifconfig->{"VMAC"};
print STDERR "NOTE: remapping ", $ifconfig->{"VIFACE"},
" to ", $ifconfig->{"IFACE"}, "\n";
} else {
push(@nifacelist, $ifconfig);
}
}
@ifacelist = @nifacelist;
}
@$rptr = @ifacelist;
return 0;
}
......
......@@ -859,14 +859,15 @@ sub LinkDelaySetup
$redparams .= "$weight/$minthresh/$maxthresh/$max_p";
}
#
# XXX don't try to set the speed/duplex of virtual devices
# XXX we should not be hardwiring the speed/duplex here anyway
#
if ($iface !~ /^(vlan|veth)/) {
$upcmds .= "ifconfig $iface media 100baseTX ".
"mediaopt full-duplex\n ";
}
# rc.ifconfig (through the generated rc.ifc) does this
##
## XXX don't try to set the speed/duplex of virtual devices
## XXX we should not be hardwiring the speed/duplex here anyway
##
#if ($iface !~ /^(vlan|veth)/) {
# $upcmds .= "ifconfig $iface media 100baseTX ".
# "mediaopt full-duplex\n ";
#}
$upcmds .= "ipfw add $pipeno pipe $pipeno ip from any to ".
"any out xmit $iface\n ";
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
# Why am I trying to fix this script!?
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/ltpmap ]; then
nid=`cat $BOOTDIR/nodeid`
nt=`grep $nid $BOOTDIR/ltpmap 2>/dev/null | awk "/^H/ { if (\\$3 == \"$nid\") print \\$5 }" 2>/dev/null`
if [ -n "$nt" ]; then
echo $nt
exit 0
fi
fi
# XXX for FreeBSD 5.x
if [ ! -r /var/run/dmesg.boot ]; then
dmesg > /var/run/dmesg.boot
......@@ -56,3 +66,5 @@ elif [ $cpuspeed = "2500" ]; then
else
echo pc$cpuspeed;
fi
exit 0
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002, 2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
......@@ -20,8 +20,8 @@ case "$1" in
#
# Not supported
#
echo "Health monitoring not supported on nodetype: $NODETYPE"
exit 1
echo "WARNING: health monitoring not supported on nodetype: $NODETYPE"
exit 0
;;
esac
......
......@@ -639,6 +639,10 @@ sub os_ifconfig_line($$$$$$$$;$$$)
elsif ($speed == 10) {
$media = $IFC_10MBS;
}
elsif ($speed == 0) {
warn("*** Speed was 0 in ifconfig, defaulting to auto negotiation (and Gb media)\n");
$media = $IFC_1000MBS;
}
else {
warn("*** Bad Speed $speed in ifconfig, default to 100Mbps\n");
$speed = 100;
......@@ -672,9 +676,21 @@ sub os_ifconfig_line($$$$$$$$;$$$)
if (defined($ethtool)) {
# this seems to work for returning an error on eepro100
$uplines =
"if $ethtool $iface >/dev/null 2>&1; then\n " .
" $ethtool -s $iface autoneg off speed $speed duplex $duplex\n " .
" sleep 2 # needed due to likely bug in e100 driver on pc850s\n".
"if $ethtool $iface >/dev/null 2>&1; then\n ";
if ($speed eq '0') {
$uplines .= " $ethtool -s $iface autoneg on\n";
}
else {
# If we're gigabit, we *must* turn on autoneg -- it's part
# of the GbE protocol.
if ($speed eq '1000') {
$uplines .= " $ethtool -s $iface autoneg on\n";
}
$uplines .=
" $ethtool -s $iface autoneg off speed $speed duplex $duplex\n " .
" sleep 2 # needed due to likely bug in e100 driver on pc850s\n";
}
$uplines .=
"else\n " .
" /sbin/mii-tool --force=$media $iface\n " .
"fi\n ";
......
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2011 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
# Why am I trying to fix this script!?
if [ -r $BOOTDIR/nodeid -a -r $BOOTDIR/ltpmap ]; then
nid=`cat $BOOTDIR/nodeid`
nt=`grep $nid $BOOTDIR/ltpmap 2>/dev/null | awk "/^H/ { if (\\$3 == \"$nid\") print \\$5 }" 2>/dev/null`
if [ -n "$nt" ]; then
echo $nt
exit 0
fi
fi
if [ -x $BINDIR/cpuspeed.awk ]; then
cpuspeed=`$BINDIR/cpuspeed.awk /proc/cpuinfo`;
else
......
#!/usr/bin/perl -wT
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008, 2010 University of Utah and the Flux Group.
# Copyright (c) 2008-2011 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
......@@ -13,20 +13,22 @@ use Getopt::Std;
#
sub usage()
{
print STDOUT "Usage: node_traffic [-C] [node...]\n";
print STDOUT "-h This message\n";
print STDOUT "-a Show all nodes regardless of node state\n";
print STDOUT "-r Show only traffic received by each node\n";
print STDOUT "-s Show only traffic sent by each node\n";
print STDOUT "-i seconds Show stats over a <seconds>-period interval\n";
print STDOUT "-E Aggregate by experiment\n";
# print STDOUT "-C Show control net traffic\n";
print STDERR "Usage: node_traffic [-aArsE] [-i seconds] [node...]\n";
print STDERR "Reports traffic from nodes on the control network.\n";
print STDERR "-h This message\n";
print STDERR "-a Show all nodes regardless of node state\n";
print STDERR "-A Really all; includes free nodes as well\n";
print STDERR "-r Show only traffic received by each node\n";
print STDERR "-s Show only traffic sent by each node\n";
print STDERR "-i seconds Show stats over a <seconds>-period interval\n";
print STDERR "-E Aggregate by experiment\n";
# print STDERR "-C Show control net traffic\n";
exit(-1);
}
sub gather($$);
my $optlist = "CEi:ars";
my $optlist = "CEi:aArs";
my $debug = 0;
my $interval = 0;
my $doall = 0;
......@@ -83,6 +85,9 @@ if (defined($options{"h"})) {
if (defined($options{"a"})) {
$doall = 1;
}
if (defined($options{"A"})) {
$doall = 2;
}
if (defined($options{"r"})) {
$recv = 1;
$send = 0;
......@@ -103,9 +108,8 @@ if (defined($options{"E"})) {
if (defined($options{"C"})) {
$controlnet = 1;
}
else {
@nodes = @ARGV;
}
@nodes = @ARGV;
#
# No nodes specified, get stats for all nodes that are in an experiment.
......@@ -115,21 +119,42 @@ if (@nodes > 0) {
$nclause = "and n.node_id in (" . join(",", map("'$_'", @nodes)) . ")";
}
my $query_result =
DBQueryWarn("select r.pid,r.eid,node_id1,eventstate,card1,node_id2".
" from wires as w,nodes as n,reserved as r".
" where w.node_id1=n.node_id and w.node_id1=r.node_id".
" and node_id2 like 'cisco%' and w.type='Control'".
" and n.role='testnode' $nclause".
" order by node_id2,card2,port2");
my $query_result;
if ($doall == 2) {
$query_result =
DBQueryWarn("select r.pid,r.eid,node_id1,eventstate,card1,node_id2".
" from wires as w,nodes as n".
" left join reserved as r on n.node_id=r.node_id".
" where w.node_id1=n.node_id".
" and (node_id2 like 'cisco%' or node_id2 like 'procurve%')".
" and w.type='Control'".
" and n.role='testnode' $nclause".
" order by node_id2,card2,port2");
} else {
$query_result =
DBQueryWarn("select r.pid,r.eid,node_id1,eventstate,card1,node_id2".
" from wires as w,nodes as n,reserved as r".
" where w.node_id1=n.node_id and w.node_id1=r.node_id".
" and (node_id2 like 'cisco%' or node_id2 like 'procurve%')".
" and w.type='Control'".
" and n.role='testnode' $nclause".
" order by node_id2,card2,port2");
}
if (! $query_result || $query_result->numrows == 0) {
print STDERR "Node(s) not found.\n";
exit(0);
}
while (my %row = $query_result->fetchhash()) {
my $switch = $row{'node_id2'};
my $pc = $row{'node_id1'};
my $pceth = $row{'card1'};
my $exp = $row{'pid'} . "/" . $row{'eid'};
my $exp;
if (defined($row{'pid'})) {
$exp = $row{'pid'} . "/" . $row{'eid'};
} else {
$exp = "<NONE>";
}
my $cnet = "$pc:$pceth";
push(@{$switches{$switch}}, $cnet);
......@@ -167,6 +192,10 @@ foreach my $node (keys %pcs) {
}
my $total = $after{$node}{'totals'}->[3] - $before{$node}{'totals'}->[3];
if ($total <= 0) {
print STDERR "*** $node: negative packet count (",
$before{$node}{'totals'}->[3], " to ",
$after{$node}{'totals'}->[3], " ($total)\n"
if ($total < 0);
next;
}
$pcs{$node}{'total'} = $total;
......@@ -247,7 +276,10 @@ sub gather($$)
print STDERR "*** $node: invalid portstats!?\n";
next;
}
next if (!exists($pcref->{$node}));
if (!exists($pcref->{$node})) {
print STDERR "*** $node: no stats returned!?\n";
next;
}
$resref->{$node}{'counts'} = @counts;
my $oct = 0;
my $upkts = 0;
......
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