Commit 970cc63b authored by Christopher Alfeld's avatar Christopher Alfeld
Browse files

Added tb-set-node-failure-action support.

parent 63229185
...@@ -929,12 +929,13 @@ foreach $pnode (keys(%p2vmap)) { ...@@ -929,12 +929,13 @@ foreach $pnode (keys(%p2vmap)) {
foreach $pair (@nodepairs) { foreach $pair (@nodepairs) {
($pnode,$vnode) = @$pair; ($pnode,$vnode) = @$pair;
$sth = $dbh->prepare("SELECT osid,cmd_line,rpms,deltas,startupcmd," . $sth = $dbh->prepare("SELECT osid,cmd_line,rpms,deltas,startupcmd," .
"tarfiles from virt_nodes where pid=\"$pid\"" . "tarfiles,failureaction from virt_nodes" .
" and eid=\"$eid\" and vname=\"$vnode\""); " where pid=\"$pid\"" .
" and eid=\"$eid\" and vname=\"$vnode\"");
$sth->execute; $sth->execute;
# The if statement will cause us to skip nodes that belong to # The if statement will cause us to skip nodes that belong to
# the experiment but aren't virtual. I.e. delay nodes. # the experiment but aren't virtual. I.e. delay nodes.
if (($osid,$cmdline,$rpms,$deltas,$startupcmd,$tarfiles) = if (($osid,$cmdline,$rpms,$deltas,$startupcmd,$tarfiles,$failureaction) =
$sth->fetchrow_array) { $sth->fetchrow_array) {
if (! $dbh->do("UPDATE nodes set def_boot_osid=\"$osid\"," . if (! $dbh->do("UPDATE nodes set def_boot_osid=\"$osid\"," .
" def_boot_cmd_line=\"$cmdline\"," . " def_boot_cmd_line=\"$cmdline\"," .
...@@ -944,7 +945,8 @@ foreach $pair (@nodepairs) { ...@@ -944,7 +945,8 @@ foreach $pair (@nodepairs) {
" rpms=\"$rpms\"," . " rpms=\"$rpms\"," .
" deltas=\"$deltas\"," . " deltas=\"$deltas\"," .
" tarballs=\"$tarfiles\"," . " tarballs=\"$tarfiles\"," .
" startupcmd=\"$startupcmd\"" . " startupcmd=\"$startupcmd\"," .
" failureaction=\"$failureaction\"" .
" where node_id=\"$pnode\"")) { " where node_id=\"$pnode\"")) {
print STDERR "$0: *** Could not update nodes table." . print STDERR "$0: *** Could not update nodes table." .
" Giving up.\n"; " Giving up.\n";
......
...@@ -40,6 +40,7 @@ Node instproc init {s} { ...@@ -40,6 +40,7 @@ Node instproc init {s} {
$self set startup "" $self set startup ""
$self set deltas "" $self set deltas ""
$self set tarfiles "" $self set tarfiles ""
$self set failureaction "fatal"
} }
# The following procs support renaming (see README) # The following procs support renaming (see README)
...@@ -76,6 +77,7 @@ Node instproc updatedb {DB} { ...@@ -76,6 +77,7 @@ Node instproc updatedb {DB} {
$self instvar deltas $self instvar deltas
$self instvar iplist $self instvar iplist
$self instvar tarfiles $self instvar tarfiles
$self instvar failureaction
var_import ::GLOBALS::pid var_import ::GLOBALS::pid
var_import ::GLOBALS::eid var_import ::GLOBALS::eid
...@@ -96,7 +98,7 @@ Node instproc updatedb {DB} { ...@@ -96,7 +98,7 @@ Node instproc updatedb {DB} {
} }
# Update the DB # Update the DB
sql exec $DB "insert into virt_nodes (pid,eid,vname,type,ips,osid,cmd_line,rpms,deltas,startupcmd,tarfiles) values (\"$pid\",\"$eid\",\"$self\",\"$type\",\"$ipraw\",\"$osid\",\"$cmdline\",\"$rpms\",\"$deltas\",\"$startup\",\"$tarfiles\")"; 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\")";
} }
# add_lanlink lanlink # add_lanlink lanlink
......
...@@ -252,3 +252,15 @@ proc tb-set-node-lan-params {node lan delay bw loss} { ...@@ -252,3 +252,15 @@ proc tb-set-node-lan-params {node lan delay bw loss} {
tb-set-node-lan-bandwidth $node $lan $bw tb-set-node-lan-bandwidth $node $lan $bw
tb-set-node-lan-loss $node $lan $loss tb-set-node-lan-loss $node $lan $loss
} }
proc tb-set-node-failure-action {node type} {
if {[$node info class] != "Node"} {
perror "\[tb-set-node-failure-action] $node is not a node."
return
}
if {[lsearch -exact {fatal nonfatal ignore} $type] == -1} {
perror "\[tb-set-node-failure-action] type must be one of fatal|nonfatal|ignore."
return
}
$node set failureaction $type
}
\ No newline at end of file
Supports Markdown
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