Commit 21044084 authored by Leigh Stoller's avatar Leigh Stoller

Add tb-set-delay-capacity NS directive:

	tb-set-delay-capacity 1

Will override the default delay capacity as specfied in the node_types
table for each node type, and set it for all types when generating the
ptop file.

This is a big stick, to be used with caution, as it will effectively
double the number of nodes used for delay nodes (withing an experiment).
parent ec6c7136
......@@ -156,7 +156,8 @@ my %experiment_fields = ("multiplex_factor" => 1,
"modelnet_edges" => 1,
"elab_in_elab" => 1,
"elabinelab_eid" => 1,
"security_level" => 1);
"security_level" => 1,
"delay_capacity" => 1);
# New parsing code state machine control.
my $PARSING_NOTYET = 0;
......
......@@ -282,6 +282,7 @@ CREATE TABLE experiment_resources (
wirelesslans smallint(5) unsigned default '0',
minlinks tinyint(3) unsigned default '0',
maxlinks tinyint(3) unsigned default '0',
delay_capacity tinyint(3) unsigned default NULL,
thumbnail mediumblob,
PRIMARY KEY (idx),
KEY exptidx (exptidx),
......@@ -399,6 +400,7 @@ CREATE TABLE experiments (
lockdown tinyint(1) NOT NULL default '0',
paniced tinyint(1) NOT NULL default '0',
panic_date datetime default NULL,
delay_capacity tinyint(3) unsigned default NULL,
PRIMARY KEY (eid,pid),
KEY idx (idx),
KEY batchmode (batchmode)
......
......@@ -503,6 +503,7 @@ REPLACE INTO table_regex VALUES ('experiments','wa_plr_solverweight','float','re
REPLACE INTO table_regex VALUES ('experiments','cpu_usage','int','redirect','default:tinyint',0,5,NULL);
REPLACE INTO table_regex VALUES ('experiments','mem_usage','int','redirect','default:tinyint',0,5,NULL);
REPLACE INTO table_regex VALUES ('experiments','sync_server','text','redirect','virt_nodes:vname',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','delay_capacity','int','redirect','default:tinyint',1,10,NULL);
REPLACE INTO table_regex VALUES ('groups','gid','text','regex','^[a-zA-Z][-\\w]+$',2,12,NULL);
REPLACE INTO table_regex VALUES ('nodes','node_id','text','regex','^[-\\w]+$',1,12,NULL);
REPLACE INTO table_regex VALUES ('nseconfigs','pid','text','redirect','projects:pid',0,0,NULL);
......
......@@ -2443,3 +2443,11 @@ last_net_act,last_cpu_act,last_ext_act);
alter table os_info change column OS OS enum('Unknown','Linux', \
'FreeBSD','NetBSD','OSKit','Windows','TinyOS','Other');
1.323: Add delay capacity override so that users can alter the packing
factor.
alter table experiments add delay_capacity tinyint(3) \
unsigned default NULL after panic_date;
alter table experiment_resources add delay_capacity tinyint(3) \
unsigned default NULL after maxlinks;
......@@ -61,7 +61,7 @@ my $warnings = 0;
# Configure variables
#
my $TBROOT = "@prefix@";
my $DELAYCAPACITY = @DELAYCAPACITY@;
my $DELAYCAPACITY = @DELAYCAPACITY@; # Can be overridden by user!
$ENV{'PATH'} = "/usr/bin:$TBROOT/libexec:$TBROOT/sbin:$TBROOT/bin";
#
......@@ -309,6 +309,7 @@ my $usewatunnels;
my $multiplex_factor;
my $experiment_idx;
my $useprepass;
my $delaycap_override;
# For admission control. Not well defined yet.
my $cpu_usage;
......@@ -606,6 +607,10 @@ sub RunAssign ()
if ($simcount);
$ptopargs .= "-a "
if ($precheck);
$ptopargs .= "-c $delaycap_override "
if (defined($delaycap_override));
print "ptopargs $ptopargs\n";
system("ptopgen $ptopargs > $ptopfile");
TBDebugTimeStamp("ptopgen finished");
......@@ -3748,12 +3753,12 @@ sub LoadExperiment()
" multiplex_factor,usewatunnels, ".
" cpu_usage,mem_usage,allowfixnode, ".
" jail_osname,delay_osname,idx, " .
" useprepass " .
" useprepass,delay_capacity " .
" from experiments ".
"where pid='$pid' and eid='$eid'");
my ($o1,$o2,$o3,$o4,$o5,$o6,$o7,$jail_osname,$delay_osname,$idx,$o8) =
$query_result->fetchrow_array();
my ($o1,$o2,$o3,$o4,$o5,$o6,$o7,$jail_osname,$delay_osname,
$idx,$o8,$delay_capacity) = $query_result->fetchrow_array();
# Do not override settings if already defined above.
$uselinkdelays = $o1
......@@ -3784,6 +3789,12 @@ sub LoadExperiment()
fatal("Invalid OS $delay_osname in project $pid!");
}
}
if (defined($delay_capacity)) {
$DELAYCAPACITY = $delay_capacity;
$delaycap_override = $delay_capacity;
# Stats
$expt_stats{"delay_capacity"} = $delay_capacity;
}
$experiment_idx = $idx;
#
......
......@@ -246,6 +246,9 @@ namespace eval GLOBALS {
variable jail_osname {}
variable delay_osname {}
# Allow override of delay capacity.
variable delay_capacity {}
# Use phys naming
variable use_physnaming 0
......
......@@ -342,6 +342,7 @@ Simulator instproc run {} {
var_import ::GLOBALS::veth_encapsulate
var_import ::GLOBALS::jail_osname
var_import ::GLOBALS::delay_osname
var_import ::GLOBALS::delay_capacity
var_import ::TBCOMPAT::objtypes
var_import ::TBCOMPAT::eventtypes
var_import ::GLOBALS::modelnet_cores
......@@ -530,6 +531,10 @@ Simulator instproc run {} {
lappend fields "delay_osname"
lappend values $delay_osname
}
if { $delay_capacity != {} } {
lappend fields "delay_capacity"
lappend values $delay_capacity
}
if {$modelnet_cores > 0 && $modelnet_edges > 0} {
lappend fields "usemodelnet"
......
......@@ -1054,6 +1054,20 @@ proc tb-set-delay-os {os} {
set delay_osname $os
}
#
# Set the delay capacity override. This is not documented cause we
# do not want people to do this!
#
proc tb-set-delay-capacity {cap} {
var_import ::GLOBALS::delay_capacity
if { $cap <= 0 || $cap > @DELAYCAPACITY@ } {
perror "\[tb-set-delay-capacity] Must be 0 < X <= @DELAYCAPACITY@"
return
}
set delay_capacity $cap
}
#
# Allow type of lans (but not links) to be changed.
#
......
......@@ -21,10 +21,11 @@ sub usage()
" -s Include stuff for topologies with simulated nodes\n".
" -a Include even reserved nodes\n".
" -m Override multiplex_factor\n".
" -c Delay capacity override\n".
" -n Add in modelnet core and edge node features\n");
exit(-1);
}
my $optlist = "s:e:m:vp:rSan:";
my $optlist = "s:e:m:vp:rSan:c:";
my $mfactor;
my $virtstuff = 0;
my $widearea = 0;
......@@ -32,6 +33,7 @@ my $simstuff = 0;
my $allnodes = 0;
my $mnetcores = 0;
my $mnetedges = 0;
my $delaycap_override;
#
# Turn off line buffering on output
......@@ -110,6 +112,9 @@ if (defined($options{"p"})) {
if (defined($options{"a"})) {
$allnodes = 1;
}
if (defined($options{"c"})) {
$delaycap_override = $options{"c"};
}
if (defined($options{"n"})) {
if ($options{"n"} =~ /(\d*),(\d*)/) {
$mnetcores = $1;
......@@ -380,6 +385,12 @@ foreach $node (keys(%nodes)) {
}
if ($delay_capacity > 0) {
# Comes from the NS file;
$delay_capacity = $delaycap_override
if (defined($delaycap_override) &&
$delaycap_override > 0 &&
$delaycap_override < $delay_capacity);
push @types, "delay:$delay_capacity";
push @types, "delay-${type}:$delay_capacity";
}
......
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