Commit 6c738666 by Dudás Ádám

storage: add return value for deploy

parent 2b355902
...@@ -102,8 +102,17 @@ class Disk(TimeStampedModel): ...@@ -102,8 +102,17 @@ class Disk(TimeStampedModel):
manager.storage.deploy.apply_async(self) manager.storage.deploy.apply_async(self)
def deploy(self): def deploy(self):
"""Reify the disk model on the associated data store.
:param self: the disk model to reify
:type self: storage.models.Disk
:return: True if a new reification of the disk has been created;
otherwise, False.
:rtype: bool
"""
if self.ready: if self.ready:
return return False
disk_desc = { disk_desc = {
'name': self.name, 'name': self.name,
...@@ -116,6 +125,7 @@ class Disk(TimeStampedModel): ...@@ -116,6 +125,7 @@ class Disk(TimeStampedModel):
tasks.create_disk.delay(disk_desc).get() tasks.create_disk.delay(disk_desc).get()
self.ready = True self.ready = True
self.save() self.save()
return True
@classmethod @classmethod
def delete_signal(cls, sender, instance, using, **kwargs): def delete_signal(cls, sender, instance, using, **kwargs):
......
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