Commit 39f2c65c by Őry Máté

vm: fix local_tasks.flush

* accept uuid
* call the correct method
parent 039bcad8
...@@ -101,10 +101,11 @@ class Node(TimeStampedModel): ...@@ -101,10 +101,11 @@ class Node(TimeStampedModel):
self.enabled = False self.enabled = False
self.save() self.save()
def flush(self, user=None): def flush(self, user=None, task_uuid=None):
"""Disable node and move all instances to other ones. """Disable node and move all instances to other ones.
""" """
with node_activity('flush', node=self, user=user) as act: with node_activity('flush', node=self, user=user,
task_uuid=task_uuid) as act:
self.disable(user, act) self.disable(user, act)
for i in self.instance_set.all(): for i in self.instance_set.all():
with act.sub_activity('migrate_instance_%d' % i.pk): with act.sub_activity('migrate_instance_%d' % i.pk):
......
...@@ -61,4 +61,4 @@ def migrate(instance, to_node, user): ...@@ -61,4 +61,4 @@ def migrate(instance, to_node, user):
@celery.task @celery.task
def flush(node, user): def flush(node, user):
node.migrate(task_uuid=flush.request.id, user=user) node.flush(task_uuid=flush.request.id, user=user)
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