Commit d053d84e authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Support for subnodes:

	set myixp [$ns node]
	set ixphost [$ns node]
	tb-set-hardware $myixp ixp-bveil
	tb-fix-node $myixp $ixphost
	tb-set-node-os $ixphost RHL-STD

This gives you a handle on the host node so you can treat it like a
normal testbed node, including setting the OSID.

There are associated assign_wrapper changes, but I won't check those
in till I get back from vacation; not enough people around this coming
week in case I screwed something up.
parent c37fde59
......@@ -55,6 +55,10 @@ Node instproc init {s} {
# If hosting a virtual node (or nodes).
$self set virthost 0
# Sorta ditto for subnode stuff.
$self set issubnode 0
$self set subnodehost 0
# If osid remains blank when updatedb is called it is changed
# to the default OS based on it's type (taken from node_types
# table).
......@@ -124,6 +128,7 @@ Node instproc updatedb {DB} {
$self instvar realtime
$self instvar isvirt
$self instvar virthost
$self instvar issubnode
var_import ::TBCOMPAT::default_osids
var_import ::GLOBALS::pid
var_import ::GLOBALS::eid
......@@ -151,6 +156,14 @@ Node instproc updatedb {DB} {
# If a subnode, then it must be fixed to a pnode, or we have to
# create one on the fly and set the type properly.
if {$issubnode && $fixed == ""} {
$sim spitxml_data "virt_nodes" [list "vname" "type" "ips" "osname" "cmd_line" "rpms" "deltas" "startupcmd" "tarfiles" "fixed" ] [list "host-$self" "pc" "" "" "" "" "" "" "" $self ]
# We need to generate the IP column from our iplist.
set ipraw {}
set i 0
......@@ -268,26 +281,33 @@ Node instproc add-route {dst nexthop} {
# Set the type/isremote/isvirt for a node. Called from tb_compat.
Node instproc set_hwtype {hwtype isrem isv} {
Node instproc set_hwtype {hwtype isrem isv issub} {
$self instvar type
$self instvar isremote
$self instvar isvirt
$self instvar issubnode
set type $hwtype
set isremote $isrem
set isvirt $isv
set issubnode $issub
# Fix a node. Watch for fixing a node to another node, in which case
# we are putting virtual (jailed) nodes on a real node.
# Fix a node. Watch for fixing a node to another node.
Node instproc set_fixed {pnode} {
$self instvar fixed
$self instvar issubnode
if { [Node info instances $pnode] != {} } {
# $pnode is an object instance of class Node
$pnode set virthost 1
if {$issubnode} {
$pnode set subnodehost 1
} else {
perror "\[set-fixed] Improper fix-node $self to $pnode!"
set fixed $pnode
......@@ -349,13 +349,15 @@ sub GenDefsFile($)
print TCL "# Node Types\n";
$query_result =
DBQueryFatal("select type,isremotenode,isvirtnode,osname ".
DBQueryFatal("select type,isremotenode,isvirtnode,osname,issubnode ".
" from node_types as nt ".
"left join os_info as o on nt.osid=o.osid");
while (my ($type,$isrem,$isvirt,$osid) = $query_result->fetchrow_array()) {
while (my ($type,$isrem,$isvirt,$osid,$issubnode) =
$query_result->fetchrow_array()) {
print TCL "set hwtypes($type) 1\n";
print TCL "set isremote($type) $isrem\n";
print TCL "set isvirt($type) $isvirt\n";
print TCL "set issubnode($type) $issubnode\n";
print TCL "set default_osids($type) \"$osid\"\n"
if (defined($osid) && $osid ne "");
......@@ -52,11 +52,13 @@ namespace eval TBCOMPAT {
variable hwtypes
variable isremote
variable isvirt
variable issubnode
# NSE hack: sim type is not in DB. Just adding it now
set hwtypes(sim) 1
set isremote(sim) 0
set isvirt(sim) 0
set issubnode(sim) 0
# The permissions table. Entries in this table indicate who is allowed
# to use nodes of a particular type. No entries means anyone can use it.
......@@ -127,6 +129,7 @@ proc tb-set-hardware {node type args} {
var_import ::TBCOMPAT::hwtypes
var_import ::TBCOMPAT::isremote
var_import ::TBCOMPAT::isvirt
var_import ::TBCOMPAT::issubnode
var_import ::GLOBALS::vtypes
if {(! [info exists hwtypes($type)]) &&
(! [info exists vtypes($type)])} {
......@@ -159,7 +162,11 @@ proc tb-set-hardware {node type args} {
if {[info exists isvirt($type)]} {
set isv $isvirt($type)
$node set_hwtype $type $remote $isv
set issub 0
if {[info exists isvirt($type)]} {
set issub $issubnode($type)
$node set_hwtype $type $remote $isv $issub
proc tb-set-node-os {node os} {
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