Commit 9baacfb6 authored by Leigh Stoller's avatar Leigh Stoller

Add veth_encapsulate for Mike. Per experiment flag, returned for

each veth from tmcd cause that is easy. Defaults to 1 for now.
Add tb-set-encapsulate to front end so Mike can play with it.
parent 192c77a2
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -77,6 +77,7 @@ my %experiment_fields = ("multiplex_factor" => 1,
"wa_plr_solverweight" => 1,
"cpu_usage" => 1,
"mem_usage" => 1,
"veth_encapsulate" => 1,
"sync_server" => 1);
#
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -229,6 +229,9 @@ namespace eval GLOBALS {
# it an integer, 1 <= x <= 5.
variable cpu_usage 3
variable mem_usage 0
# Control veth encapsulation
variable veth_encapsulate 1
}
# Load all our classes
......
......@@ -247,6 +247,7 @@ Simulator instproc run {} {
var_import ::GLOBALS::sync_server
var_import ::GLOBALS::cpu_usage
var_import ::GLOBALS::mem_usage
var_import ::GLOBALS::veth_encapsulate
var_import ::TBCOMPAT::objtypes
var_import ::TBCOMPAT::eventtypes
......@@ -333,8 +334,8 @@ Simulator instproc run {} {
$prog updatedb "sql"
}
set fields [list "mem_usage" "cpu_usage" "forcelinkdelays" "uselinkdelays" "usewatunnels" "uselatestwadata" "wa_delay_solverweight" "wa_bw_solverweight" "wa_plr_solverweight" ]
set values [list $mem_usage $cpu_usage $forcelinkdelays $uselinkdelays $usewatunnels $uselatestwadata $wa_delay_solverweight $wa_bw_solverweight $wa_plr_solverweight ]
set fields [list "mem_usage" "cpu_usage" "forcelinkdelays" "uselinkdelays" "usewatunnels" "uselatestwadata" "wa_delay_solverweight" "wa_bw_solverweight" "wa_plr_solverweight" "veth_encapsulate"]
set values [list $mem_usage $cpu_usage $forcelinkdelays $uselinkdelays $usewatunnels $uselatestwadata $wa_delay_solverweight $wa_bw_solverweight $wa_plr_solverweight $veth_encapsulate]
if { $multiplex_factor != {} } {
lappend fields "multiplex_factor"
......
......@@ -698,3 +698,17 @@ proc tb-set-cpu-usage {usage} {
proc tb-bind-parent {sub phys} {
tb-fix-node $sub $phys
}
#
# Control veth encapsulation.
#
proc tb-set-encapsulate {onoff} {
var_import ::GLOBALS::veth_encapsulate
if {$onoff < 0 || $onoff > 1} {
perror "\[tb-set-encapsulate] must be 0 or 1."
return
}
set veth_encapsulate $onoff
}
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -25,4 +25,4 @@
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 14
#define CURRENT_VERSION 15
......@@ -157,6 +157,7 @@ typedef struct {
char eventkey[TBDB_FLEN_PRIVKEY];
char sfshostid[TBDB_FLEN_SFSHOSTID];
char testdb[256];
int veth_encapsulate;
} tmcdreq_t;
static int iptonodeid(struct in_addr, tmcdreq_t *);
static int checkdbredirect(tmcdreq_t *);
......@@ -1210,6 +1211,10 @@ COMMAND_PROTOTYPE(doifconfig)
bufp += OUTPUT( bufp, ebufp - bufp,
" RTABID=%s", row[5] );
}
if (vers >= 15) {
bufp += OUTPUT(bufp, ebufp - bufp,
" ENCAPSULATE=%d", reqp->veth_encapsulate);
}
OUTPUT(bufp, ebufp - bufp, "\n");
client_writeback(sock, buf, strlen(buf), tcp);
......@@ -3647,7 +3652,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
" np.role,e.expt_head_uid,e.expt_swap_uid, "
" e.sync_server,pt.class,pt.type, "
" pt.isremotenode,vt.issubnode,e.keyhash, "
" nv.sfshostid,e.eventkey,vt.isplabdslice "
" nv.sfshostid,e.eventkey,vt.isplabdslice, "
" e.veth_encapsulate "
"from nodes as nv "
"left join interfaces as i on "
" i.node_id=nv.phys_nodeid "
......@@ -3663,7 +3669,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
"left join node_types as vt on "
" vt.type=nv.type "
"where nv.node_id='%s' and i.IP='%s'",
22, reqp->vnodeid, inet_ntoa(ipaddr));
23, reqp->vnodeid, inet_ntoa(ipaddr));
}
else {
res = mydb_query("select t.class,t.type,n.node_id,n.jailflag,"
......@@ -3672,7 +3678,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
" e.expt_head_uid,e.expt_swap_uid, "
" e.sync_server,t.class,t.type, "
" t.isremotenode,t.issubnode,e.keyhash, "
" n.sfshostid,e.eventkey,0 "
" n.sfshostid,e.eventkey,0, "
" e.veth_encapsulate "
"from interfaces as i "
"left join nodes as n on n.node_id=i.node_id "
"left join reserved as r on "
......@@ -3682,7 +3689,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
"left join node_types as t on "
" t.type=n.type and i.iface=t.control_iface "
"where i.IP='%s'",
22, inet_ntoa(ipaddr));
23, inet_ntoa(ipaddr));
}
if (!res) {
......@@ -3751,6 +3758,8 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
if (row[20])
strcpy(reqp->eventkey, row[20]);
}
reqp->veth_encapsulate = (! strcasecmp(row[22], "0") ? 0 : 1);
if (row[9])
reqp->update_accounts = atoi(row[9]);
else
......
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