Commit 553a35a4 by Bach Dániel

storage: implement Disk.restore

requires storagedriver b599a0f
parent 0ac786b5
...@@ -380,11 +380,16 @@ class Disk(AclBase, TimeStampedModel): ...@@ -380,11 +380,16 @@ class Disk(AclBase, TimeStampedModel):
self.save() self.save()
return True return True
def restore(self, user=None, task_uuid=None): def restore(self, user=None, task_uuid=None, timeout=15):
"""Recover destroyed disk from trash if possible. """Recover destroyed disk from trash if possible.
""" """
# TODO queue_name = self.datastore.get_remote_queue_name(
pass 'storage', priority='slow')
logger.info("Image: %s at Datastore: %s recovered from trash." %
(self.filename, self.datastore.path))
storage_tasks.recover_from_trash.apply_async(
args=[self.datastore.path, self.filename],
queue=queue_name).get(timeout=timeout)
def save_as(self, user=None, task_uuid=None, timeout=300): def save_as(self, user=None, task_uuid=None, timeout=300):
"""Save VM as template. """Save VM as template.
......
...@@ -72,6 +72,9 @@ def make_free_space(datastore, percent): ...@@ -72,6 +72,9 @@ def make_free_space(datastore, percent):
def move_to_trash(datastore, disk_path): def move_to_trash(datastore, disk_path):
pass pass
@celery.task(name='storagedriver.recover_from_trash')
def recover_from_trash(datastore, disk_path):
pass
@celery.task(name='storagedriver.get_storage_stat') @celery.task(name='storagedriver.get_storage_stat')
def get_storage_stat(path): def get_storage_stat(path):
......
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