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

The first commit of the Workbench code. Turned off in the main tree,

you can turn it on in your devel tree by setting the $EXPOSETEMPLATES
variable in www/defs.php3.in to 1. BE SURE NOT TO CHECK THAT CHANGE IN!
parent 57d17989
......@@ -26,7 +26,7 @@ use vars qw(@ISA @EXPORT);
NODEBOOTSTATUS_OKAY NODEBOOTSTATUS_FAILED NODEBOOTSTATUS_UNKNOWN
NODESTARTSTATUS_NOSTATUS PROJMEMBERTRUST_NONE PROJMEMBERTRUST_USER
PROJMEMBERTRUST_ROOT PROJMEMBERTRUST_GROUPROOT
PROJMEMBERTRUST_PROJROOT
PROJMEMBERTRUST_PROJROOT PROJMEMBERTRUST_LOCALROOT
PROJROOT GROUPROOT USERROOT TBOPSPID EXPTLOGNAME
PLABMOND_PID PLABMOND_EID PLABHOLDING_PID PLABHOLDING_EID
......@@ -635,6 +635,7 @@ sub TBDB_STATS_FLAGS_IDLESWAP() { 0x01; }
sub TBDB_STATS_FLAGS_PREMODIFY(){ 0x02; }
sub TBDB_STATS_FLAGS_START() { 0x04; }
sub TBDB_STATS_FLAGS_PRESWAPIN(){ 0x08; }
sub TBDB_STATS_FLAGS_BATCHCTRL(){ 0x10; }
# Do not export these variables!
my $TBDB_STATS_STARTCLOCK;
my $TBDB_STATS_SAVEDSWAPUID;
......@@ -3347,6 +3348,7 @@ sub TBExptContainsNodeCT($$$)
"virt_node_startloc",
"virt_simnode_attributes",
"virt_user_environment",
"virt_parameters",
# vis_nodes is locked during update in prerender, so we
# will get a consistent dataset when we backup.
"vis_nodes",
......@@ -4726,6 +4728,7 @@ sub GatherSwapStats($$$$$;$)
{
my ($pid, $eid, $uid, $mode, $ecode, $flags) = @_;
my ($pnodes,$vnodes,$duration);
my $batchctrl = 0;
# Optional argument to modify the stats gathering.
$flags = 0
......@@ -4740,7 +4743,6 @@ sub GatherSwapStats($$$$$;$)
$TBDB_STATS_STARTCLOCK = time();
return;
}
my $session = tblog_session();
$session = 'NULL' unless defined $session;
......
......@@ -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.
#
......@@ -135,6 +135,10 @@ my %virtual_tables =
tag => "tiptunnels",
row => "tiptunnel",
attrs => [ "host", "vnode" ]},
"virt_parameters" => { rows => undef,
tag => "parameters",
row => "parameter",
attrs => [ "name", "value" ]},
# This is a fake table. See below. If we add more, lets generalize.
"external_sourcefiles" => { rows => undef,
tag => "nsfiles",
......
......@@ -452,6 +452,31 @@ CREATE TABLE experiment_resources (
KEY lastidx (lastidx)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_run_bindings`
--
CREATE TABLE experiment_run_bindings (
exptidx int(10) unsigned NOT NULL default '0',
runid varchar(32) NOT NULL default '',
name varchar(64) NOT NULL default '',
value tinytext NOT NULL,
PRIMARY KEY (exptidx,runid,name)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_runs`
--
CREATE TABLE experiment_runs (
exptidx int(10) unsigned NOT NULL default '0',
runid varchar(32) NOT NULL default '',
description tinytext,
start_time datetime default NULL,
stop_time datetime default NULL,
PRIMARY KEY (exptidx,runid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_stats`
--
......@@ -487,6 +512,183 @@ CREATE TABLE experiment_stats (
KEY rsrcidx (rsrcidx)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_graphs`
--
CREATE TABLE experiment_template_graphs (
parent_guid varchar(16) NOT NULL default '',
image mediumblob,
imap mediumtext,
PRIMARY KEY (parent_guid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_input_data`
--
CREATE TABLE experiment_template_input_data (
idx int(10) unsigned NOT NULL auto_increment,
md5 varchar(32) NOT NULL default '',
input mediumtext,
PRIMARY KEY (idx),
UNIQUE KEY md5 (md5)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_inputs`
--
CREATE TABLE experiment_template_inputs (
idx int(10) unsigned NOT NULL auto_increment,
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
pid varchar(12) NOT NULL default '',
tid varchar(32) NOT NULL default '',
input_idx int(10) unsigned NOT NULL default '0',
PRIMARY KEY (parent_guid,parent_vers,idx),
KEY pidtid (pid,tid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_instance_bindings`
--
CREATE TABLE experiment_template_instance_bindings (
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
exptidx int(10) unsigned NOT NULL default '0',
pid varchar(12) NOT NULL default '',
eid varchar(32) NOT NULL default '',
name varchar(64) NOT NULL default '',
value tinytext NOT NULL,
PRIMARY KEY (exptidx,name),
KEY parent_guid (parent_guid,parent_vers),
KEY pidtid (pid,eid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_instances`
--
CREATE TABLE experiment_template_instances (
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
exptidx int(10) unsigned NOT NULL default '0',
pid varchar(12) NOT NULL default '',
eid varchar(32) NOT NULL default '',
uid varchar(8) NOT NULL default '',
start_time datetime default NULL,
stop_time datetime default NULL,
PRIMARY KEY (exptidx),
KEY parent_guid (parent_guid,parent_vers),
KEY pid (pid,eid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_metadata`
--
CREATE TABLE experiment_template_metadata (
guid varchar(16) NOT NULL default '',
vers smallint(5) unsigned NOT NULL default '0',
parent_guid varchar(16) default NULL,
parent_vers smallint(5) unsigned NOT NULL default '0',
template_guid varchar(16) NOT NULL default '',
template_vers smallint(5) unsigned NOT NULL default '0',
name varchar(64) NOT NULL default '',
value tinytext,
created datetime default NULL,
PRIMARY KEY (guid,vers,name),
KEY parent_guid (parent_guid,parent_vers),
KEY template_guid (template_guid,template_vers)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_parameters`
--
CREATE TABLE experiment_template_parameters (
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
pid varchar(12) NOT NULL default '',
tid varchar(32) NOT NULL default '',
name varchar(64) NOT NULL default '',
value tinytext,
PRIMARY KEY (parent_guid,parent_vers,name),
KEY pidtid (pid,tid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_template_settings`
--
CREATE TABLE experiment_template_settings (
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
pid varchar(12) NOT NULL default '',
tid varchar(32) NOT NULL default '',
uselinkdelays tinyint(4) NOT NULL default '0',
forcelinkdelays tinyint(4) NOT NULL default '0',
multiplex_factor smallint(5) default NULL,
uselatestwadata tinyint(4) NOT NULL default '0',
usewatunnels tinyint(4) NOT NULL default '1',
wa_delay_solverweight float default '0',
wa_bw_solverweight float default '0',
wa_plr_solverweight float default '0',
sync_server varchar(32) default NULL,
cpu_usage tinyint(4) unsigned NOT NULL default '0',
mem_usage tinyint(4) unsigned NOT NULL default '0',
veth_encapsulate tinyint(4) NOT NULL default '1',
allowfixnode tinyint(4) NOT NULL default '1',
jail_osname varchar(20) default NULL,
delay_osname varchar(20) default NULL,
use_ipassign tinyint(4) NOT NULL default '0',
ipassign_args varchar(255) default NULL,
linktest_level tinyint(4) NOT NULL default '0',
linktest_pid int(11) default '0',
useprepass tinyint(1) NOT NULL default '0',
elab_in_elab tinyint(1) NOT NULL default '0',
elabinelab_eid varchar(32) default NULL,
elabinelab_cvstag varchar(64) default NULL,
elabinelab_nosetup tinyint(1) NOT NULL default '0',
security_level tinyint(1) NOT NULL default '0',
delay_capacity tinyint(3) unsigned default NULL,
savedisk tinyint(1) NOT NULL default '0',
PRIMARY KEY (parent_guid,parent_vers),
KEY pidtid (pid,tid)
) TYPE=MyISAM;
--
-- Table structure for table `experiment_templates`
--
CREATE TABLE experiment_templates (
guid varchar(16) NOT NULL default '',
vers smallint(5) unsigned NOT NULL default '0',
parent_guid varchar(16) default NULL,
parent_vers smallint(5) unsigned default NULL,
pid varchar(12) NOT NULL default '',
gid varchar(16) NOT NULL default '',
tid varchar(32) NOT NULL default '',
uid varchar(8) NOT NULL default '',
description mediumtext,
eid varchar(32) NOT NULL default '',
created datetime default NULL,
modified datetime default NULL,
locked datetime default NULL,
state varchar(16) NOT NULL default 'new',
path tinytext,
maximum_nodes int(6) unsigned default NULL,
minimum_nodes int(6) unsigned default NULL,
logfile tinytext,
logfile_open tinyint(4) NOT NULL default '0',
prerender_pid int(11) default '0',
PRIMARY KEY (guid,vers),
KEY pidtid (pid,tid),
KEY pideid (pid,eid)
) TYPE=MyISAM;
--
-- Table structure for table `experiments`
--
......@@ -2468,6 +2670,18 @@ CREATE TABLE virt_nodes (
KEY pid (pid,eid,vname)
) TYPE=MyISAM;
--
-- Table structure for table `virt_parameters`
--
CREATE TABLE virt_parameters (
pid varchar(12) NOT NULL default '',
eid varchar(32) NOT NULL default '',
name varchar(64) NOT NULL default '',
value tinytext,
PRIMARY KEY (pid,eid,name)
) TYPE=MyISAM;
--
-- Table structure for table `virt_programs`
--
......
......@@ -777,6 +777,21 @@ REPLACE INTO table_regex VALUES ('node_attributes','attrkey','text','regex','^[-
REPLACE INTO table_regex VALUES ('node_attributes','attrvalue','text','regex','^[-\\w\\.+,\\s]+$',0,255,NULL);
REPLACE INTO table_regex VALUES ('archive_tags','description','text','redirect','projects:why',1,2048,NULL);
REPLACE INTO table_regex VALUES ('archive_tags','tag','text','regex','^[a-zA-Z][-\\w\\.\\+]+$',3,64,NULL);
REPLACE INTO table_regex VALUES ('experiment_templates','description','text','regex','^[\\040-\\176\\012\\015\\011]*$',1,4096,NULL);
REPLACE INTO table_regex VALUES ('experiment_templates','guid','text','regex','^[\\w]+$',1,32,NULL);
REPLACE INTO table_regex VALUES ('experiment_template_metadata','name','text','regex','^[\\040-\\176]*$',1,64,NULL);
REPLACE INTO table_regex VALUES ('experiment_template_metadata','value','text','regex','^[\\040-\\176\\012\\015\\011]*$',1,2048,NULL);
REPLACE INTO table_regex VALUES ('virt_parameters','pid','text','redirect','projects:pid',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_parameters','eid','text','redirect','experiments:eid',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_parameters','name','text','regex','^\\w[-\\w]+$',1,64,NULL);
REPLACE INTO table_regex VALUES ('virt_parameters','value','text','redirect','default:tinytext',0,256,NULL);
REPLACE INTO table_regex VALUES ('experiment_template_instance_bindings','name','text','regex','^\\w[-\\w]+$',1,64,NULL);
REPLACE INTO table_regex VALUES ('experiment_template_instance_bindings','value','text','redirect','default:tinytext',0,256,NULL);
REPLACE INTO table_regex VALUES ('experiment_runs','runid','text','redirect','experiments:eid',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiment_runs','description','text','regex','^[\\040-\\176\\012\\015\\011]*$',1,256,NULL);
REPLACE INTO table_regex VALUES ('experiment_run_bindings','name','text','regex','^\\w[-\\w]+$',1,64,NULL);
REPLACE INTO table_regex VALUES ('experiment_run_bindings','value','text','redirect','default:tinytext',0,256,NULL);
--
-- Dumping data for table `testsuite_preentables`
......
......@@ -3225,3 +3225,8 @@ last_net_act,last_cpu_act,last_ext_act);
those entries from the "log" table using:
delete from log where type = 'thecause';
4.41: A lot of Template stuff. This is experimental!
mysql tbdb < templates.sql
#
# Notes about the template table
#
# * I am not storing the existing idle,maxdur,etc settings. These will be
# required to be specified when the swapin is created.
#
# * There is duplication of the "settings" that result from the parse.
# I am wondering about moving these to a "virt_settings" table as a
# key/value pairing, but thats a big change and the sql queries get more
# complicated. Or, it can be a virt_settings table with the values
# specified (read: just moved from experiments table to another table).
#
# * My understanding is that a "modification" causes a new record with the
# same GUID, but a new version number. These are permanent records.
#
CREATE TABLE experiment_templates (
-- Globally Unique ID. Okay, how global is global? Site global?
guid varchar(16) NOT NULL default '',
-- Version number for tracking modifications
vers smallint(5) unsigned NOT NULL default '0',
-- Pointer to parent, for modification.
parent_guid varchar(16) default NULL,
parent_vers smallint(5) unsigned default NULL,
-- Project ID
pid varchar(12) NOT NULL default '',
-- Group ID
gid varchar(16) NOT NULL default '',
-- Template ID (something unique that the user specifies)
tid varchar(32) NOT NULL default '',
-- Creator of the template
uid varchar(8) NOT NULL default '',
-- Eric says these are really metadata. Probably true.
description mediumtext,
-- EID of the underlying parsed experiment. I think this is temporary.
eid varchar(32) NOT NULL default '',
-- These are all mirrors of what is in the existing experiments table
created datetime default NULL,
modified datetime default NULL,
locked datetime default NULL,
state varchar(16) NOT NULL default 'new',
path tinytext,
maximum_nodes int(6) unsigned default NULL,
minimum_nodes int(6) unsigned default NULL,
logfile tinytext,
logfile_open tinyint(4) NOT NULL default '0',
prerender_pid int(11) default '0',
PRIMARY KEY (guid, vers),
KEY pidtid (pid,tid),
KEY pideid (pid,eid)
) TYPE=MyISAM;
#
# Temporary storage for graphs generated with dot.
#
CREATE TABLE experiment_template_graphs (
-- Backlink to the template the input belongs to.
parent_guid varchar(16) NOT NULL default '',
image mediumblob,
imap mediumtext,
PRIMARY KEY (parent_guid)
) TYPE=MyISAM;
#
# I like to keep the nsfiles (or whatever the input will be) separate
# from the template record so that I do not have to see it when
# talking to mysql directly. The table below allows for multiple input
# files per template, although not sure if that is really needed.
#
# Note that table does not actually store the input files, but is a pointer
# to another table. Why? Cause I expect a lot of duplication of input files,
# if changes to the metadata cause a new template record. Instead, put the
# files in another table and md5 them to track uniqueness.
#
CREATE TABLE experiment_template_inputs (
-- Auto generated unique index so there can be more then one input
-- per template. Note sure this is actually needed.
idx int(10) unsigned NOT NULL auto_increment,
-- Backlink to the template the input belongs to.
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
-- These are for debugging and clarity; not strictly needed.
-- Project ID
pid varchar(12) NOT NULL default '',
-- Template ID (aka the eid)
tid varchar(32) NOT NULL default '',
-- The index into the inputs table.
input_idx int(10) unsigned NOT NULL default '0',
PRIMARY KEY (parent_guid, parent_vers, idx),
KEY pidtid (pid,tid)
) TYPE=MyISAM;
#
# And this is the table of inputs mentioned above.
#
CREATE TABLE experiment_template_input_data (
-- Auto generated unique index.
idx int(10) unsigned NOT NULL auto_increment,
-- MD5 of the input file.
md5 varchar(32) NOT NULL,
-- The actual text of the input
input mediumtext,
PRIMARY KEY (idx),
UNIQUE KEY md5 (md5)
) TYPE=MyISAM;
#
# These are the various settings that result from an NS file being parsed
# and are passed along to the experiment instance later (swapin). They
# could go into the template structure above, but that is too messy.
#
CREATE TABLE experiment_template_settings (
-- Backlink to the template the metadata belongs to.
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
-- Project ID
pid varchar(12) NOT NULL default '',
-- Template ID (aka the eid)
tid varchar(32) NOT NULL default '',
-- These are also mirrors of what is in the experiments table, and are
-- needed to parse and hold state about the virtual topo. They will
-- eventually be passed down to the experiment table entry when a swapin
-- is created. All come from the NS file parse.
uselinkdelays tinyint(4) NOT NULL default '0',
forcelinkdelays tinyint(4) NOT NULL default '0',
multiplex_factor smallint(5) default NULL,
uselatestwadata tinyint(4) NOT NULL default '0',
usewatunnels tinyint(4) NOT NULL default '1',
wa_delay_solverweight float default '0',
wa_bw_solverweight float default '0',
wa_plr_solverweight float default '0',
sync_server varchar(32) default NULL,
cpu_usage tinyint(4) unsigned NOT NULL default '0',
mem_usage tinyint(4) unsigned NOT NULL default '0',
veth_encapsulate tinyint(4) NOT NULL default '1',
allowfixnode tinyint(4) NOT NULL default '1',
jail_osname varchar(20) default NULL,
delay_osname varchar(20) default NULL,
use_ipassign tinyint(4) NOT NULL default '0',
ipassign_args varchar(255) default NULL,
linktest_level tinyint(4) NOT NULL default '0',
linktest_pid int(11) default '0',
useprepass tinyint(1) NOT NULL default '0',
elab_in_elab tinyint(1) NOT NULL default '0',
elabinelab_eid varchar(32) default NULL,
elabinelab_cvstag varchar(64) default NULL,
elabinelab_nosetup tinyint(1) NOT NULL default '0',
security_level tinyint(1) NOT NULL default '0',
delay_capacity tinyint(3) unsigned default NULL,
savedisk tinyint(1) NOT NULL default '0',
PRIMARY KEY (parent_guid, parent_vers),
KEY pidtid (pid,tid)
) TYPE=MyISAM;
#
# This is versioned metadata that goes with each template. Not sure what
# goes into this table yet ...
#
CREATE TABLE experiment_template_metadata (
-- Globally Unique ID. Okay, how global is global?
guid varchar(16) NOT NULL default '',
-- Version number for tracking modifications
vers smallint(5) unsigned NOT NULL default '0',
-- Backlink to the previous version of this metadata item.
parent_guid varchar(16) default NULL,
parent_vers smallint(5) unsigned NOT NULL default '0',
-- Backlink to the template this metadata item belongs to.
template_guid varchar(16) NOT NULL default '',
template_vers smallint(5) unsigned NOT NULL default '0',
name varchar(64) NOT NULL default '',
value tinytext,
created datetime default NULL,
PRIMARY KEY (guid, vers, name),
KEY (parent_guid,parent_vers),
KEY (template_guid,template_vers)
) TYPE=MyISAM;
#
# This is a table of formal parameters for the template, with optional
# values associated. They are Key/Value pairs that are associated
# with a template.
#
# * Need some new syntax for the NS file. Perhaps:
#
# tb-define-formal-parameter name value
#
# where the value is optional and causes an entry with a null value (in
# the table below).
#
# * My understanding is that formal parameters which are bound (value
# provided) when the template is created, have that value passed along
# to all instances (swapins) of the template. Unbound values must be
# provided when the instance is created, perhaps via a simple XML data
# file that specifies key/value pairs. You can of course override the
# already bound values (ones specified in the template).
#
# * I am still not clear on the versioning of metadata, and as discussed
# in the meeting, I am glossing over it for now.
#
CREATE TABLE experiment_template_parameters (
-- Globally Unique ID of the ExperimentTemplate this record belongs to.
parent_guid varchar(16) NOT NULL default '',
-- Version number for tracking modifications
parent_vers smallint(5) unsigned NOT NULL default '0',
-- Project ID
pid varchar(12) NOT NULL default '',
-- Template ID (aka the eid)
tid varchar(32) NOT NULL default '',
name varchar(64) NOT NULL default '',
value tinytext,
PRIMARY KEY (parent_guid, parent_vers, name),
KEY pidtid (pid,tid)
) TYPE=MyISAM;
#
# Hmm, the above table is a problem wrt experiment parsing.
#
CREATE TABLE virt_parameters (
pid varchar(12) NOT NULL default '',
eid varchar(32) NOT NULL default '',
name varchar(64) NOT NULL default '',
value tinytext,
PRIMARY KEY (pid,eid,name)
) TYPE=MyISAM;
#
# This table is a wrapper around the current experiments table, which will
# continue to be the basic structure for the swapin. This includes all of
# virt tables which are uniquely associated with an experiment record. So,
# an instantiation of a template generates one of these, and does the equiv
# of what happens now when an experiment is created and swapped in.
#
# This table is also the historical record for template instantiations;
# records are permanent.
#
# Note that there other things that will go in this table, just not sure
# what they are yet, as they relate to "Experiment" (in Eric jargon) and
# to "ExperimentRecord."
#
CREATE TABLE experiment_template_instances (
-- Backlink to the template.
parent_guid varchar(16) NOT NULL default '',
parent_vers smallint(5) unsigned NOT NULL default '0',
-- The experiment index (into the current experiments table).
exptidx int(10) unsigned NOT NULL default '0',
-- Project ID
pid varchar(12) NOT NULL default '',
-- The actual eid (for the experiments table)
eid varchar(32) NOT NULL default '',
-- Creator of the instance.
uid varchar(8) NOT NULL default '',
-- A little bit of duplication ...
start_time datetime default NULL,
stop_time datetime default NULL,
PRIMARY KEY (exptidx),
KEY (parent_guid,parent_vers),
KEY (pid,eid)
) TYPE=MyISAM;
#
# These are the bindings for the formal parameters above. Note that values
# fully specified in the template can still be overridden when the template
# is instantiated (swapped in), and again before each Experiment run. At
# present I am using two tables, but that is probably overkill.
#
# This table is also the historical record for template bindings; records
# are permanent