Commit 32c390c1 by Bach Dániel

vm: reenable node if flush fails

parent cce7935c
......@@ -148,10 +148,14 @@ class Node(OperatedMixin, TimeStampedModel):
self.enabled = False
def enable(self, user=None):
def enable(self, user=None, base_activity=None):
''' Enable the node. '''
if self.enabled is not True:
with node_activity(code_suffix='enable', node=self, user=user):
if base_activity:
act_ctx = base_activity.sub_activity('enable')
act_ctx = node_activity('enable', node=self, user=user)
with act_ctx:
self.enabled = True
......@@ -594,7 +594,14 @@ class FlushOperation(NodeOperation):
name = _("flush")
description = _("Disable node and move all instances to other ones.")
def on_abort(self, activity, error):
from manager.scheduler import TraitsUnsatisfiableException
if isinstance(error, TraitsUnsatisfiableException):
if self.node_enabled:
self.node.enable(activity.user, activity)
def _operation(self, activity, user):
self.node_enabled = self.node.enabled
self.node.disable(user, activity)
for i in self.node.instance_set.all():
with activity.sub_activity('migrate_instance_%d' %
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