Commit 83e4616c authored by Leigh Stoller's avatar Leigh Stoller

Add UUID (Universally Unique Identifiers) to various tables. I was

working on this a few weeks ago when I got sidetracked by the pubsub
project.
parent 5451c540
......@@ -339,6 +339,13 @@ sub Create($$$$)
}
}
# And a UUID (universally unique identifier).
my $uuid = NewUUID();
if (!defined($uuid)) {
print "*** WARNING: Could not generate a UUID!\n";
return undef;
}
#
# Insert the record. This reserves the pid/eid for us.
#
......@@ -360,7 +367,7 @@ sub Create($$$$)
# Append the rest
$query .= ",expt_created=FROM_UNIXTIME('$now')";
$query .= ",expt_locked=now(),pid='$pid',eid='$eid'";
$query .= ",expt_locked=now(),pid='$pid',eid='$eid',eid_uuid='$uuid'";
$query .= ",pid_idx='$pid_idx',gid='$gid',gid_idx='$gid_idx'";
$query .= ",expt_name=$description";
$query .= ",noswap_reason=$noswap_reason";
......@@ -396,11 +403,11 @@ sub Create($$$$)
#
if (! DBQueryWarn("insert into experiment_stats ".
"(eid, pid, creator, creator_idx, gid, created, ".
" batch, exptidx, rsrcidx, pid_idx, gid_idx) ".
" batch, exptidx, rsrcidx, pid_idx, gid_idx, eid_uuid) ".
"values('$eid', '$pid', '$creator_uid', '$creator_idx',".
" '$gid', FROM_UNIXTIME('$now'), ".
" $batchmode, $exptidx, $rsrcidx, ".
" $pid_idx, $gid_idx)")) {
" $pid_idx, $gid_idx, '$uuid')")) {
DBQueryWarn("delete from experiments where pid='$pid' and eid='$eid'");
DBQueryWarn("delete from experiment_resources where idx=$rsrcidx");
DBQueryWarn("unlock tables");
......
......@@ -284,6 +284,13 @@ sub Create($$$$$$)
}
}
# And a UUID (universally unique identifier).
my $uuid = NewUUID();
if (!defined($uuid)) {
print "*** WARNING: Could not generate a UUID!\n";
return undef;
}
if (!DBQueryWarn("insert into groups set ".
" pid='$pid', gid='$gid', ".
" leader='" . $leader->uid() . "'," .
......@@ -291,14 +298,16 @@ sub Create($$$$$$)
" created=now(), ".
" description='$description', ".
" unix_name='$unix_name', ".
" gid_uuid='$uuid', ".
" gid_idx=$gid_idx, ".
" pid_idx=$pid_idx, ".
" unix_gid=$unix_gid")) {
return undef;
}
if (! DBQueryWarn("insert into group_stats (pid, gid, gid_idx, pid_idx) ".
"values ('$pid', '$gid', $gid_idx, $pid_idx)")) {
if (! DBQueryWarn("insert into group_stats ".
" (pid, gid, gid_idx, pid_idx, gid_uuid) ".
"values ('$pid','$gid',$gid_idx,$pid_idx,'$uuid')")) {
DBQueryFatal("delete from groups where gid_idx='$gid_idx'");
return undef;
}
......
......@@ -406,6 +406,13 @@ sub Create($$$$)
# And a verification key.
my $verify_key = TBGenSecretKey();
# And a UUID (universally unique identifier).
my $uuid = NewUUID();
if (!defined($uuid)) {
print "*** WARNING: Could not generate a UUID!\n";
return undef;
}
# Now tack on other stuff we need.
push(@insert_data, "wikionly='1'")
if ($wikionly);
......@@ -417,6 +424,7 @@ sub Create($$$$)
push(@insert_data, "unix_uid=$unix_uid");
push(@insert_data, "mailman_password='$mailman_password'");
push(@insert_data, "verify_key='$verify_key'");
push(@insert_data, "uid_uuid='$uuid'");
push(@insert_data, "uid_idx='$uid_idx'");
push(@insert_data, "uid='$uid'");
......@@ -440,8 +448,8 @@ sub Create($$$$)
DBQueryWarn("insert into users set " . join(",", @insert_data))
or return undef;
if (! DBQueryWarn("insert into user_stats (uid, uid_idx) ".
"VALUES ('$uid', $uid_idx)")) {
if (! DBQueryWarn("insert into user_stats (uid, uid_idx, uid_uuid) ".
"VALUES ('$uid', $uid_idx, '$uuid')")) {
DBQueryFatal("delete from users where uid_idx='$uid_idx'");
return undef;
}
......
......@@ -108,7 +108,7 @@ my $create_string = ($query_result->fetchrow_array())[1];
# it simplifies backwards compatability.
#
DBQueryFatal("alter table temp_images ".
"drop pid_idx, drop gid_idx, drop creator_idx");
"drop pid_idx, drop gid_idx, drop creator_idx, drop uuid");
#
# Before we dump the table contents, reset a few things.
......@@ -174,7 +174,7 @@ $create_string = ($query_result->fetchrow_array())[1];
# it simplifies backwards compatability.
#
DBQueryFatal("alter table temp_os_info ".
"drop pid_idx, drop creator_idx");
"drop pid_idx, drop creator_idx, drop uuid");
#
# Before we dump the table contents, reset a few things.
......
......@@ -86,6 +86,7 @@ my $pid = $protoproj->pid();
my $pid_idx = $protoproj->pid_idx();
my $gid = $protoproj->gid();
my $gid_idx = $protoproj->gid_idx();
my $douuids = 0;
# Temp tables to hold new rows.
DBQueryFatal("create table temp_images like images");
......@@ -120,6 +121,9 @@ while (my $rowref = $describe_result->fetchrow_hashref()) {
elsif ($slot eq "creator_idx") {
DBQueryFatal("update temp_images set creator_idx='$user_idx'");
}
elsif ($slot eq "uuid") {
douuids++;
}
}
#
......@@ -160,6 +164,12 @@ while (my ($osid) = $query_result->fetchrow_array()) {
"where osid='$osid'");
DBQueryFatal("update temp_os_info set nextosid='$newosid' ".
"where nextosid='$osid'");
if ($uuids) {
my $uuid = NewUUID();
DBQueryFatal("update temp_os_info set uuid='$uuid' ".
"where nextosid='$osid'");
}
}
#
......@@ -187,6 +197,13 @@ while (my ($imageid) = $query_result->fetchrow_array()) {
DBQueryFatal("update temp_images set imageid='$newimageid' ".
"where imageid='$imageid'");
if ($uuids) {
my $uuid = NewUUID();
DBQueryFatal("update temp_images set uuid='$uuid' ".
"where imageid='$imageid'");
}
}
#
......
......@@ -562,6 +562,7 @@ CREATE TABLE `experiment_stats` (
`pid` varchar(12) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`eid` varchar(32) NOT NULL default '',
`eid_uuid` varchar(40) NOT NULL default '',
`creator` varchar(8) NOT NULL default '',
`creator_idx` mediumint(8) unsigned NOT NULL default '0',
`exptidx` int(10) unsigned NOT NULL default '0',
......@@ -590,7 +591,8 @@ CREATE TABLE `experiment_stats` (
`dpdbname` varchar(64) default NULL,
PRIMARY KEY (`exptidx`),
KEY `rsrcidx` (`rsrcidx`),
KEY `pideid` (`pid`,`eid`)
KEY `pideid` (`pid`,`eid`),
KEY `eid_uuid` (`eid_uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -860,6 +862,7 @@ CREATE TABLE `experiment_templates` (
DROP TABLE IF EXISTS `experiments`;
CREATE TABLE `experiments` (
`eid` varchar(32) NOT NULL default '',
`eid_uuid` varchar(40) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`pid` varchar(12) NOT NULL default '',
......@@ -953,7 +956,8 @@ CREATE TABLE `experiments` (
UNIQUE KEY `pideid` (`pid`,`eid`),
UNIQUE KEY `pididxeid` (`pid_idx`,`eid`),
KEY `batchmode` (`batchmode`),
KEY `state` (`state`)
KEY `state` (`state`),
KEY `eid_uuid` (`eid_uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -1131,6 +1135,7 @@ CREATE TABLE `group_stats` (
`gid` varchar(12) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid_uuid` varchar(40) NOT NULL default '',
`exptstart_count` int(11) unsigned default '0',
`exptstart_last` datetime default NULL,
`exptpreload_count` int(11) unsigned default '0',
......@@ -1148,7 +1153,8 @@ CREATE TABLE `group_stats` (
`allexpt_pnodes` int(11) unsigned default '0',
`allexpt_pnode_duration` int(11) unsigned default '0',
PRIMARY KEY (`gid_idx`),
UNIQUE KEY `pidgid` (`pid`,`gid`)
UNIQUE KEY `pidgid` (`pid`,`gid`),
KEY `gid_uuid` (`gid_uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -1161,6 +1167,7 @@ CREATE TABLE `groups` (
`gid` varchar(12) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid_idx` mediumint(8) unsigned NOT NULL default '0',
`gid_uuid` varchar(40) NOT NULL default '',
`leader` varchar(8) NOT NULL default '',
`leader_idx` mediumint(8) unsigned NOT NULL default '0',
`created` datetime default NULL,
......@@ -1176,7 +1183,8 @@ CREATE TABLE `groups` (
KEY `unix_gid` (`unix_gid`),
KEY `gid` (`gid`),
KEY `pid` (`pid`),
KEY `pididx` (`pid_idx`,`gid_idx`)
KEY `pididx` (`pid_idx`,`gid_idx`),
KEY `gid_uuid` (`gid_uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -1196,7 +1204,7 @@ CREATE TABLE `iface_counters` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `images `
-- Table structure for table `images`
--
DROP TABLE IF EXISTS `images`;
......@@ -1207,6 +1215,7 @@ CREATE TABLE `images` (
`pid` varchar(12) NOT NULL default '',
`gid` varchar(12) NOT NULL default '',
`imageid` int(8) unsigned NOT NULL default '0',
`uuid` varchar(40) NOT NULL default '',
`old_imageid` varchar(45) NOT NULL default '',
`creator` varchar(8) default NULL,
`creator_idx` mediumint(8) unsigned NOT NULL default '0',
......@@ -1231,7 +1240,8 @@ CREATE TABLE `images` (
PRIMARY KEY (`imageid`),
UNIQUE KEY `pid` (`pid`,`imagename`),
KEY `gid` (`gid`),
KEY `old_imageid` (`old_imageid`)
KEY `old_imageid` (`old_imageid`),
KEY `uuid` (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -2070,6 +2080,7 @@ CREATE TABLE `os_info` (
`pid` varchar(12) NOT NULL default '',
`pid_idx` mediumint(8) unsigned NOT NULL default '0',
`osid` int(8) unsigned NOT NULL default '0',
`uuid` varchar(40) NOT NULL default '',
`old_osid` varchar(35) NOT NULL default '',
`creator` varchar(8) default NULL,
`creator_idx` mediumint(8) unsigned NOT NULL default '0',
......@@ -2094,7 +2105,8 @@ CREATE TABLE `os_info` (
UNIQUE KEY `pid` (`pid`,`osname`),
KEY `OS` (`OS`),
KEY `path` (`path`(255)),
KEY `old_osid` (`old_osid`)
KEY `old_osid` (`old_osid`),
KEY `uuid` (`uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -2850,6 +2862,7 @@ DROP TABLE IF EXISTS `user_stats`;
CREATE TABLE `user_stats` (
`uid` varchar(8) NOT NULL default '',
`uid_idx` mediumint(8) unsigned NOT NULL default '0',
`uid_uuid` varchar(40) NOT NULL default '',
`weblogin_count` int(11) unsigned default '0',
`weblogin_last` datetime default NULL,
`exptstart_count` int(11) unsigned default '0',
......@@ -2868,7 +2881,8 @@ CREATE TABLE `user_stats` (
`allexpt_vnode_duration` int(11) unsigned default '0',
`allexpt_pnodes` int(11) unsigned default '0',
`allexpt_pnode_duration` int(11) unsigned default '0',
PRIMARY KEY (`uid_idx`)
PRIMARY KEY (`uid_idx`),
KEY `uid_uuid` (`uid_uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -2879,6 +2893,7 @@ DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`uid` varchar(8) NOT NULL default '',
`uid_idx` mediumint(8) unsigned NOT NULL default '0',
`uid_uuid` varchar(40) NOT NULL default '',
`usr_created` datetime default NULL,
`usr_expires` datetime default NULL,
`usr_modified` datetime default NULL,
......@@ -2926,7 +2941,8 @@ CREATE TABLE `users` (
PRIMARY KEY (`uid_idx`),
UNIQUE KEY `uid` (`uid`),
KEY `unix_uid` (`unix_uid`),
KEY `status` (`status`)
KEY `status` (`status`),
KEY `uid_uuid` (`uid_uuid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......
......@@ -3971,3 +3971,10 @@ last_net_act,last_cpu_act,last_ext_act);
alter table plab_slices add
`slicemeta_legacy` text
after slicemeta;
4.119: Add UUIDs to lots of tables.
All of the sql changes are made in the following script:
./step5_newids.pl
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use lib "/usr/testbed/lib";
use libdb;
use libtestbed;
#
# Untaint the path
#
$ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
#
# See if a table has been changed by looking for the existence of a field.
#
sub TableChanged($$)
{
my ($table, $slot) = @_;
my $describe_result =
DBQueryFatal("describe $table $slot");
return $describe_result->numrows;
}
# users
DBQueryFatal("lock tables users write, user_stats write");
if (! TableChanged("users", "uid_uuid")) {
DBQueryFatal("alter table users ".
"add `uid_uuid` varchar(40) NOT NULL default '' after uid_idx, ".
"add KEY uid_uuid (`uid_uuid`)");
}
if (! TableChanged("user_stats", "uid_uuid")) {
DBQueryFatal("alter table user_stats ".
"add `uid_uuid` varchar(40) NOT NULL default '' after uid_idx, ".
"add KEY uid_uuid (`uid_uuid`)");
}
my $query_result = DBQueryFatal("select uid_idx from users ".
"where uid_uuid=''");
while (my ($uid_idx) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for user: $uid_idx\n");
}
DBQueryFatal("update users set uid_uuid='$uuid' where uid_idx='$uid_idx'");
DBQueryFatal("update user_stats set uid_uuid='$uuid' ".
"where uid_idx='$uid_idx'");
select(undef, undef, undef, 0.02);
}
$query_result = DBQueryFatal("select uid_idx from user_stats ".
"where uid_uuid=''");
while (my ($uid_idx) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for user: $uid_idx\n");
}
DBQueryFatal("update user_stats set uid_uuid='$uuid' ".
"where uid_idx='$uid_idx'");
select(undef, undef, undef, 0.02);
}
DBQueryFatal("unlock tables");
# groups (no point in doing the project).
DBQueryFatal("lock tables groups write, group_stats write");
if (! TableChanged("groups", "gid_uuid")) {
DBQueryFatal("alter table groups ".
"add `gid_uuid` varchar(40) NOT NULL default '' after gid_idx, ".
"add KEY gid_uuid (`gid_uuid`)");
}
if (! TableChanged("group_stats", "gid_uuid")) {
DBQueryFatal("alter table group_stats ".
"add `gid_uuid` varchar(40) NOT NULL default '' after gid_idx, ".
"add KEY gid_uuid (`gid_uuid`)");
}
$query_result = DBQueryFatal("select gid_idx from groups ".
"where gid_uuid=''");
while (my ($gid_idx) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for group: $gid_idx\n");
}
DBQueryFatal("update groups set gid_uuid='$uuid' ".
"where gid_idx='$gid_idx'");
DBQueryFatal("update group_stats set gid_uuid='$uuid' ".
"where gid_idx='$gid_idx'");
select(undef, undef, undef, 0.02);
}
$query_result = DBQueryFatal("select gid_idx from group_stats ".
"where gid_uuid=''");
while (my ($gid_idx) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for group: $gid_idx\n");
}
DBQueryFatal("update group_stats set gid_uuid='$uuid' ".
"where gid_idx='$gid_idx'");
select(undef, undef, undef, 0.02);
}
DBQueryFatal("unlock tables");
# experiments
DBQueryFatal("lock tables experiments write, experiment_stats write");
if (! TableChanged("experiments", "eid_uuid")) {
DBQueryFatal("alter table experiments ".
"add `eid_uuid` varchar(40) NOT NULL default '' after eid, ".
"add KEY eid_uuid (`eid_uuid`)");
}
if (! TableChanged("experiment_stats", "eid_uuid")) {
DBQueryFatal("alter table experiment_stats ".
"add `eid_uuid` varchar(40) NOT NULL default '' after eid, ".
"add KEY eid_uuid (`eid_uuid`)");
}
$query_result = DBQueryFatal("select idx from experiments ".
"where eid_uuid=''");
while (my ($exptidx) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for exptidx: $exptidx\n");
}
DBQueryFatal("update experiments set eid_uuid='$uuid' ".
"where idx='$exptidx'");
DBQueryFatal("update experiment_stats set eid_uuid='$uuid' ".
"where exptidx='$exptidx'");
select(undef, undef, undef, 0.02);
}
$query_result = DBQueryFatal("select exptidx from experiment_stats ".
"where eid_uuid=''");
while (my ($exptidx) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for exptidx: $exptidx\n");
}
DBQueryFatal("update experiment_stats set eid_uuid='$uuid' ".
"where exptidx='$exptidx'");
select(undef, undef, undef, 0.02);
}
DBQueryFatal("unlock tables");
# images
DBQueryFatal("lock tables images write");
if (! TableChanged("images", "uuid")) {
DBQueryFatal("alter table images ".
"add `uuid` varchar(40) NOT NULL default '' after imageid, ".
"add KEY uuid (`uuid`)");
}
$query_result = DBQueryFatal("select imageid from images where uuid=''");
while (my ($imageid) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for imageid: $imageid\n");
}
DBQueryFatal("update images set uuid='$uuid' ".
"where imageid='$imageid'");
select(undef, undef, undef, 0.02);
}
DBQueryFatal("unlock tables");
# os_info
DBQueryFatal("lock tables os_info write");
if (! TableChanged("os_info", "uuid")) {
DBQueryFatal("alter table os_info ".
"add `uuid` varchar(40) NOT NULL default '' after osid, ".
"add KEY uuid (`uuid`)");
}
$query_result = DBQueryFatal("select osid from os_info where uuid=''");
while (my ($osid) = $query_result->fetchrow_array()) {
my $uuid = NewUUID();
if (!defined($uuid)) {
die("*** $0:\n".
" Could not generate a UUID for osid: $osid\n");
}
DBQueryFatal("update os_info set uuid='$uuid' ".
"where osid='$osid'");
select(undef, undef, undef, 0.02);
}
DBQueryFatal("unlock tables");
......@@ -39,6 +39,8 @@ my $batchmode = 0;
my $pid_idx = 1; # Initial IDX for protoproj.
my $trust = "project_root";
my $binshell = "/bin/nologin";
my $uid_uuid;
my $gid_uuid;
my $password;
my $encpass;
my %opts;
......@@ -177,20 +179,25 @@ if ($CONTROL ne $BOSSNODE) {
}
}
# These users do not really need a uuid, but give them one anyway.
$uid_uuid = NewUUID();
# Initialize the index value;
DBQueryFatal("replace into emulab_indicies set name='next_uid',idx=$uid+1");
print "Creating user in database...\n";
DBQueryFatal("insert into users set uid='$protouser', usr_created=now(), " .
"usr_name='$protouser_name', ".
"usr_name='$protouser_name', uid_uuid='$uid_uuid', ".
"usr_addr='DO NOT DELETE THIS ACCOUNT', ".
"usr_pswd='$encpass', unix_uid=$uid, notes='$protouser_notes', ".
"usr_modified=now(), admin=1, webonly=0, status='active',".
"usr_shell='$protouser_shell', usr_email='$protouser_email', ".
"mailman_password='$mailman_password',uid_idx=$uid");
DBQueryFatal("insert into user_stats set uid='$protouser',uid_idx=$uid");
DBQueryFatal("insert into user_stats set ".
" uid='$protouser', uid_idx=$uid, uid_uuid='$uid_uuid'");
if (!defined($opts{u})) {
$gid_uuid = NewUUID();
print "Creating project in database...\n";
DBQueryFatal("insert into projects set pid='$protoproj', created=now(), " .
......@@ -204,9 +211,10 @@ if (!defined($opts{u})) {
"leader='$protouser', leader_idx=$uid, created=now(), ".
"description='Default Group', " .
"unix_gid=$gid, gid_idx=$pid_idx, pid_idx=$pid_idx, ".
"unix_name='$protoproj'");
"unix_name='$protoproj', gid_uuid='$gid_uuid'");
DBQueryFatal("insert into group_stats set ".
"pid='$protoproj',gid='$protoproj',gid_idx=$pid_idx");
" pid='$protoproj',gid='$protoproj', ".
" gid_idx=$pid_idx, gid_uuid='$gid_uuid'");
DBQueryFatal("replace into emulab_indicies set name='next_gid',idx=10000");
}
......
......@@ -66,6 +66,7 @@ $TBLIBEXEC_DIR = "$TBDIR"."libexec/";
$TBSUEXEC_PATH = "$TBLIBEXEC_DIR/suexec";
$TBCHKPASS_PATH = "$TBLIBEXEC_DIR/checkpass";
$TBCSLOGINS = "$TBETC_DIR/cslogins";
$UUIDGEN_PATH = "/usr/bin/uuidgen";
#
# Hardcoded check against $WWWHOST, to prevent anyone from accidentally setting
......@@ -415,6 +416,21 @@ function CHECKPASSWORD($uid, $password, $name, $email, &$error)
"$TBCHKPASS_PATH $password $uid '$name:$email'", 1);
}
#
# Grab a UUID (universally unique identifier).
#
function NewUUID()
{
global $UUIDGEN_PATH;
$uuid = shell_exec($UUIDGEN_PATH);
if (isset($uuid) && $uuid != "") {
return rtrim($uuid);
}
TBERROR("$UUIDGEN_PATH Failure", 1);
}
function LASTNODELOGIN($node)
{
}
......
......@@ -204,6 +204,7 @@ class Experiment
function gid() { return $this->field('gid'); }
function eid() { return $this->field('eid'); }
function idx() { return $this->field('idx'); }
function uuid() { return $this->field('eid_uuid'); }
function description() { return $this->field('expt_name'); }
function path() { return $this->field('path'); }
function state() { return $this->field('state'); }
......@@ -609,6 +610,7 @@ class Experiment
$dpdb = $exprow["dpdb"];
$dpdbname = $exprow["dpdbname"];
$dpdbpassword= $exprow["dpdbpassword"];
$uuid = $exprow["eid_uuid"];
$autoswap_hrs= ($autoswap_timeout/60.0);
$idleswap_hrs= ($idleswap_timeout/60.0);
......@@ -913,6 +915,12 @@ class Experiment
}
if (!$short) {
if (ISADMIN()) {
echo "<tr>
<td>UUID: </td>
<td class=left>$uuid</td>
</tr>\n";
}
if ($usemodelnet) {
echo "<tr>
<td>Use Modelnet: </td>
......
......@@ -300,6 +300,7 @@ class Group
function gid() { return $this->field("gid"); }
function pid_idx() { return $this->field("pid_idx"); }
function gid_idx() { return $this->field("gid_idx"); }
function uuid() { return $this->field("gid_uuid"); }
function leader() { return $this->field("leader"); }
function leader_idx() { return $this->field("leader_idx"); }
function created() { return $this->field("created"); }
......@@ -345,6 +346,7 @@ class Group
$pid = $project->pid();
$pid_idx = $project->pid_idx();
}
$uuid = NewUUID();
# Get me an unused unix id. Nice query, eh? Basically, find
# unused numbers by looking at existing numbers plus one, and check
......@@ -371,14 +373,17 @@ class Group
" created=now(), ".
" description='$description', ".
" unix_name='$unix_name', ".
" gid_uuid='$uuid', ".
" gid_idx=$gid_idx, ".
" pid_idx=$pid_idx, ".
" unix_gid=$unix_gid")) {
return null;
}
if (! DBQueryWarn("insert into group_stats (pid,gid,gid_idx,pid_idx) ".
"values ('$pid', '$gid', $gid_idx, $pid_idx)")) {
if (! DBQueryWarn("insert into group_stats ".
" (pid,gid,gid_idx,pid_idx,gid_uuid) ".
"values ('$pid', '$gid', $gid_idx, ".
" $pid_idx, '$uuid')")) {
DBQueryFatal("delete from groups where gid_idx='$gid_idx'");
return null;
}
......@@ -835,6 +840,7 @@ class Group
$expt_last = $this->expt_last();
$unix_gid = $this->unix_gid();
$unix_name = $this->unix_name();
$uuid = $this->uuid();
if ($this->IsProjectGroup())
$mail = "$pid" . "-users@" . $OURDOMAIN;
......@@ -906,6 +912,13 @@ class Group
</tr>\n";
}
if (ISADMIN()) {
echo "<tr>
<td>UUID: </td>
<td class=left>$uuid</td>
</tr>\n";
}
echo "<tr>
<td>Created: </td>
<td class=\"left\">$created</td>
......
......@@ -123,6 +123,7 @@ class Image
function pid() { return $this->field("pid"); }
function gid() { return $this->field("gid"); }
function imageid() { return $this->field("imageid"); }
function uuid() { return $this->field("uuid"); }
function creator() { return $this->field("creator"); }
function creator_idx() { return $this->field("creator_idx"); }
function created() { return $this->field("created"); }
......@@ -230,6 +231,7 @@ class Image
$globalid = $this->isglobal();
$creator = $this->creator();
$created = $this->created();
$uuid = $this->uuid();
if (!$description)
$description = "&nbsp;";
......@@ -381,6 +383,11 @@ class Image
<td class=left>$imageid</td>
</tr>\n";
echo "<tr>
<td>UUID: </td>
<td class=left>$uuid</td>
</tr>\n";
echo "<tr>
<td>Load Address: </td>
<td class=left>\n";
......
......@@ -793,6 +793,7 @@ $path = $formfields["path"];
# Grab unique imageid (before locking tables).
#
$imageid = TBGetUniqueIndex("next_osid");
$uuid = NewUUID();
#
# And insert the record!
......@@ -885,13 +886,14 @@ $query_result =
"(imagename, imageid, description, loadpart, loadlength, ".
" part1_osid, part2_osid, part3_osid, part4_osid, ".
" default_osid, path, pid, gid, shared, global, ".
" creator, creator_idx, created, pid_idx, gid_idx) ".
" creator, creator_idx, created, pid_idx, gid_idx, uuid) ".
"VALUES ".
" ('$imagename', '$imageid', '$description', $loadpart, ".
" $loadlength, ".
" $part1_osid, $part2_osid, $part3_osid, $part4_osid, ".
" '$default_osid', '$path', '$pid', '$gid', $shared, ".
" $global, '$uid', '$dbid', now(), $pid_idx, $gid_idx)");
" $global, '$uid', '$dbid', now(), $pid_idx, $gid_idx, ".
" '$uuid')");
if (!$isadmin || $makedefault) {
for ($i = 0; $i < count($mtypes_array); $i++) {
......