Commit e446488a authored by Leigh Stoller's avatar Leigh Stoller

Another checkpoint.

parent 48e85114
......@@ -619,7 +619,7 @@ sub NewVersion($$$$)
or goto bad;
DBQueryWarn("update $imtablename set ".
" uuid=uuid(),ready=0,path='$path', ".
" uuid=uuid(),ready=0,path='$path',released=0 ".
" $part_vers, default_vers='$clone_vers', ".
" version='$clone_vers',".
" created=now(), ".
......
......@@ -1954,6 +1954,7 @@ CREATE TABLE `image_versions` (
`noexport` tinyint(1) NOT NULL default '0',
`ready` tinyint(1) NOT NULL default '0',
`isdelta` tinyint(1) NOT NULL default '0',
`released` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`imageid`,`version`),
KEY `pid` (`pid`,`imagename`,`version`),
KEY `gid` (`gid`),
......
......@@ -64,6 +64,12 @@ sub DoUpdate($$$)
" `isdelta` tinyint(1) NOT NULL default '0' ".
" AFTER ready");
}
if (!DBSlotExists("image_versions", "released")) {
DBQueryFatal("ALTER TABLE image_versions ADD ".
" `released` tinyint(1) NOT NULL default '0' ".
" AFTER isdelta");
DBQueryFatal("update image_versions set released=1");
}
if (!DBTableExists("os_info_versions")) {
DBQueryFatal("rename table os_info to os_info_versions");
}
......
......@@ -224,7 +224,7 @@ if (defined($image)) {
my $needclone = 1;
#
# Does the most version in the table has its ready bit not set? If so
# Does the most version in the table not have its ready bit set? If so
# it means something went wrong with a previous image creation. We can
# reuse it, but reset the provenance just in case the node got reloaded.
#
......@@ -279,7 +279,7 @@ if (defined($image)) {
#
if ($image->path() =~ /^\/usr\/testbed/) {
my $path = $PROJROOT . "/" . $image->pid() . "/images/" .
basename($image->path()) . ":" . $image->version();
basename($image->path());
if ($image->Update({"path" => $path})) {
$image->DeleteVersion();
......
......@@ -122,8 +122,10 @@ class Image
" deleted is null ".
"order by version desc limit 1");
# If no unreleased version, just return $this. Might mean that
# provenance is not turned on for the project cause of a feature.
if (mysql_num_rows($query_result) == 0) {
return null;
return $this;
}
$row = mysql_fetch_array($query_result);
return Image::Lookup($imageid, $row["version"]);
......
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