Commit 1ef73ff2 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Add a table to hold key/value pairs on a per-node basis, passed to the

client side. These are not environment variables, these are just key
value pairs that the clientside boot can look for.
parent a680735b
......@@ -2617,6 +2617,7 @@ CREATE TABLE `nodes` (
`sshdport` int(11) NOT NULL default '11000',
`jailflag` tinyint(3) unsigned NOT NULL default '0',
`jailip` varchar(15) default NULL,
`jailipmask` varchar(15) default NULL,
`sfshostid` varchar(128) default NULL,
`stated_tag` varchar(32) default NULL,
`rtabid` smallint(5) unsigned NOT NULL default '0',
......@@ -4380,6 +4381,22 @@ CREATE TABLE `virt_lans` (
KEY `pideid` (`pid`,`eid`,`vname`,`vnode`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `virt_node_attributes`
--
DROP TABLE IF EXISTS `virt_node_attributes`;
CREATE TABLE `virt_node_attributes` (
`pid` varchar(48) NOT NULL default '',
`eid` varchar(32) NOT NULL default '',
`exptidx` int(11) NOT NULL default '0',
`vname` varchar(32) NOT NULL default '',
`attrkey` varchar(64) NOT NULL default '',
`attrvalue` tinytext,
PRIMARY KEY (`exptidx`,`vname`,`attrkey`),
UNIQUE KEY `pideid` (`pid`,`eid`,`vname`,`attrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `virt_node_desires`
--
......
......@@ -841,6 +841,12 @@ REPLACE INTO table_regex VALUES ('virt_lans','layer','int','redirect','default:t
REPLACE INTO table_regex VALUES ('virt_lans','ofenabled','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_lans','ofcontroller','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_attributes','pid','text','redirect','projects:pid',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_attributes','eid','text','redirect','experiments:eid',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_attributes','vname','text','redirect','virt_nodes:vname',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_attributes','attrkey','text','regex','^[-\\w]+$',1,64,NULL);
REPLACE INTO table_regex VALUES ('virt_node_attributes','attrvalue','text','regex','^[-\\w\\.+,\\s]+$',0,255,NULL);
REPLACE INTO table_regex VALUES ('virt_node_desires','pid','text','redirect','projects:pid',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_desires','eid','text','redirect','experiments:eid',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_node_desires','vname','text','redirect','virt_nodes:vname',0,0,NULL);
......
#
# Add a table to hold key/value pairs on a per-node basis, passed to the
# client side.
#
use strict;
use libdb;
my $impotent = 0;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (! DBTableExists("virt_node_attributes")) {
DBQueryFatal("CREATE TABLE `virt_node_attributes` ( ".
" `pid` varchar(48) NOT NULL default '', ".
" `eid` varchar(32) NOT NULL default '', ".
" `exptidx` int(11) NOT NULL default '0', ".
" `vname` varchar(32) NOT NULL default '', ".
" `attrkey` varchar(64) NOT NULL default '', ".
" `attrvalue` tinytext, ".
" PRIMARY KEY (`exptidx`,`vname`,`attrkey`), ".
" UNIQUE KEY `pideid` (`pid`,`eid`,`vname`,`attrkey`) ".
") ENGINE=MyISAM DEFAULT CHARSET=latin1");
}
if (!DBSlotExists("nodes", "jailipmask")) {
DBQueryFatal("alter table nodes add ".
" `jailipmask` varchar(15) default NULL ".
" after jailip");
}
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('virt_node_attributes','pid','text','redirect', ".
" 'projects:pid',0,0,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('virt_node_attributes','eid','text','redirect', ".
" 'experiments:eid',0,0,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('virt_node_attributes','vname','text','redirect', ".
" 'virt_nodes:vname',0,0,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('virt_node_attributes','attrkey','text','regex',".
" '^[-\\\\w]+\$',1,64,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
"('virt_node_attributes','attrvalue','text','regex', ".
" '^[-\\\\w\\\\.+,\\\\s]+\$',0,255,NULL)");
return 0;
}
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