From 430143704173bc274fd7181f40b74583f638f69e Mon Sep 17 00:00:00 2001 From: Leigh B Stoller Date: Wed, 10 Aug 2011 12:08:22 -0600 Subject: [PATCH] 1. Change elab role from enums to tinytext. 2. Add a new inner_elab_role; boss+fs+router which makes boss the FSNODE 3. Add loadlist to both virt_node and nodes for plumbing multi image load through from the NS parser. --- sql/database-create.sql | 6 +++-- sql/database-fill.sql | 3 ++- sql/updates/4/252 | 49 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 sql/updates/4/252 diff --git a/sql/database-create.sql b/sql/database-create.sql index de19750df..a1a0d769e 100644 --- a/sql/database-create.sql +++ b/sql/database-create.sql @@ -2519,6 +2519,7 @@ CREATE TABLE `nodes` ( `rpms` text, `deltas` text, `tarballs` text, + `loadlist` text, `startupcmd` tinytext, `startstatus` tinytext, `ready` tinyint(4) unsigned NOT NULL default '0', @@ -3382,7 +3383,7 @@ CREATE TABLE `reserved` ( `old_eid` varchar(32) NOT NULL default '', `old_exptidx` int(11) NOT NULL default '0', `cnet_vlan` int(11) default NULL, - `inner_elab_role` enum('boss','boss+router','router','ops','ops+fs','fs','node') default NULL, + `inner_elab_role` tinytext, `inner_elab_boot` tinyint(1) default '0', `plab_role` enum('plc','node','none') NOT NULL default 'none', `plab_boot` tinyint(1) default '0', @@ -4340,6 +4341,7 @@ CREATE TABLE `virt_nodes` ( `exptidx` int(11) NOT NULL default '0', `ips` text, `osname` varchar(20) default NULL, + `loadlist` text, `parent_osname` varchar(20) default NULL, `cmd_line` text, `rpms` text, @@ -4351,7 +4353,7 @@ CREATE TABLE `virt_nodes` ( `failureaction` enum('fatal','nonfatal','ignore') NOT NULL default 'fatal', `routertype` enum('none','ospf','static','manual','static-ddijk','static-old') NOT NULL default 'none', `fixed` text NOT NULL, - `inner_elab_role` enum('boss','boss+router','router','ops','ops+fs','fs','node') default NULL, + `inner_elab_role` tinytext, `plab_role` enum('plc','node','none') NOT NULL default 'none', `plab_plcnet` varchar(32) NOT NULL default 'none', `numeric_id` int(11) default NULL, diff --git a/sql/database-fill.sql b/sql/database-fill.sql index 34301504b..4bc4854a4 100644 --- a/sql/database-fill.sql +++ b/sql/database-fill.sql @@ -935,7 +935,7 @@ REPLACE INTO table_regex VALUES ('firewall_rules','fwname','text','redirect','vi REPLACE INTO table_regex VALUES ('firewall_rules','ruleno','int','redirect','default:int',0,50000,NULL); REPLACE INTO table_regex VALUES ('firewall_rules','rule','text','regex','^\\w[-\\w \\t,/\\{\\}\\(\\)!:\\.]*$',0,1024,NULL); REPLACE INTO table_regex VALUES ('virt_nodes','role','text','regex','^(node|bridge)$',0,0,NULL); -REPLACE INTO table_regex VALUES ('virt_nodes','inner_elab_role','text','regex','^(boss|boss\\+router|router|ops|ops\\+fs|fs|node)$',0,0,NULL); +REPLACE INTO table_regex VALUES ('virt_nodes','inner_elab_role','text','regex','^(boss|boss\\+router|boss\\+fs\\+router|router|ops|ops\\+fs|fs|node)$',0,0,NULL); REPLACE INTO table_regex VALUES ('virt_nodes','plab_role','text','regex','^(plc|node|none)$',0,0,NULL); REPLACE INTO table_regex VALUES ('experiments','elab_in_elab','int','redirect','default:boolean',0,0,NULL); REPLACE INTO table_regex VALUES ('experiments','elabinelab_singlenet','int','redirect','default:boolean',0,0,NULL); @@ -1059,6 +1059,7 @@ REPLACE INTO table_regex VALUES ('virt_node_motelog','logfileid','text','regex', REPLACE INTO table_regex VALUES ('virt_node_motelog','pid','text','redirect','projects:pid',0,0,NULL); REPLACE INTO table_regex VALUES ('virt_node_motelog','eid','text','redirect','experiments:eid',0,0,NULL); REPLACE INTO `table_regex` VALUES ('virt_nodes','plab_plcnet','text','regex','^[\\w\\_\\d]+$',0,0,NULL); +REPLACE INTO table_regex VALUES ('virt_nodes','loadlist','text','regex','^[-\\w\\.+,]+$',2,256,NULL); REPLACE INTO table_regex VALUES ('os_info','osid','text','regex','^[-\\w\\.+]+$',2,35,NULL); REPLACE INTO table_regex VALUES ('os_info','pid','text','redirect','projects:pid',0,0,NULL); REPLACE INTO table_regex VALUES ('os_info','pid_idx','text','redirect','projects:pid_idx',0,0,NULL); diff --git a/sql/updates/4/252 b/sql/updates/4/252 new file mode 100644 index 000000000..373157dc0 --- /dev/null +++ b/sql/updates/4/252 @@ -0,0 +1,49 @@ +# +# 1. Change elab role from enums to tinytext. +# 2. Add a new inner_elab_role; boss+fs+router which makes boss the FSNODE +# 3. Add loadlist to both virt_node and nodes for plumbing multi image load +# through from the NS parser. +# +use strict; +use libdb; + +sub DoUpdate($$$) +{ + my ($dbhandle, $dbname, $version) = @_; + + if (! DBSlotExists("virt_nodes", "loadlist")) { + DBQueryFatal("alter table virt_nodes add ". + " `loadlist` text after osname"); + } + if (! DBSlotExists("nodes", "loadlist")) { + DBQueryFatal("alter table nodes add ". + " `loadlist` text after tarballs"); + } + my $type = DBSlotType("virt_nodes", "inner_elab_role"); + if (!$type) { + Fatal("Could not get type for 'inner_elab_role' in 'virt_nodes'"); + } + if ($type =~ /boss/) { + DBQueryFatal("alter table virt_nodes modify inner_elab_role tinytext"); + } + + $type = DBSlotType("reserved", "inner_elab_role"); + if (!$type) { + Fatal("Could not get type for 'inner_elab_role' in 'reserved'"); + } + if ($type =~ /boss/) { + DBQueryFatal("alter table reserved modify inner_elab_role tinytext"); + } + + DBQueryFatal("REPLACE INTO table_regex VALUES ". + "('virt_nodes','inner_elab_role','text','regex',". + "'^(boss|boss\\+router|boss\\+fs\\+router|router|ops|ops\\+fs|fs|node)\$',". + "0,0,NULL)"); + + DBQueryFatal("REPLACE INTO table_regex VALUES ". + "('virt_nodes','loadlist','text','regex', ". + " '^[-\\w\\.+,]+\$',2,256,NULL)"); + + return 0; +} +1; -- GitLab