Commit 9bb38c10 authored by Mike Hibler's avatar Mike Hibler

Add some useful elabinelab sitevars.

New sitevars:
  elabinelab/singlenet     set the system-wide default for cnet implementation
  elabinelab/boss_osid     default OSID for boss node
  elabinelab/ops_osid      default OSID for ops node
  elabinelab/fs_osid       default OSID for fs node

Also mark the various elabinelab/*pkg* sitevars as deprecated.  Package
versions are just too dependent on the OS running and we almost always
wind up overriding these sitevars in rc.mkelab anyway.
parent 36d218a5
......@@ -55,11 +55,15 @@ INSERT INTO sitevariables VALUES ('robotlab/opentime','08:00','07:00','Time the
INSERT INTO sitevariables VALUES ('robotlab/closetime',NULL,'18:00','Time the Robot lab closes down for the night.',0);
INSERT INTO sitevariables VALUES ('robotlab/open','1','0','Turn the Robot Lab on/off for weekends and holidays. Overrides the open/close times.',0);
INSERT INTO sitevariables VALUES ('swap/admission_control_debug',NULL,'0','Turn on/off admission control debugging (lots of output!)',0);
INSERT INTO sitevariables VALUES ('elabinelab/boss_pkg','emulab-boss-1.8','emulab-boss-1.8','Name of boss node install package',0);
INSERT INTO sitevariables VALUES ('elabinelab/boss_pkg_dir','/share/freebsd/packages/FreeBSD-4.10-20041102','/share/freebsd/packages/FreeBSD-4.10-20041102','Path from which to fetch boss packages',0);
INSERT INTO sitevariables VALUES ('elabinelab/ops_pkg','emulab-ops-1.4','emulab-ops-1.4','Name of ops node install package',0);
INSERT INTO sitevariables VALUES ('elabinelab/ops_pkg_dir','/share/freebsd/packages/FreeBSD-4.10-20041102','/share/freebsd/packages/FreeBSD-4.10-20041102','Path from which to fetch ops packages',0);
INSERT INTO sitevariables VALUES ('elabinelab/boss_pkg',NULL,'','Name of boss node install package (DEPRECATED)',0);
INSERT INTO sitevariables VALUES ('elabinelab/boss_pkg_dir',NULL,'','Path from which to fetch boss packages (DEPRECATED)',0);
INSERT INTO sitevariables VALUES ('elabinelab/ops_pkg',NULL,'','Name of ops node install package (DEPRECATED)',0);
INSERT INTO sitevariables VALUES ('elabinelab/ops_pkg_dir',NULL,'','Path from which to fetch ops packages (DEPRECATED)',0);
INSERT INTO sitevariables VALUES ('elabinelab/windows','1','0','Turn on Windows support in inner Emulab',0);
INSERT INTO `sitevariables` VALUES ('elabinelab/singlenet',NULL,0,'Default control net config. 0==use inner cnet, 1==use real cnet',1);
INSERT INTO `sitevariables` VALUES ('elabinelab/boss_osid',NULL,'','Default (emulab-ops) OSID to boot on boss node. Empty string means use node_type default OSID',1);
INSERT INTO `sitevariables` VALUES ('elabinelab/ops_osid',NULL,'','Default (emulab-ops) OSID to boot on ops node. Empty string means use node_type default OSID',1);
INSERT INTO `sitevariables` VALUES ('elabinelab/fs_osid',NULL,'','Default (emulab-ops) OSID to boot on fs node. Empty string means use node_type default OSID',1);
INSERT INTO sitevariables VALUES ('general/firstinit/state',NULL,'Ready','Indicates that a new emulab is not setup yet. Moves through several states.',0);
INSERT INTO sitevariables VALUES ('general/firstinit/pid',NULL,'testbed','The Project Name of the first project.',0);
INSERT INTO sitevariables VALUES ('general/version/minor','168','','Source code minor revision number',0);
......
#
# Add sitevariables to control global operation and defaults for elabinelab.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
DBQueryFatal("INSERT INTO `sitevariables` VALUES ".
"('elabinelab/singlenet',NULL,0,'Default control net config. 0==use inner cnet, 1==use real cnet',1)")
if (!TBSiteVarExists("elabinelab/singlenet"));
#
# XXX need to think about a default for these. The problem is
# that at this point, they have no images registered and we don't
# even know what images they have! The elabinelab.ns script will
# complain and default to FBSD63-STD if these site vars are not set,
# so that seems as good at anything.
#
DBQueryFatal("INSERT INTO `sitevariables` VALUES ".
"('elabinelab/boss_osid',NULL,'','Default (emulab-ops) OSID to boot on boss node. Empty string means use node_type default OSID',1)")
if (!TBSiteVarExists("elabinelab/boss_osid"));
DBQueryFatal("INSERT INTO `sitevariables` VALUES ".
"('elabinelab/ops_osid',NULL,'','Default (emulab-ops) OSID to boot on ops node. Empty string means use node_type default OSID',1)")
if (!TBSiteVarExists("elabinelab/ops_osid"));
DBQueryFatal("INSERT INTO `sitevariables` VALUES ".
"('elabinelab/fs_osid',NULL,'','Default (emulab-ops) OSID to boot on fs node. Empty string means use node_type default OSID',1)")
if (!TBSiteVarExists("elabinelab/fs_osid"));
#
# XXX the {boss,ops}_pkg* variables are deprecated since packages are
# just too tightly linked with the OS version and we deal with this in
# rc.mkelab. Not quite sure how to handle the deprecation correctly
# however. So lets try:
# For new installs, we create them with empty values
# (done by sitevars-create.sql).
# For old installs (updates), we leave them alone.
# The net effect here is that we do nothing for these vars except to
# change the description.
#
DBQueryFatal("update sitevariables set description=".
"'Name of boss node install package (DEPRECATED)'".
" where name='elabinelab/boss_pkg'");
DBQueryFatal("update sitevariables set description=".
"'Path from which to fetch boss packages (DEPRECATED)'".
" where name='elabinelab/boss_pkg_dir'");
DBQueryFatal("update sitevariables set description=".
"'Name of ops node install package (DEPRECATED)'".
" where name='elabinelab/ops_pkg'");
DBQueryFatal("update sitevariables set description=".
"'Path from which to fetch ops packages (DEPRECATED)'".
" where name='elabinelab/ops_pkg_dir'");
return 0;
}
1;
......@@ -39,7 +39,14 @@ my $dbgooonly= 0;
my $update = 0;
my $remove = 0;
# XXX experimental speed hacks
#
# XXX experimental speed hacks.
# $inparallel reboots all server in parallel (rather than serially)
# after setup
# $restartnodes uses a new bootinfo RESTART command to quickly move
# inner nodes from control of outer boss to inner boss
# avoiding all node reboots
#
my $inparallel = 1;
my $restartnodes = 1;
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2008 University of Utah and the Flux Group.
# Copyright (c) 2004-2010 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -150,6 +150,10 @@ if {[info exists ::TBCOMPAT::elabinelab_nodeos("boss")]} {
namespace eval TBCOMPAT {
tb-set-node-os $myboss $elabinelab_nodeos("boss")
}
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/boss_osid)]} {
namespace eval TBCOMPAT {
tb-set-node-os $myboss $sitevariables(elabinelab/boss_osid)
}
} else {
tb-set-node-os $myboss FBSD63-STD
}
......@@ -158,6 +162,10 @@ if {[info exists ::TBCOMPAT::elabinelab_nodeos("ops")]} {
namespace eval TBCOMPAT {
tb-set-node-os $myops $elabinelab_nodeos("ops")
}
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/ops_osid)]} {
namespace eval TBCOMPAT {
tb-set-node-os $myops $sitevariables(elabinelab/ops_osid)
}
} else {
tb-set-node-os $myops FBSD63-STD
}
......@@ -166,6 +174,10 @@ if {[info exists ::TBCOMPAT::elabinelab_nodeos("fs")]} {
namespace eval TBCOMPAT {
tb-set-node-os $myfs $elabinelab_nodeos("fs")
}
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/fs_osid)]} {
namespace eval TBCOMPAT {
tb-set-node-os $myfs $sitevariables(elabinelab/fs_osid)
}
} else {
tb-set-node-os $myfs FBSD63-STD
}
......@@ -126,6 +126,10 @@ if {[info exists ::TBCOMPAT::elabinelab_nodeos("boss")]} {
namespace eval TBCOMPAT {
tb-set-node-os $myboss $elabinelab_nodeos("boss")
}
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/boss_osid)]} {
namespace eval TBCOMPAT {
tb-set-node-os $myboss $sitevariables(elabinelab/boss_osid)
}
} else {
tb-set-node-os $myboss FBSD63-STD
}
......@@ -134,6 +138,10 @@ if {[info exists ::TBCOMPAT::elabinelab_nodeos("ops")]} {
namespace eval TBCOMPAT {
tb-set-node-os $myops $elabinelab_nodeos("ops")
}
} elseif {[info exists ::TBCOMPAT::sitevariables(elabinelab/ops_osid)]} {
namespace eval TBCOMPAT {
tb-set-node-os $myops $sitevariables(elabinelab/ops_osid)
}
} else {
tb-set-node-os $myops FBSD63-STD
}
......@@ -80,7 +80,7 @@ proc tb-elab-in-elab {onoff} {}
proc tb-elab-in-elab-topology {topo} {}
proc tb-set-inner-elab-eid {eid} {}
proc tb-set-elabinelab-cvstag {cvstag} {}
proc tb-elabinelab-singlenet {} {}
proc tb-elabinelab-singlenet {{onoff 1}} {}
proc tb-set-elabinelab-attribute {key val {order 0}} {}
proc tb-unset-elabinelab-attribute {key} {}
proc tb-set-elabinelab-role-attribute {role key val {order 0}} {}
......
......@@ -567,6 +567,7 @@ sub GenDefsFile($)
print TCL "\n";
print TCL "# Site variables\n";
my %sitevars = ();
$query_result = DBQueryFatal("select name,value,defaultvalue " .
" from sitevariables where ns_include=TRUE");
while (my ($name,$value,$defaultvalue) = $query_result->fetchrow_array()) {
......@@ -584,9 +585,29 @@ sub GenDefsFile($)
# Note: braces in tcl act like single quotes in other scripting
# languages (eg. no interpolation occurs)
print TCL "set sitevariables($name) {$value}\n";
$sitevars{$name} = $value;
}
print TCL "\n";
#
# XXX Backward compat: we must ensure that certain sitevars exist in
# the NS defs file as NS parser assumes they do. If they don't exist,
# we create them with the "traditional" values.
#
my %defvalues = (
"elabinelab/singlenet" => 0,
"elabinelab/boss_osid" => "FBSD63-STD",
"elabinelab/ops_osid" => "FBSD63-STD",
"elabinelab/fs_osid" => "FBSD63-STD"
);
while (my ($var, $def) = each(%defvalues)) {
if (!exists($sitevars{$var})) {
print "*** WARNING: sitevar $var does not exist or has no value, ",
"defaulting to $def\n";
print TCL "set sitevariables($var) $def\n";
$sitevars{$var} = $def;
}
}
if (defined($pid)) {
print TCL "# OSIDs\n";
......@@ -668,17 +689,61 @@ sub GenDefsFile($)
}
#
# ElabInElab stuff.
# Defaults for ElabInElab settings.
# System-wide defaults that come from sitevariables integrated above.
# However, for compatibility, we want existing experiments to retain
# their current settings for some of these, unless explicitly overridden
# via NS commands. So here we initialize elabinelab variables based on
# existing values, so that the sitevar values won't get used later.
# These values can still be overridden by explicit settings in the NS file.
#
if (defined($experiment) && $experiment->elabinelab()) {
# dig out existing OSIDs for the boss/ops/fs nodes
$query_result =
DBQueryFatal("select inner_elab_role,osname from virt_nodes ".
" where inner_elab_role!='node' and ".
" pid='$pid' and eid='$eid'");
while (my ($role,$os) = $query_result->fetchrow_array()) {
if ($role =~ /^boss/) {
print TCL "set ::TBCOMPAT::elabinelab_nodeos('boss') $os\n";
next;
}
if ($role =~ /^ops/) {
print TCL "set ::TBCOMPAT::elabinelab_nodeos('ops') $os\n";
if ($role eq "ops+fs") {
print TCL "set ::TBCOMPAT::elabinelab_nodeos('fs') $os\n";
}
next;
}
if ($role =~ /^fs/) {
print TCL "set ::TBCOMPAT::elabinelab_nodeos('fs') $os\n";
next;
}
}
}
#
# XXX elabinelab_singlenet must always have a value.
# This really isn't the place to do this, but I don't want to
# mess with the TCL code...
#
my $singlenet = $sitevars{"elabinelab/singlenet"};
if (defined($experiment) && $experiment->elabinelab()) {
$singlenet = $experiment->elabinelab_singlenet();
}
print TCL "set ::GLOBALS::elabinelab_singlenet $singlenet\n";
#
# Another ElabinElab setting.
# This looks much like the compat hack above, but is for a completely
# different reason. If an inner-elab has an inner-experiment, the
# NS file is re-parsed to pick up additional info.
#
my $maxnodes = 0;
my $singlenet = 1;
if (defined($experiment) && $experiment->elabinelab()) {
$maxnodes = $experiment->maximum_nodes();
$singlenet = $experiment->elabinelab_singlenet();
}
# Be sure to initialize this to something ...
print TCL "set elabinelab_maxpcs $maxnodes\n\n";
print TCL "set ::GLOBALS::elabinelab_singlenet $singlenet\n";
#
# For Templates.
......
......@@ -379,12 +379,21 @@ sub doboot()
if ($emulabconfig{"ROLE"} eq "boss+router");
#
# XXX temporary: adjust package info.
# XXX not-so-temporary: adjust package info.
#
# The defaults are in sitevars passed via emulabconfig,
# but they are almost always wrong...
# There are defaults in sitevars passed via emulabconfig,
# but they are almost always wrong... So we ALWAYS override them
# here; packages are just too intimately tied to the OS version.
#
if ($FBSD_VERSION == 5.4) {
if ($FBSD_VERSION == 4.10) {
$emulabconfig{FS_PKG_DIR} = "/share/freebsd/4.10/packages";
$emulabconfig{OPS_PKG_DIR} = "/share/freebsd/4.10/packages";
$emulabconfig{BOSS_PKG_DIR} = "/share/freebsd/4.10/packages";
$emulabconfig{FS_PKG} = "emulab-fs-1.4";
$emulabconfig{OPS_PKG} = "emulab-ops-1.4";
$emulabconfig{BOSS_PKG} = "emulab-boss-1.4";
}
elsif ($FBSD_VERSION == 5.4) {
$emulabconfig{FS_PKG_DIR} = "/share/freebsd/5.4/packages";
$emulabconfig{OPS_PKG_DIR} = "/share/freebsd/5.4/packages";
$emulabconfig{BOSS_PKG_DIR} = "/share/freebsd/5.4/packages";
......
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