Commit 1e4c94ea by Bach Dániel

dashboard: add reset_node option to VmStateChangeForm

parent 8f6b93ba
......@@ -752,6 +752,7 @@ class VmStateChangeForm(forms.Form):
"but don't interrupt any tasks."))
new_state = forms.ChoiceField(Instance.STATUS, label=_(
"New status"))
reset_node = forms.BooleanField(required=False, label=_("Reset node"))
def __init__(self, *args, **kwargs):
show_interrupt = kwargs.pop('show_interrupt')
......@@ -811,7 +811,8 @@ class ChangeStateOperation(InstanceOperation):
required_perms = ('vm.emergency_change_state', )
concurrency_check = False
def _operation(self, user, activity, new_state="NOSTATE", interrupt=False):
def _operation(self, user, activity, new_state="NOSTATE", interrupt=False,
activity.resultant_state = new_state
if interrupt:
msg_txt = ugettext_noop("Activity is forcibly interrupted.")
......@@ -821,6 +822,10 @@ class ChangeStateOperation(InstanceOperation):
i.finish(False, result=message)
logger.error('Forced finishing activity %s', i)
if reset_node:
self.instance.node = None
class NodeOperation(Operation):
async_operation = abortable_async_node_operation
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