Commit 6546b21c authored by Leigh B Stoller's avatar Leigh B Stoller

Ack, got predicate wrong, broke snapshots.

parent 5b5a8834
...@@ -585,9 +585,10 @@ sub Refresh($) ...@@ -585,9 +585,10 @@ sub Refresh($)
my $imageid = $self->imageid(); my $imageid = $self->imageid();
my $version = $self->version(); my $version = $self->version();
my $query_result = my $query_result =
DBQueryWarn("select v.*,i.uuid as image_uuid,i.locked,i.locker_pid ". DBQueryWarn("select i.*,v.*,i.uuid as image_uuid, ".
" i.metadata_url as image_metadata_url ".
" from image_versions as v ". " from image_versions as v ".
"left join images as i on ". "left join images as i on ".
" v.imageid=i.imageid ". " v.imageid=i.imageid ".
...@@ -826,11 +827,22 @@ sub NewVersion($$$$) ...@@ -826,11 +827,22 @@ sub NewVersion($$$$)
my $ostablename = "os_info_versions" . $tableid; my $ostablename = "os_info_versions" . $tableid;
my $imtablename = "image_versions" . $tableid; my $imtablename = "image_versions" . $tableid;
if ($self->IsNewest()) { #
# This should not happen but lets make sure.
#
if (defined($self->deleted())) {
print STDERR "Not allowed to clone deleted image $self\n";
return undef;
}
#
# We should always be called with the latest version. $baseimage is
# what we are actually basing the new image on.
#
if (!$self->IsNewest()) {
print STDERR "Image::NewVersion: $self is not the head version\n"; print STDERR "Image::NewVersion: $self is not the head version\n";
return undef; return undef;
} }
# #
# Grab the current type list. Do this before table locking. # Grab the current type list. Do this before table locking.
# #
...@@ -2593,9 +2605,8 @@ sub SchedIMSDeletion($) ...@@ -2593,9 +2605,8 @@ sub SchedIMSDeletion($)
# #
sub IsNewest($) sub IsNewest($)
{ {
my ($self) = @_; my ($self) = @_;
my $imageid = $self->imageid();
my $imageid = $self->pid();
my $query_result = my $query_result =
DBQueryWarn("select max(version) from image_versions ". DBQueryWarn("select max(version) from image_versions ".
......
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