Commit 5652a625 by Guba Sándor

storage: fixed ready and added failed property

parent f165822b
...@@ -123,8 +123,18 @@ class Disk(AclBase, TimeStampedModel): ...@@ -123,8 +123,18 @@ class Disk(AclBase, TimeStampedModel):
@property @property
def ready(self): def ready(self):
""" Returns True if the disk is physically ready on the storage.
It needs at least 1 successfull deploy action.
"""
return self.activity_log.filter(activity_code__endswith="deploy", return self.activity_log.filter(activity_code__endswith="deploy",
succeeded__isnull=False) succeeded=True)
@property
def failed(self):
""" Returns True if the last activity on the disk is failed.
"""
return not self.activity_log.all().order_by('-id')[0].succeeded
@property @property
def path(self): def path(self):
......
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