Commit 84ba618b authored by Robert Ricci's avatar Robert Ricci
Browse files

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

parents 3cdfc5f9 ba73e37b
...@@ -1928,6 +1928,13 @@ sub GenVirtLans($) ...@@ -1928,6 +1928,13 @@ sub GenVirtLans($)
my ($traced,$trace_endnode) = @{$member0->_traceinfo()}; my ($traced,$trace_endnode) = @{$member0->_traceinfo()};
my ($rtraced,$rtrace_endnode) = @{$member1->_traceinfo()}; my ($rtraced,$rtrace_endnode) = @{$member1->_traceinfo()};
# Rob says not supported
if (($trivial_ok || $emulated) &&
($bandwidth == 0 || $rbandwidth == 0)) {
tberror("Cannot mix trivial_ok|emulated with * bw\n");
$errors++;
}
# #
# Geni links and lans are dead simple right now. # Geni links and lans are dead simple right now.
# #
...@@ -2073,7 +2080,9 @@ sub GenVirtLans($) ...@@ -2073,7 +2080,9 @@ sub GenVirtLans($)
my $plink = "linksimple/$vname/$member0,$member1"; my $plink = "linksimple/$vname/$member0,$member1";
$self->addlink("$plink $vname0 $vname1 ". $self->addlink("$plink $vname0 $vname1 ".
max($top_bw,$top_rbw) . " 0 0 $protocol" . ($top_bw == 0 ? "*" :
max($top_bw,$top_rbw)).
" 0 0 $protocol" .
($emulated ? " emulated" : "") . ($emulated ? " emulated" : "") .
($trivial_ok ? " trivial_ok" : "") . ($trivial_ok ? " trivial_ok" : "") .
" $fixall"); " $fixall");
...@@ -2098,11 +2107,13 @@ sub GenVirtLans($) ...@@ -2098,11 +2107,13 @@ sub GenVirtLans($)
$self->addnode("$delayname delay $delaydesire"); $self->addnode("$delayname delay $delaydesire");
$self->addlink("linksdelaysrc/$vname/$member0,$member1 ". $self->addlink("linksdelaysrc/$vname/$member0,$member1 ".
"$vname0 $delayname $top_bw 0 0 ". "$vname0 $delayname ".
"$protocol $fixsrc0"); ($top_bw == 0 ? "*" : $top_bw) .
" 0 0 $protocol $fixsrc0");
$self->addlink("linksdelaydst/$vname/$member1,$member0 ". $self->addlink("linksdelaydst/$vname/$member1,$member0 ".
"$vname1 $delayname $top_bw 0 0 ". "$vname1 $delayname ".
"$protocol $fixdst1"); ($top_bw == 0 ? "*" : $top_bw) .
" 0 0 $protocol $fixdst1");
$self->printdb("Delay node $plink ($delayname) = " . $self->printdb("Delay node $plink ($delayname) = " .
join(" ", @delayinfo) . "\n"); join(" ", @delayinfo) . "\n");
...@@ -2124,16 +2135,18 @@ sub GenVirtLans($) ...@@ -2124,16 +2135,18 @@ sub GenVirtLans($)
} }
else { else {
my $plink = "linksimple/$vname/$member0,$member1"; my $plink = "linksimple/$vname/$member0,$member1";
my $spec = "$plink $vname0 $vname1 ";
my $spec = "$plink $vname0 $vname1";
if ($emulated) { if ($emulated) {
$spec .= " " . max($top_bw,$top_rbw) . $spec .= max($top_bw,$top_rbw);
" 0 0 $protocol emulated";
} }
else { else {
$spec .= " $top_bw 0 0 $protocol"; # Let assign choose bw if top_bw is zero.
$spec .= ($top_bw == 0 ? "*" : $top_bw);
} }
$spec .= " 0 0 $protocol";
$spec .= " emulated" if ($emulated);
if ($trivial_ok) { if ($trivial_ok) {
$spec .= " trivial_ok"; $spec .= " trivial_ok";
# #
...@@ -2338,7 +2351,8 @@ sub GenVirtLans($) ...@@ -2338,7 +2351,8 @@ sub GenVirtLans($)
$rdelay,$rbw,$rbackfill,$rloss,0); $rdelay,$rbw,$rbackfill,$rloss,0);
$self->addlink("$plink $vnodevname lan/$vname " . $self->addlink("$plink $vnodevname lan/$vname " .
max($top_bw,$top_rbw) . ($top_bw == 0 ? "*" :
max($top_bw,$top_rbw)).
" 0 0 $protocol" . " 0 0 $protocol" .
($emulated ? " emulated" : "") . ($emulated ? " emulated" : "") .
($trivial_ok ? " trivial_ok" : "") . ($trivial_ok ? " trivial_ok" : "") .
...@@ -2360,11 +2374,13 @@ sub GenVirtLans($) ...@@ -2360,11 +2374,13 @@ sub GenVirtLans($)
$self->addnode("$delayname delay $delaydesire"); $self->addnode("$delayname delay $delaydesire");
$self->addlink("linkdelaysrc/$vname/$member " . $self->addlink("linkdelaysrc/$vname/$member " .
"$vnodevname $delayname $top_bw 0 0 ". "$vnodevname $delayname ".
"$protocol $fixsrc0"); ($top_bw == 0 ? "*" : $top_bw) .
" 0 0 $protocol $fixsrc0");
$self->addlink("linkdelaydst/$vname/$member " . $self->addlink("linkdelaydst/$vname/$member " .
"lan/$vname $delayname $top_bw 0 0 ". "lan/$vname $delayname ".
"$protocol"); ($top_bw == 0 ? "*" : $top_bw) .
" 0 0 $protocol");
$self->printdb("Delay node $plink ($delayname) = " . $self->printdb("Delay node $plink ($delayname) = " .
join(" ", @delayinfo) . "\n"); join(" ", @delayinfo) . "\n");
...@@ -2388,12 +2404,13 @@ sub GenVirtLans($) ...@@ -2388,12 +2404,13 @@ sub GenVirtLans($)
} }
else { else {
my $plink = "linklan/$vname/$member"; my $plink = "linklan/$vname/$member";
my $spec = "$plink $vnodevname lan/$vname ";
# Let assign choose bw if top_bw is zero.
$spec .= ($top_bw == 0 ? "*" : $top_bw);
$spec .= " 0 0 $protocol";
$spec .= " emulated" if ($emulated);
my $spec = "$plink $vnodevname lan/$vname $top_bw " .
"0 0 $protocol";
if ($emulated) {
$spec .= " emulated";
}
if ($trivial_ok) { if ($trivial_ok) {
$spec .= " trivial_ok"; $spec .= " trivial_ok";
...@@ -2692,6 +2709,12 @@ sub getbandwidth($$$$) ...@@ -2692,6 +2709,12 @@ sub getbandwidth($$$$)
my $node_type = $virtnode->type(); my $node_type = $virtnode->type();
my $protocol = protocolbasetype($virtlan->_protocol()); my $protocol = protocolbasetype($virtlan->_protocol());
my $linkbws = $self->{'TYPELINKBW'}; my $linkbws = $self->{'TYPELINKBW'};
#
# A target bandwidth of zero indicates that we want assign to choose.
#
return 0
if ($targetbw == 0);
foreach my $bw (keys(%{ $linkbws->{$node_type}{$protocol} })) { foreach my $bw (keys(%{ $linkbws->{$node_type}{$protocol} })) {
if (($bw >= $targetbw) && ($bw < $best)) { if (($bw >= $targetbw) && ($bw < $best)) {
...@@ -2738,6 +2761,13 @@ sub requires_delay($$$$) ...@@ -2738,6 +2761,13 @@ sub requires_delay($$$$)
my $linkbws = $self->{'TYPELINKBW'}; my $linkbws = $self->{'TYPELINKBW'};
my $node_class; my $node_class;
#
# A target bandwidth of zero indicates that we want assign to choose.
# Therefore, no delay is needed since assign picks the native bw.
#
return 0
if ($targetbw == 0);
if (!exists($linkbws->{$node_type}{$protocol})) { if (!exists($linkbws->{$node_type}{$protocol})) {
warn("requires_delay(): $virtnode - invalid type $node_type!\n"); warn("requires_delay(): $virtnode - invalid type $node_type!\n");
return 0; return 0;
...@@ -4200,7 +4230,7 @@ sub InterpLinks($) ...@@ -4200,7 +4230,7 @@ sub InterpLinks($)
my ($nodeB,$portB) = undef; my ($nodeB,$portB) = undef;
my $protolink; my $protolink;
my $virtnodeB = $self->vnodes()->{$vnodeB}; my $virtnodeB = $self->vnodes()->{$vnodeB};
# #
# If the link is delayed, its with endpoint delays, not a # If the link is delayed, its with endpoint delays, not a
# delay node. # delay node.
...@@ -4211,7 +4241,7 @@ sub InterpLinks($) ...@@ -4211,7 +4241,7 @@ sub InterpLinks($)
if (! $trivial) { if (! $trivial) {
$nodeB = $member1->_pnode(); $nodeB = $member1->_pnode();
$portB = $member1->_pport(); $portB = $member1->_pport();
$self->printdb("LINK simple: $virtA,$virtB - ". $self->printdb("LINK simple: $virtA,$virtB - ".
"$nodeA:$portA,$nodeB:$portB\n"); "$nodeA:$portA,$nodeB:$portB\n");
...@@ -4687,6 +4717,51 @@ sub InterpLinks($) ...@@ -4687,6 +4717,51 @@ sub InterpLinks($)
} }
} }
#
# Check the portbw to make sure they are all set; if the user is
# letting assign pick the interfaces (zero bandwidth), then portbw
# is still zero, and it needs to be set to the default speed for
# that interface.
#
foreach my $virtlan (values(%{ $self->vlans() })) {
foreach my $member ($virtlan->memberlist()) {
# Will this happen?
next
if (!exists($self->solution_portmap()->{$member}));
# XXX NSE checks I do not understand.
next
if (! (exists($self->portbw()->{$member}) &&
exists($self->solution_v2p()->{$member->vnode()})));
# Skip anything that was turned into a vinterface; the
# port speed will get set elsewhere.
next
if (exists($self->solution_vifacemap()->{$member}));
my $iface = $self->solution_portmap()->{$member};
my $pnodename = $self->solution_v2p()->{$member->vnode()};
my $speed = $self->portbw()->{$member};
# Already set.
next
if ($speed);
my $interface = Interface->LookupByIface($pnodename, $iface);
if (!defined($interface)) {
tberror("Could not lookup interface $pnodename:$iface\n");
return -1;
}
$speed =
$self->interfacespeedmbps($interface->type(), "ethernet");
# portbw() is in bps.
$self->portbw()->{$member} = $speed * 1000;
$self->printdb("Setting portbw: $pnodename:$iface $speed\n");
}
}
# Write the vlans to the DB. # Write the vlans to the DB.
$self->UploadVlans() == 0 $self->UploadVlans() == 0
or return -1; or return -1;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# EMULAB-COPYRIGHT # EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group. # Copyright (c) 2000-2006, 2010 University of Utah and the Flux Group.
# All rights reserved. # All rights reserved.
# #
...@@ -537,6 +537,13 @@ proc new {class args} { ...@@ -537,6 +537,13 @@ proc new {class args} {
# unit is given then bytes (b) is assumed. It returns the bandwidth # unit is given then bytes (b) is assumed. It returns the bandwidth
# in Kbps. # in Kbps.
proc parse_bw {bspec {islink 1}} { proc parse_bw {bspec {islink 1}} {
#
# Special case; "*" means let assign pick the bandwidth. Make it zero.
#
if {"$bspec" == "*"} {
return 0
}
# Default to bytes # Default to bytes
if {[scan $bspec "%f%s" bw unit] == 1} { if {[scan $bspec "%f%s" bw unit] == 1} {
set unit b set unit b
......
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