Commit 196dc611 authored by Weibin Sun's avatar Weibin Sun
Browse files

Merge remote branch 'central/master'

parents c0d66a79 de62ec00
......@@ -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;
}
#
......
......@@ -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.
......
......@@ -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 ";
......
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