Commit f8eb994c by Guba Sándor

save is_ready on template saving

parent e6afebb0
...@@ -342,6 +342,8 @@ class Disk(TimeStampedModel): ...@@ -342,6 +342,8 @@ class Disk(TimeStampedModel):
if self.is_ready: if self.is_ready:
return True return True
if self.base and not self.base.is_ready:
raise self.DiskIsNotReady(self, base=self.base)
queue_name = self.get_remote_queue_name('storage', priority="fast") queue_name = self.get_remote_queue_name('storage', priority="fast")
disk_desc = self.get_disk_desc() disk_desc = self.get_disk_desc()
if self.base is not None: if self.base is not None:
...@@ -462,7 +464,7 @@ class Disk(TimeStampedModel): ...@@ -462,7 +464,7 @@ class Disk(TimeStampedModel):
disk = Disk.create(datastore=self.datastore, disk = Disk.create(datastore=self.datastore,
base=new_base, base=new_base,
name=self.name, size=self.size, name=self.name, size=self.size,
type=new_type) type=new_type, dev_num=self.dev_num)
queue_name = self.get_remote_queue_name("storage", priority="slow") queue_name = self.get_remote_queue_name("storage", priority="slow")
remote = storage_tasks.merge.apply_async(kwargs={ remote = storage_tasks.merge.apply_async(kwargs={
...@@ -479,4 +481,6 @@ class Disk(TimeStampedModel): ...@@ -479,4 +481,6 @@ class Disk(TimeStampedModel):
AbortableAsyncResult(remote.id).abort() AbortableAsyncResult(remote.id).abort()
disk.destroy() disk.destroy()
raise Exception("Save as aborted by use.") raise Exception("Save as aborted by use.")
disk.is_ready = True
disk.save()
return disk return disk
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 sign in to comment