Commit 1ffbbcfd authored by Leigh B Stoller's avatar Leigh B Stoller

Add slots to apt_instances and apt_instance_history, to store the params

and rspec that are used. This is to support Parameterized Profiles, where
the rspec is generated from a geni-lib script and user defined parameters.

Add manifest to apt_instance_history; I was not storing the manifest cause
I figured we could just ask the backend cluster for it. Well, that is kinda
silly, so lets store it locally. I'll have to go back and grab the
manifests for the current history entries.

Add isaptkey to user_pubkeys so that we can mark the key that comes in from
the instantiate page. This lets us keep the Emulab keys for a user
independent of the APT key, so that APT users only deal with a single key
on that path, without messing up their Emulab keys.
parent 5fdd699f
......@@ -345,7 +345,8 @@ sub RecordHistory($)
DBQueryWarn("replace into apt_instance_history ".
"select uuid,profile_id,profile_version,slice_uuid, ".
" creator,creator_idx,creator_uuid,aggregate_urn, ".
" public_url,created,now(),servername ".
" public_url,created,now(),servername, ".
" rspec,params,manifest ".
" from apt_instances where uuid='$uuid'")
or return -1;
......
......@@ -104,6 +104,9 @@ CREATE TABLE `apt_instance_history` (
`created` datetime default NULL,
`destroyed` datetime default NULL,
`servername` tinytext,
`rspec` mediumtext,
`params` mediumtext,
`manifest` mediumtext,
PRIMARY KEY (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -127,6 +130,8 @@ CREATE TABLE `apt_instances` (
`extension_code` varchar(32) default NULL,
`extension_reason` mediumtext,
`servername` tinytext,
`rspec` mediumtext,
`params` mediumtext,
`manifest` mediumtext,
PRIMARY KEY (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
......@@ -152,6 +157,7 @@ CREATE TABLE `apt_profile_versions` (
`status` varchar(32) default NULL,
`rspec` mediumtext,
`script` mediumtext,
`paramdefs` mediumtext,
PRIMARY KEY (`profileid`,`version`),
UNIQUE KEY `pidname` (`pid_idx`,`name`,`version`),
UNIQUE KEY `uuid` (`uuid`)
......@@ -4482,6 +4488,7 @@ CREATE TABLE `user_pubkeys` (
`idx` int(10) unsigned NOT NULL auto_increment,
`internal` tinyint(1) NOT NULL default '0',
`nodelete` tinyint(1) NOT NULL default '0',
`isaptkey` tinyint(1) NOT NULL default '0',
`pubkey` text,
`stamp` datetime default NULL,
`comment` varchar(128) NOT NULL default '',
......
......@@ -1280,7 +1280,7 @@ REPLACE INTO table_regex VALUES ('default','fulltext_utf8','text','regex','^(?:[
REPLACE INTO table_regex VALUES ('apt_profiles','pid','text','redirect','projects:pid',0,0,NULL);
REPLACE INTO table_regex VALUES ('apt_profiles','creator','text','redirect','users:uid',0,0,NULL);
REPLACE INTO table_regex VALUES ('apt_profiles','name','text','redirect','images:imagename',0,64,NULL);
REPLACE INTO table_regex VALUES ('apt_profiles','name','text','redirect','images:imagename',0,0,NULL);
REPLACE INTO table_regex VALUES ('apt_profiles','public','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('apt_profiles','listed','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('apt_profiles','shared','int','redirect','default:boolean',0,0,NULL);
......
#
# Modify APT instances table.
#
use strict;
use libdb;
sub DoUpdate($$$)
{
my ($dbhandle, $dbname, $version) = @_;
if (!DBSlotExists("apt_profile_versions", "paramdefs")) {
DBQueryFatal("alter table apt_profile_versions add ".
" `paramdefs` mediumtext after script");
}
if (!DBSlotExists("apt_instances", "rspec")) {
DBQueryFatal("alter table apt_instances add ".
" `rspec` mediumtext after servername");
}
if (!DBSlotExists("apt_instances", "params")) {
DBQueryFatal("alter table apt_instances add ".
" `params` mediumtext after rspec");
}
if (!DBSlotExists("apt_instance_history", "rspec")) {
DBQueryFatal("alter table apt_instance_history add ".
" `rspec` mediumtext after servername");
}
if (!DBSlotExists("apt_instance_history", "params")) {
DBQueryFatal("alter table apt_instance_history add ".
" `params` mediumtext after rspec");
}
if (!DBSlotExists("apt_instance_history", "manifest")) {
DBQueryFatal("alter table apt_instance_history add ".
" `manifest` mediumtext after params");
}
if (!DBSlotExists("user_pubkeys", "isaptkey")) {
DBQueryFatal("alter table user_pubkeys add ".
" `isaptkey` tinyint(1) NOT NULL default '0' ".
" after nodelete");
}
DBQueryFatal("REPLACE INTO table_regex VALUES ".
" ('apt_profiles','name','text','redirect', ".
" 'images:imagename',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