Commit bc27edc6 authored by Leigh Stoller's avatar Leigh Stoller

Add check to make sure that pcvm nodes are used as edge nodes only

(only 1 lan/link connection). An interim solution until we solve the
routing problem for "virtual" router nodes completely. Also added a
new global "enforce_user_restrictions" that you can set in your .ns
file to turn of this check, and some others.
parent 38f0bb77
......@@ -127,6 +127,7 @@ Node instproc updatedb {DB} {
var_import ::GLOBALS::pid
var_import ::GLOBALS::eid
var_import ::GLOBALS::default_ip_routing_type
var_import ::GLOBALS::enforce_user_restrictions
# If we haven't specified a osid so far then we should fill it
# with the id from the node_types table now.
......@@ -140,16 +141,25 @@ Node instproc updatedb {DB} {
}
} else {
# Do not allow user to set os for virt nodes at this time.
if {$isvirt} {
if {$enforce_user_restrictions && $isvirt} {
perror "You may not specify an OS for virtual nodes ($self)!"
return
}
# Do not allow user to set os for host running virt nodes.
if {$virthost} {
if {$enforce_user_restrictions && $virthost} {
perror "You may not specify an OS for hosting virtnodes ($self)!"
return
}
}
#
# For now, restrict local virtnodes to edge nodes, not routers.
#
if {$type == "pcvm" && $enforce_user_restrictions} {
if {[llength $portlist] > 1} {
perror "Virtual node $self must be an edge node (lans/links = 1)"
return
}
}
# We need to generate the IP column from our iplist.
set ipraw {}
......
......@@ -217,6 +217,8 @@ namespace eval GLOBALS {
# is being parsed should go into a NSE simulation or not
variable simulated 0
# Hidden variable to relax some restrictions for debugging.
variable enforce_user_restrictions 1
}
# Connect to the DB
......
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