Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
a621f396
Commit
a621f396
authored
Apr 01, 2009
by
Leigh B. Stoller
Browse files
Fixes for link/lan lossrates that are too small to represented in
the existing DB format.
parent
8650bb1f
Changes
5
Hide whitespace changes
Inline
Side-by-side
db/emutil.pm.in
View file @
a621f396
...
...
@@ -147,11 +147,17 @@ sub TBcheck_dbslot($$$;$)
#
"$table/$column
\n
"
;
#
#
Functional
checks
not
implemented
yet
.
#
Functional
checks
partly
implemented
.
Needs
work
.
#
if
($
check_type
eq
"function"
)
{
die
(
"*** $0:
\n
"
.
" Functional DB checks not implemented: $table/$column!
\n
"
);
if
(
defined
(&$
check
))
{
my
$
func
=
\&$
check
;
return
&$
func
($
token
);
}
else
{
die
(
"*** $0:
\n
"
.
" Functional DB checks not implemented: $table/$column!
\n
"
);
}
}
#
Make
sure
the
regex
is
anchored
.
Its
a
mistake
not
to
be
!
...
...
@@ -197,6 +203,33 @@ sub TBcheck_dbslot($$$;$)
return
0
;
}
#
#
A
helper
function
for
checking
lossrates
.
Bad
place
for
this
,
I
know
.
#
sub
_checklossrate
($)
{
my
($
token
)
=
@
_
;
#
floating
point
,
no
exponent
.
Stole
this
out
of
the
perl
tutorial
.
if
(
! ($token =~ /^[+-]?(\d+\.\d+|\d+\.|\.\d+)([eE][+-]?\d+)?$/)) {
$
DBFieldErrstr
=
"Improper floating number"
;
return
0
;
}
if
($
token
>
1.0
)
{
$
DBFieldErrstr
=
"Too big; must be < 1.0"
;
return
0
;
}
if
($
token
<
0.0
)
{
$
DBFieldErrstr
=
"Too small; must be > 0.0"
;
return
0
;
}
if
($
token
>
0.0
&&
$
token
<
0.000001
)
{
$
DBFieldErrstr
=
"Too small; must be >= 0.000001"
;
return
0
;
}
return
1
;
}
#
#
Return
a
unique
index
from
emulab_indicies
for
the
indicated
name
.
#
Updates
the
index
to
be
,
well
,
unique
.
...
...
sql/database-create.sql
View file @
a621f396
...
...
@@ -306,7 +306,7 @@ CREATE TABLE `delays` (
`delay0`
float
(
10
,
2
)
NOT
NULL
default
'0.00'
,
`bandwidth0`
int
(
10
)
unsigned
NOT
NULL
default
'100'
,
`backfill0`
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
`lossrate0`
float
(
10
,
3
)
NOT
NULL
default
'0.000'
,
`lossrate0`
float
(
10
,
8
)
NOT
NULL
default
'0.000
00000
'
,
`q0_limit`
int
(
11
)
default
'0'
,
`q0_maxthresh`
int
(
11
)
default
'0'
,
`q0_minthresh`
int
(
11
)
default
'0'
,
...
...
@@ -324,7 +324,7 @@ CREATE TABLE `delays` (
`delay1`
float
(
10
,
2
)
NOT
NULL
default
'0.00'
,
`bandwidth1`
int
(
10
)
unsigned
NOT
NULL
default
'100'
,
`backfill1`
int
(
10
)
unsigned
NOT
NULL
default
'0'
,
`lossrate1`
float
(
10
,
3
)
NOT
NULL
default
'0.000'
,
`lossrate1`
float
(
10
,
8
)
NOT
NULL
default
'0.000
00000
'
,
`q1_limit`
int
(
11
)
default
'0'
,
`q1_maxthresh`
int
(
11
)
default
'0'
,
`q1_minthresh`
int
(
11
)
default
'0'
,
...
...
@@ -1694,11 +1694,11 @@ CREATE TABLE `linkdelays` (
`pipe`
smallint
(
5
)
unsigned
NOT
NULL
default
'0'
,
`delay`
float
(
10
,
2
)
NOT
NULL
default
'0.00'
,
`bandwidth`
int
(
10
)
unsigned
NOT
NULL
default
'100'
,
`lossrate`
float
(
10
,
3
)
NOT
NULL
default
'0.000'
,
`lossrate`
float
(
10
,
8
)
NOT
NULL
default
'0.000
00000
'
,
`rpipe`
smallint
(
5
)
unsigned
NOT
NULL
default
'0'
,
`rdelay`
float
(
10
,
2
)
NOT
NULL
default
'0.00'
,
`rbandwidth`
int
(
10
)
unsigned
NOT
NULL
default
'100'
,
`rlossrate`
float
(
10
,
3
)
NOT
NULL
default
'0.000'
,
`rlossrate`
float
(
10
,
8
)
NOT
NULL
default
'0.000
00000
'
,
`q_limit`
int
(
11
)
default
'0'
,
`q_maxthresh`
int
(
11
)
default
'0'
,
`q_minthresh`
int
(
11
)
default
'0'
,
...
...
@@ -3670,7 +3670,7 @@ CREATE TABLE `virt_lans` (
`bandwidth`
int
(
10
)
unsigned
default
NULL
,
`est_bandwidth`
int
(
10
)
unsigned
default
NULL
,
`backfill`
int
(
10
)
unsigned
default
'0'
,
`lossrate`
float
(
10
,
5
)
default
NULL
,
`lossrate`
float
(
10
,
8
)
default
NULL
,
`q_limit`
int
(
11
)
default
'0'
,
`q_maxthresh`
int
(
11
)
default
'0'
,
`q_minthresh`
int
(
11
)
default
'0'
,
...
...
@@ -3690,7 +3690,7 @@ CREATE TABLE `virt_lans` (
`rbandwidth`
int
(
10
)
unsigned
default
NULL
,
`rest_bandwidth`
int
(
10
)
unsigned
default
NULL
,
`rbackfill`
int
(
10
)
unsigned
default
'0'
,
`rlossrate`
float
(
10
,
5
)
default
NULL
,
`rlossrate`
float
(
10
,
8
)
default
NULL
,
`cost`
float
NOT
NULL
default
'1'
,
`widearea`
tinyint
(
4
)
default
'0'
,
`emulated`
tinyint
(
4
)
default
'0'
,
...
...
sql/database-fill.sql
View file @
a621f396
...
...
@@ -633,7 +633,7 @@ REPLACE INTO table_regex VALUES ('virt_lans','eid','text','redirect','experiment
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'vname'
,
'text'
,
'redirect'
,
'virt_nodes:vname'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'delay'
,
'float'
,
'redirect'
,
'default:float'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'bandwidth'
,
'int'
,
'redirect'
,
'default:int'
,
0
,
2147483647
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'lossrate'
,
'float'
,
'
redirect'
,
'default:flo
at'
,
0
,
1
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'lossrate'
,
'float'
,
'
function'
,
'_checklossr
at
e
'
,
0
,
1
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'q_limit'
,
'int'
,
'redirect'
,
'default:int'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'q_maxthresh'
,
'int'
,
'redirect'
,
'default:int'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'q_minthresh'
,
'int'
,
'redirect'
,
'default:int'
,
0
,
0
,
NULL
);
...
...
@@ -651,7 +651,7 @@ REPLACE INTO table_regex VALUES ('virt_lans','member','text','regex','^[-\\w]+:[
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'mask'
,
'text'
,
'regex'
,
'^
\\
d{1,3}
\\
.
\\
d{1,3}
\\
.
\\
d{1,3}
\\
.
\\
d{1,3}$'
,
0
,
15
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'rdelay'
,
'float'
,
'redirect'
,
'virt_lans:delay'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'rbandwidth'
,
'int'
,
'redirect'
,
'virt_lans:bandwidth'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'rlossrate'
,
'float'
,
'
redirect'
,
'virt_lans:
lossrate'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'rlossrate'
,
'float'
,
'
function'
,
'_check
lossrate'
,
0
,
1
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'cost'
,
'float'
,
'redirect'
,
'default:float'
,
0
,
1
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'widearea'
,
'int'
,
'redirect'
,
'default:boolean'
,
0
,
0
,
NULL
);
REPLACE
INTO
table_regex
VALUES
(
'virt_lans'
,
'emulated'
,
'int'
,
'redirect'
,
'default:boolean'
,
0
,
0
,
NULL
);
...
...
sql/updates/4/174
0 → 100644
View file @
a621f396
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
my $type = DBSlotType("delays", "lossrate0");
if (!$type) {
Fatal("No 'lossrate0' slot in 'delays' table");
}
if (! ($type =~ /10,8/)) {
DBQueryFatal("alter table delays change `lossrate0` `lossrate0` ".
" float(10,8) NOT NULL default '0.00000000'");
DBQueryFatal("alter table delays change `lossrate1` `lossrate1` ".
" float(10,8) NOT NULL default '0.00000000'");
}
$type = DBSlotType("linkdelays", "lossrate");
if (!$type) {
Fatal("No 'lossrate' slot in 'linkdelays' table");
}
if (! ($type =~ /10,8/)) {
DBQueryFatal("alter table linkdelays change `lossrate` `lossrate` ".
" float(10,8) NOT NULL default '0.00000000'");
DBQueryFatal("alter table linkdelays change `rlossrate` `rlossrate` ".
" float(10,8) NOT NULL default '0.00000000'");
}
$type = DBSlotType("virt_lans", "lossrate");
if (!$type) {
Fatal("No 'lossrate' slot in 'virt_lans' table");
}
if (! ($type =~ /10,8/)) {
DBQueryFatal("alter table virt_lans change `lossrate` `lossrate` ".
" float(10,8) default NULL");
DBQueryFatal("alter table virt_lans change `rlossrate` `rlossrate` ".
" float(10,8) default NULL");
}
DBQueryFatal("replace into table_regex values ".
" ('virt_lans','lossrate','float','function', ".
" '_checklossrate',0,1,NULL)");
DBQueryFatal("replace into table_regex values ".
" ('virt_lans','rlossrate','float','function', ".
" '_checklossrate',0,1,NULL)");
return 0;
}
1;
tbsetup/ns2ir/tb_compat.tcl.in
View file @
a621f396
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright
(
c
)
2000-2006, 2008 University of Utah and the Flux Group.
# Copyright
(
c
)
2000-2006, 2008
, 2009
University of Utah and the Flux Group.
# All rights reserved.
#
...
...
@@ -532,7 +532,7 @@ proc tb-set-link-loss {srclink args} {
set lossrate
[
lindex $args 0
]
}
if
{([
regexp $FLOAT $lossrate
]
== 0
)
||
(
$lossrate
> 1.0
)}
{
(
$lossrate
> 1.0
)
||
(
$lossrate
< 0.000005
)
}
{
perror
"
\[
tb-set-link-loss]
$lossrate
is not a valid loss rate."
}
$reallink instvar loss
...
...
@@ -577,7 +577,7 @@ proc tb-set-lan-loss {lan lossrate} {
return
}
if
{([
regexp $FLOAT $lossrate
]
== 0
)
||
(
$lossrate
> 1.0
)}
{
(
$lossrate
> 1.0
)
||
(
$lossrate
< 0.000005
)
}
{
perror
"
\[
tb-set-lan-loss]
$lossrate
is not a valid loss rate."
}
$lan instvar loss
...
...
@@ -675,7 +675,7 @@ proc tb-set-node-lan-loss {node lan loss} {
return
}
if
{([
regexp $FLOAT $loss
]
== 0
)
||
(
$loss
> 1.0
)}
{
(
$loss
> 1.0
)
||
(
$loss
< 0.000005
)
}
{
perror
"
\[
tb-set-link-loss]
$loss
is not a valid loss rate."
}
$lan set loss
([
list $node $port
])
$loss
...
...
@@ -771,7 +771,7 @@ proc tb-set-link-simplex-params {link src delay bw loss} {
perror
"
\[
tb-set-link-simplex-params]
$src
is not in
$link.
"
return
}
if
{([
regexp $FLOAT $loss
]
== 0
)
||
(
$loss
> 1.0
)}
{
if
{([
regexp $FLOAT $loss
]
== 0
)
||
(
$loss
> 1.0
)
||
(
$loss
< 0.000005
)
}
{
perror
"
\[
tb-set-link-simplex-params]
$loss
is not a valid loss rate."
return
}
...
...
@@ -808,10 +808,12 @@ proc tb-set-lan-simplex-params {lan node todelay tobw toloss fromdelay frombw fr
perror
"
\[
tb-set-lan-simplex-params]
$node
is not in
$lan.
"
return
}
if
{([
regexp $FLOAT $toloss
]
== 0
)
||
(
$toloss
> 1.0
)}
{
if
{([
regexp $FLOAT $toloss
]
== 0
)
||
(
$toloss
> 1.0
)
||
(
$toloss
< 0.000005
)}
{
perror
"
\[
tb-set-link-loss]
$toloss
is not a valid loss rate."
}
if
{([
regexp $FLOAT $fromloss
]
== 0
)
||
(
$fromloss
> 1.0
)}
{
if
{([
regexp $FLOAT $fromloss
]
== 0
)
||
(
$fromloss
> 1.0
)
||
(
$fromloss
< 0.000005
)}
{
perror
"
\[
tb-set-link-loss]
$fromloss
is not a valid loss rate."
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment