Commit 8ebec63d authored by Leigh B. Stoller's avatar Leigh B. Stoller

Add "routing" support with new TB command:

	tb-set-node-routertype $node none|gated

Added slots to virt_nodes and nodes table. This stuff is carried
through so that tmcd can get at it and pass it back to client.
parent bb229070
......@@ -243,6 +243,7 @@ foreach my $n (@freed_nodes) {
DBQueryWarn("update nodes set def_boot_osid='$osid',def_boot_cmd_line='',".
"def_boot_path='',startupcmd='',rpms='',deltas='', ".
"tarballs='',pxe_boot_path='$pxe_boot_path', ".
"failureaction='fatal', routertype='none', ".
"next_pxe_boot_path='' where node_id='$n'") || $error++;
#
......
......@@ -877,7 +877,7 @@ foreach $pnode (keys(%p2vmap)) {
foreach $pair (@nodepairs) {
($pnode,$vnode) = @$pair;
my $result = DBQueryFatal("SELECT osid,cmd_line,rpms,deltas,startupcmd," .
"tarfiles,failureaction from virt_nodes" .
"tarfiles,failureaction,routertype from virt_nodes" .
" where pid=\"$pid\"" .
" and eid=\"$eid\" and vname=\"$vnode\"");
# The if statement will cause us to skip nodes that belong to
......@@ -887,8 +887,8 @@ foreach $pair (@nodepairs) {
" where node_id=\"$pnode\"");
my ($type) = $result2->fetchrow_array;
$result2->finish;
if (($osid,$cmdline,$rpms,$deltas,$startupcmd,$tarfiles,$failureaction) =
$result->fetchrow_array) {
if (($osid,$cmdline,$rpms,$deltas,$startupcmd,$tarfiles,
$failureaction,$routertype) = $result->fetchrow_array) {
if (!defined($osid) || $osid eq "") {
$osid = $defosids{$type};
}
......@@ -901,7 +901,8 @@ foreach $pair (@nodepairs) {
" deltas='$deltas'," .
" tarballs='$tarfiles'," .
" startupcmd='$startupcmd'," .
" failureaction='$failureaction'" .
" failureaction='$failureaction'," .
" routertype='$routertype'" .
" where node_id='$pnode'");
} elsif (! defined($lannodes{$p2vmap{$pnode}})) {
# Delay node
......
......@@ -40,6 +40,7 @@ Node instproc init {s} {
$self set deltas ""
$self set tarfiles ""
$self set failureaction "fatal"
$self set routertype "none"
}
# The following procs support renaming (see README)
......@@ -77,6 +78,7 @@ Node instproc updatedb {DB} {
$self instvar iplist
$self instvar tarfiles
$self instvar failureaction
$self instvar routertype
var_import ::GLOBALS::pid
var_import ::GLOBALS::eid
......@@ -97,7 +99,7 @@ Node instproc updatedb {DB} {
}
# Update the DB
sql exec $DB "insert into virt_nodes (pid,eid,vname,type,ips,osid,cmd_line,rpms,deltas,startupcmd,tarfiles,failureaction) values (\"$pid\",\"$eid\",\"$self\",\"$type\",\"$ipraw\",\"$osid\",\"$cmdline\",\"$rpms\",\"$deltas\",\"$startup\",\"$tarfiles\",\"$failureaction\")";
sql exec $DB "insert into virt_nodes (pid,eid,vname,type,ips,osid,cmd_line,rpms,deltas,startupcmd,tarfiles,failureaction,routertype) values (\"$pid\",\"$eid\",\"$self\",\"$type\",\"$ipraw\",\"$osid\",\"$cmdline\",\"$rpms\",\"$deltas\",\"$startup\",\"$tarfiles\",\"$failureaction\",\"$routertype\")";
}
# add_lanlink lanlink
......
......@@ -151,6 +151,18 @@ proc tb-set-node-deltas {node args} {
}
$node set deltas [join $args :]
}
proc tb-set-node-routertype {node type} {
if {$type == {}} {
perror "\[tb-set-node-routertype] No type given."
return
}
if {($type != "none") &&
($type != "gated")} {
perror "\[tb-set-node-routertype] Type is not one of none|gated"
return
}
$node set routertype $type
}
# Lan/Link state routines.
......
......@@ -905,6 +905,7 @@ function SHOWNODE($node_id) {
$rpms = $row[rpms];
$tarballs = $row[tarballs];
$startupcmd = $row[startupcmd];
$routertype = $row[routertype];
if (!$def_boot_cmd_line)
$def_boot_cmd_line = "&nbsp";
......@@ -995,6 +996,11 @@ function SHOWNODE($node_id) {
<td class=left>$tarballs</td>
</tr>\n";
echo "<tr>
<td>Router Type:</td>
<td class=left>$routertype</td>
</tr>\n";
#
# We want the last login for this node, but only if its *after* the
# experiment was created (or swapped in).
......
......@@ -19,3 +19,4 @@ proc tb-set-node-lan-bandwidth {node lan bw} {}
proc tb-set-node-lan-loss {node lan loss} {}
proc tb-set-node-lan-params {node lan delay bw loss} {}
proc tb-set-node-failure-action {node type} {}
proc tb-set-node-routertype {node type} {}
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