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

Arrange to order sets to the OPT array so that they are evaluated at

the node in the order they were specified in the NS file.  Lots of
hackery.
parent 1644454f
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -274,6 +274,10 @@ namespace eval GLOBALS {
# List of source files.
variable sourcefile_list {}
variable optarray_order
array set optarray_order {}
variable optarray_count 0
#
# Named argument helper function.
#
......@@ -389,12 +393,21 @@ source ${GLOBALS::libdir}/topography.tcl
rename set real_set
proc set {args} {
var_import GLOBALS::last_class
var_import GLOBALS::optarray_order
var_import GLOBALS::optarray_count
# There are a bunch of cases where we just pass through to real set.
if {[llength $args] == 1} {
return [uplevel real_set \{[lindex $args 0]\}]
} elseif {($last_class == {})} {
return [uplevel real_set \{[lindex $args 0]\} \{[lindex $args 1]\}]
real_set var [lindex $args 0]
real_set val [lindex $args 1]
if {[regexp {^opt\((.*)\)} $var d optname]} {
real_set optarray_order($optarray_count) $optname
incr optarray_count
}
return [uplevel real_set \{$var\} \{$val\}]
}
real_set var [lindex $args 0]
......
......@@ -395,6 +395,8 @@ Simulator instproc run {} {
var_import ::GLOBALS::security_level
var_import ::GLOBALS::explicit_firewall
var_import ::GLOBALS::sourcefile_list
var_import ::GLOBALS::optarray_order
var_import ::GLOBALS::optarray_count
if {$ran == 1} {
perror "The Simulator 'run' statement can only be run once."
......@@ -647,7 +649,10 @@ Simulator instproc run {} {
$self spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] [list "*" "slothd" $objtypes(SLOTHD) ]
if {[array exists ::opt]} {
foreach {oname ovalue} [array get ::opt] {
for {set i 0} {$i < $optarray_count} {incr i} {
set oname $optarray_order($i)
set ovalue $::opt($oname)
$self spitxml_data "virt_user_environment" [list "name" "value" ] [list "$oname" "$ovalue" ]
}
}
......
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