Commit e35de774 authored by Leigh Stoller's avatar Leigh Stoller

Increase the length of the osname slot of os_info from 20 to 30 chars.

Add metadata_utl and imagefile_url to the images table; this is to be
used with image export/import.
parent de0c1000
......@@ -1166,8 +1166,8 @@ CREATE TABLE `experiment_template_settings` (
`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,
`jail_osname` varchar(30) default NULL,
`delay_osname` varchar(30) default NULL,
`use_ipassign` tinyint(4) NOT NULL default '0',
`ipassign_args` varchar(255) default NULL,
`linktest_level` tinyint(4) NOT NULL default '0',
......@@ -1293,8 +1293,8 @@ CREATE TABLE `experiments` (
`veth_encapsulate` tinyint(4) NOT NULL default '1',
`encap_style` enum('alias','veth','veth-ne','vlan','vtun','egre','gre','default') NOT NULL default 'default',
`allowfixnode` tinyint(4) NOT NULL default '1',
`jail_osname` varchar(20) default NULL,
`delay_osname` varchar(20) default NULL,
`jail_osname` varchar(30) default NULL,
`delay_osname` varchar(30) default NULL,
`use_ipassign` tinyint(4) NOT NULL default '0',
`ipassign_args` varchar(255) default NULL,
`linktest_level` tinyint(4) NOT NULL default '0',
......@@ -1303,8 +1303,8 @@ CREATE TABLE `experiments` (
`usemodelnet` tinyint(1) NOT NULL default '0',
`modelnet_cores` tinyint(4) unsigned NOT NULL default '0',
`modelnet_edges` tinyint(4) unsigned NOT NULL default '0',
`modelnetcore_osname` varchar(20) default NULL,
`modelnetedge_osname` varchar(20) default NULL,
`modelnetcore_osname` varchar(30) default NULL,
`modelnetedge_osname` varchar(30) default NULL,
`elab_in_elab` tinyint(1) NOT NULL default '0',
`elabinelab_eid` varchar(32) default NULL,
`elabinelab_exptidx` int(11) default NULL,
......@@ -1766,6 +1766,8 @@ CREATE TABLE `images` (
`decryption_key` varchar(256) default NULL,
`hash` varchar(64) default NULL,
`locked` datetime default NULL,
`metadata_url` tinytext,
`imagefile_url` tinytext,
PRIMARY KEY (`imageid`),
UNIQUE KEY `pid` (`pid`,`imagename`),
KEY `gid` (`gid`),
......@@ -2890,7 +2892,7 @@ CREATE TABLE `os_boot_cmd` (
DROP TABLE IF EXISTS `os_info`;
CREATE TABLE `os_info` (
`osname` varchar(20) NOT NULL default '',
`osname` varchar(30) NOT NULL default '',
`pid` varchar(48) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`osid` int(8) unsigned NOT NULL default '0',
......
......@@ -1033,6 +1033,8 @@ REPLACE INTO table_regex VALUES ('images','mtype','text','redirect','default:boo
REPLACE INTO table_regex VALUES ('images','node_id','text','redirect','nodes:node_id',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','load_address','text','redirect','default:text',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','frisbee_pid','text','redirect','default:int',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','metadata_url','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','imagefile_url','text','redirect','default:tinytext',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','nodetype','text','redirect','node_types:node_type',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','OS','text','redirect','os_info:OS',0,0,NULL);
......@@ -1135,7 +1137,7 @@ REPLACE INTO table_regex VALUES ('virt_nodes','loadlist','text','regex','^[-\\w\
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);
REPLACE INTO table_regex VALUES ('os_info','osname','text','regex','^[-\\w\\.+]+$',2,20,NULL);
REPLACE INTO table_regex VALUES ('os_info','osname','text','regex','^[-\\w\\.+]+$',2,30,NULL);
REPLACE INTO table_regex VALUES ('os_info','description','text','redirect','default:fulltext',1,256,NULL);
REPLACE INTO table_regex VALUES ('os_info','OS','text','regex','^[-\\w]*$',1,32,NULL);
REPLACE INTO table_regex VALUES ('os_info','version','text','regex','^[-\\w\\.]*$',1,12,NULL);
......@@ -1147,6 +1149,7 @@ REPLACE INTO table_regex VALUES ('os_info','mustclean','int','redirect','default
REPLACE INTO table_regex VALUES ('os_info','osfeatures','text','regex','^[-\\w,]*$',1,128,NULL);
REPLACE INTO table_regex VALUES ('os_info','op_mode','text','regex','^[-\\w]*$',1,20,NULL);
REPLACE INTO table_regex VALUES ('os_info','nextosid','text','redirect','os_info:osid',0,0,NULL);
REPLACE INTO table_regex VALUES ('os_info','def_parentosid','text','redirect','os_info:osid',0,0,NULL);
REPLACE INTO table_regex VALUES ('os_info','reboot_waittime','int','redirect','default:int',0,2000,NULL);
REPLACE INTO table_regex VALUES ('sitevariables','name','text','regex','^[\\w\\/]+$',1,255,NULL);
......
#
# Add stuff to handle importing images from other locations.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("images", "metadata_url")) {
DBQueryFatal("alter table images add ".
" `metadata_url` tinytext");
}
if (!DBSlotExists("images", "imagefile_url")) {
DBQueryFatal("alter table images add ".
" `imagefile_url` tinytext");
}
my @slots = (["experiment_template_settings", "jail_osname"],
["experiment_template_settings", "delay_osname"],
["experiments", "jail_osname"],
["experiments", "delay_osname"],
["experiments", "modelnetcore_osname"],
["experiments", "modelnetedge_osname"],
);
foreach my $ref (@slots) {
my ($table, $slot) = @$ref;
my $type = DBSlotType($table, $slot);
if (! ($type =~ /30/)) {
DBQueryFatal("alter table $table".
" change `$slot` `$slot` varchar(30) default NULL");
}
}
my $type = DBSlotType("os_info", "osname");
if (! ($type =~ /30/)) {
DBQueryFatal("alter table os_info ".
" change `osname` `osname` ".
" varchar(30) NOT NULL default ''");
}
DBQueryFatal("REPLACE INTO table_regex VALUES ".
" ('os_info','osname','text','regex','^[-\\\\w\\\\.+]+\$',".
" 2,30,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
" ('os_info','def_parentosid','text','redirect',".
" 'os_info:osid',0,0,NULL)");
DBQueryFatal("alter table experiment_template_settings ".
" change `delay_osname` `delay_osname` varchar(30) default NULL");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
" ('images','metadata_url','text','redirect', ".
" 'default:tinytext',0,0,NULL)");
DBQueryFatal("REPLACE INTO table_regex VALUES ".
" ('images','imagefile_url','text','redirect', ".
" 'default:tinytext',0,0,NULL)");
return 0;
}
1;
# Local Variables:
# mode:perl
# End:
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