Commit 94adcc77 by Dudás Ádám

storage: utilize destroyed flag

parent 703a3fe0
......@@ -161,6 +161,10 @@ class Disk(TimeStampedModel):
otherwise, False.
:rtype: bool
"""
if self.destroyed:
self.destroyed = None
self.save()
if self.ready:
return False
......@@ -191,10 +195,15 @@ class Disk(TimeStampedModel):
queue="localhost.man")
def destroy(self, user=None, task_uuid=None):
if self.destroyed:
return False
# TODO add activity logging
self.destroyed = timezone.now()
self.save()
return True
def destroy_async(self, user=None):
local_tasks.destroy.apply_async(args=[self, user],
queue='localhost.man')
......
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