Commit 62b4edc9 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add three new control mechanisms to the front end to control the use

of emulated and linkdelays on a per-link/lan basis (although you
cannot make a lan emulated at this time).

	tb-set-link-uselinkdelay $link0 1
	tb-set-lan-uselinkdelay $lan0 1
	tb-set-link-emulated $link0 1

Added slots to the virt_lans table, used in assign_wrapper to control
these features on a per link/lan basis. Note, the global options are
still available to prefer/force linkdelays for an entire experiment.
When setting uselinkdelays on a per link/basis, if the link would not
otherwise be shaped, you are requesting that a linkdelay be inserted
anyway (in otherwords, its the equiv of tb-set-forcelinkdelays on an
individual basis).
parent 4cc199f1
......@@ -1185,6 +1185,8 @@ CREATE TABLE virt_lans (
rlossrate float(10,3) default NULL,
cost float NOT NULL default '1',
widearea tinyint(4) default '0',
emulated tinyint(4) default '0',
uselinkdelay tinyint(4) default '0',
KEY pid (pid,eid,vname)
) TYPE=MyISAM;
......
......@@ -26,7 +26,7 @@
update node_types set disktype='ad' where type='pc2000';
update node_types set disktype='ad' where type='pc601';
1.114 Add nextosid slot to os_info table for mapping the generic
1.114: Add nextosid slot to os_info table for mapping the generic
osids (RHL-STD) to a specific one. Primarily used in os_setup
to figure out what to do with the generic names, but might also
be used someday to migrate people to newer versions?
......@@ -66,3 +66,14 @@ alter table node_activity add last_report datetime not null;
update node_activity set last_report=greatest(last_tty_act,
last_net_act,last_cpu_act,last_ext_act);
1.117: Add emulated and uselinkdelay slots to the virt_lans
table. Set in the front end, used in assign_wrapper.
alter table virt_lans add emulated tinyint(4) default '0' \
after widearea;
alter table virt_lans add uselinkdelay tinyint(4) default '0' \
after emulated;
Nothing special needs to be done.
......@@ -174,7 +174,9 @@ TBDebugTimeStamp("top started");
$sharkshelfid = 0;
# lans is indexed by virtual lan and is a list of nodeport members.
# emulated is 1 if the link/lan is emulated (virtual).
# emulated is 1 if the link/lan is emulated (virtual). This is
# controlled by the a variable in the virt_lans table. It also gets
# set when one of the nodes in the lan is a virtnode (jail).
my %lans = ();
my %emulated = ();
......@@ -210,6 +212,10 @@ my %linkdelays = ();
my $uselinkdelays = 0;
my $forcelinkdelays = 0;
# And the per-lan control, based on the above two variables, and
# per-lan variable in the virt_lans table. Indexed by lan name.
my %uselinkdelay = ();
my $query_result =
DBQueryFatal("SELECT uselinkdelays,forcelinkdelays from experiments ".
"where pid='$pid' and eid='$eid'");
......@@ -344,7 +350,8 @@ $result->finish;
printdb "Loading virt_lans.\n";
$result =
DBQueryFatal("select vname,member,delay,bandwidth,lossrate," .
"rdelay,rbandwidth,rlossrate,widearea " .
"rdelay,rbandwidth,rlossrate,widearea, ".
"emulated,uselinkdelay " .
"from virt_lans where pid='$pid' and eid='$eid' ".
"order by vname,member");
......@@ -358,11 +365,12 @@ my %rnodelans = ();
my %tunnels = ();
#
# Now do the real pass.
# Process the virt_lans table.
#
while (($vname,$member,$delay,$bandwidth,$lossrate,
$rdelay,$rbandwidth,$rlossrate,$widearea) = $result->fetchrow_array) {
($node,$port) = split(":",$member);
while (my ($vname,$member,$delay,$bandwidth,$lossrate,
$rdelay,$rbandwidth,$rlossrate,$widearea,
$isemulated,$uselinkdelay) = $result->fetchrow_array) {
my ($node,$port) = split(":",$member);
#
# REMOTENODE HACK:
......@@ -417,6 +425,8 @@ while (($vname,$member,$delay,$bandwidth,$lossrate,
if ($q_red) {
$mustdelay{$vname} = 1;
}
$emulated{$vname} = $isemulated;
$uselinkdelay{$vname} = $uselinkdelay;
#
# XXX - Whenever a delay node is inserted, port speeds are set to
......@@ -531,9 +541,10 @@ foreach $lan (keys(%lans)) {
$nonsharks = 0;
$simnodes = 0;
$realnodes = 0;
$emulated = 0;
my $emulated = $emulated{$lan};
my $uselinkdelay = $uselinkdelay{$lan};
my $mustdelay = $mustdelay{$lan};
$trivial_ok = 0;
$emulated{$lan} = 0;
foreach $member (@members) {
($node) = (split(":",$member))[0];
if ($nodes{$node} eq "shark-shelf") {
......@@ -542,6 +553,7 @@ foreach $lan (keys(%lans)) {
$simnodes++;
$simnodelans{$lan} = 1;
} else {
# We always use an emulated link when its a virtnode.
if ($isvirtnode{$node}) {
$emulated++;
$emulated{$lan} = 1;
......@@ -578,28 +590,32 @@ foreach $lan (keys(%lans)) {
$bandwidth = &getbandwidth(&min($bw0,$rbw1));
$rbandwidth = &getbandwidth(&min($rbw0,$bw1));
if (((($delay >= $delaythresh) ||
(($bw != $S100Kbs) && ($bw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($bw != $S100Kbs) && (($sharks == 0) || ($nonsharks > 1)))) ||
($loss != 0)) ||
(defined($mustdelay{$lan})) ||
($forcelinkdelays != 0) ||
(($rdelay >= $delaythresh) ||
(($rbw != $S100Kbs) && ($rbw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($rbw != $S100Kbs) && (($sharks == 0) || ($nonsharks > 1)))) ||
($rloss != 0))) &&
(($bw != $S100Kbs) && ($bw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($bw != $S100Kbs) && (($sharks == 0) || ($nonsharks > 1)))) ||
($loss != 0)) ||
(($rdelay >= $delaythresh) ||
(($rbw != $S100Kbs) && ($rbw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($rbw != $S100Kbs) && (($sharks == 0) || ($nonsharks > 1))))||
($rloss != 0)) ||
# Link must be shaped for other reasons (q_red).
$mustdelay ||
# Global force, or per-link force.
$forcelinkdelays || $uselinkdelay) &&
# XXX simulated nodes hack. We don't want to put delay nodes
# between simulated nodes. If there is a link between a
# simulated and a real node, we might need to put in delay
# nodes
($realnodes != 0)
) {
if ($emulated || $uselinkdelays || $forcelinkdelays) {
#
# Emulated links are special. We want to do traffic shaping
# but not using a delay node.
#
($realnodes != 0)) {
#
# We use a linkdelay if the link is emulated, globally forced,
# globally preferred if the link is shaped, or if the per-link
# flag was set (which means to put in a link delay regardless
# of whether the link is shaped).
#
if ($emulated ||
$forcelinkdelays || $uselinkdelays || $uselinkdelay) {
my $plink = "linksimple/$lan/$nodeport0,$nodeport1";
$delaylinks{$plink} = [$nodeport0,$delay,$bw,$loss,
......@@ -661,28 +677,34 @@ foreach $lan (keys(%lans)) {
# XXX The expression below should be modified for better bandwidth support.
# Probably needs to happen post assign somehow.
if (((($delay >= $delaythresh) ||
(($bw != $S100Kbs) && ($bw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($bw != $S100Kbs) && (($sharks == 0) ||
($nonsharks > 1)))) ||
($loss != 0)) ||
(defined($mustdelay{$lan})) ||
($forcelinkdelays != 0) ||
(($rdelay >= $delaythresh) ||
(($rbw != $S100Kbs) && ($rbw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($rbw != $S100Kbs) && (($sharks == 0) ||
($nonsharks > 1)))) ||
($rloss != 0))) &&
(($bw != $S100Kbs) && ($bw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($bw != $S100Kbs) && (($sharks == 0) ||
($nonsharks > 1)))) ||
($loss != 0)) ||
(($rdelay >= $delaythresh) ||
(($rbw != $S100Kbs) && ($rbw != $S10Kbs)) ||
(($delaywithswitch == 0) &&
(($rbw != $S100Kbs) && (($sharks == 0) ||
($nonsharks > 1)))) ||
($rloss != 0)) ||
# Link must be shaped for other reasons (q_red).
$mustdelay ||
# Global force, or per-lan force.
$forcelinkdelays || $uselinkdelay) &&
# if we have 1 real node in the LAN, we may need to create
# a lan
($realnodes != 0)
) {
if ($emulated || $uselinkdelays || $forcelinkdelays) {
#
# Emulated links are special. We want to do traffic shaping
# but not using a delay node.
#
($realnodes != 0)) {
#
# We use a linkdelay if the link is emulated, globally forced,
# globally preferred if the link is shaped, or if the per-link
# flag was set (which means to put in a link delay regardless
# of whether the link is shaped).
#
# NB: Emulated lans not supported at this time. Caught above.
#
if ($emulated ||
$forcelinkdelays || $uselinkdelays || $uselinkdelay) {
my $plink = "linklan/$lan/$member";
$delaylinks{$plink} =
......
......@@ -150,6 +150,15 @@ LanLink instproc init {s nodes bw d type} {
# By default, a local link
$self set widearea 0
# Allow user to control whether link gets a linkdelay, if link is shaped.
# If not shaped, and user sets this variable, a link delay is inserted
# anyway on the assumption that user wants later control over the link.
# Both lans and links can get linkdelays.
$self set uselinkdelay 0
# Allow user to control if link is emulated. Only links, not lans.
$self set emulated 0
# A simulated lanlink unless we find otherwise
$self set simulated 1
# Figure out if this is a lanlink that has at least
......@@ -479,11 +488,13 @@ LanLink instproc updatedb {DB} {
$self instvar rloss
$self instvar cost
$self instvar widearea
$self instvar uselinkdelay
$self instvar emulated
var_import ::GLOBALS::pid
var_import ::GLOBALS::eid
foreach nodeport $nodelist {
set nodeportraw [join $nodeport ":"]
sql exec $DB "insert into virt_lans (pid,eid,vname,member,delay,rdelay,bandwidth,rbandwidth,lossrate,rlossrate,cost,widearea) values (\"$pid\",\"$eid\",\"$self\",\"$nodeportraw\",$delay($nodeport),$rdelay($nodeport),$bandwidth($nodeport),$rbandwidth($nodeport),$loss($nodeport),$rloss($nodeport),$cost($nodeport),$widearea)"
sql exec $DB "insert into virt_lans (pid,eid,vname,member,delay,rdelay,bandwidth,rbandwidth,lossrate,rlossrate,cost,widearea,emulated,uselinkdelay) values (\"$pid\",\"$eid\",\"$self\",\"$nodeportraw\",$delay($nodeport),$rdelay($nodeport),$bandwidth($nodeport),$rbandwidth($nodeport),$loss($nodeport),$rloss($nodeport),$cost($nodeport),$widearea,$emulated,$uselinkdelay)"
}
}
......@@ -38,6 +38,9 @@ proc tb-set-usewatunnels {onoff} {}
proc tb-set-wasolver-weights {delay bw plr} {}
proc tb-set-uselinkdelays {onoff} {}
proc tb-set-forcelinkdelays {onoff} {}
proc tb-set-link-emulated {link onoff} {}
proc tb-set-link-uselinkdelay {link onoff} {}
proc tb-set-lan-uselinkdelay {link onoff} {}
Class Program
......
......@@ -577,3 +577,32 @@ proc tb-set-wasolver-weights {delay bw plr} {
set wa_bw_solverweight $bw
set wa_plr_solverweight $plr
}
#
# Control emulated for a link (lans not allowed yet).
#
proc tb-set-link-emulated {link onoff} {
if {[$link info class] != "Link"} {
perror "\[tb-set-link-emulated] $link is not a link."
return
}
$link set emulated $onoff
}
#
# Control linkdelays for lans and links
#
proc tb-set-link-uselinkdelay {link onoff} {
if {[$link info class] != "Link"} {
perror "\[tb-set-link-uselinkdelay] $link is not a link."
return
}
$link set uselinkdelay $onoff
}
proc tb-set-lan-uselinkdelay {link onoff} {
if {[$link info class] != "Lan"} {
perror "\[tb-set-lan-uselinkdelay] $link is not a lan."
return
}
$link set uselinkdelay $onoff
}
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