Commit 94adcc77 by Dudás Ádám

storage: utilize destroyed flag

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