Commit eee9c3e4 authored by Christopher Alfeld's avatar Christopher Alfeld

Modified to use DB instead of IR file.

parent 1b5fa804
......@@ -36,46 +36,39 @@ set nfree "$updir/db/nfree"
set libir "$scriptdir/ir/libir.tcl"
set resetvlans "$scriptdir/resetvlans.tcl"
source $libir
namespace import TB_LIBIR::ir
load $updir/lib/sql.so
if {$argc != 3} {
puts stderr "Syntax: $argv0 <pid> <eid> <ir-file>"
if {$argc != 3 && $argc != 2} {
puts stderr "Syntax: $argv0 <pid> <eid>"
exit 1
}
if {$argc == 3} {
puts stderr "Warning: Ignoring IR file argument.
}
set DB [sql connect]
sql selectdb $DB tbdb
set irFile [lindex $argv 2]
set pid [lindex $argv 0]
set eid [lindex $argv 1]
set id "$pid-$eid"
set t [split $irFile .]
set prefix [join [lrange $t 0 [expr [llength $t] - 2]] .]
set irFile "$prefix.ir"
set logFile "$prefix.log"
set logFile "${id}_end.log"
if {[catch "open $logFile a+" logFp]} {
puts stderr "Could not open $logFile for writing."
exit 1
}
outs "Input: $irFile"
outs "Log: $logFile"
if {! [file exists $irFile]} {
outs stderr "$irFile does not exist"
exit 1
}
outs ""
outs "Ending Testbed run for $irFile. [clock format [clock seconds]]"
outs "Ending Testbed run for $id. [clock format [clock seconds]]"
outs "Unallocating resources"
ir read $irFile
set nodemap [ir get /virtual/nodes]
set machines {}
foreach pair $nodemap {
lappend machines [lindex $pair 1]
sql query $DB "select node_id from reserved where eid=\"$eid\" and pid=\"$pid\""
while {[set machine [sql fetchrow $DB]] != {}} {
lappend machines $machine
}
if {[catch "exec $nfree $pid $eid >@ $logFp 2>@ $logFp" err]} {
......
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