Commit 8f58c693 by Guba Sándor

node: added activity to enable and disable

parent 8e1889e5
...@@ -16,6 +16,8 @@ from firewall.models import Host ...@@ -16,6 +16,8 @@ from firewall.models import Host
from ..tasks import vm_tasks from ..tasks import vm_tasks
from .common import Trait from .common import Trait
from .activity import node_activity
from monitor.calvin.calvin import Query from monitor.calvin.calvin import Query
from monitor.calvin.calvin import GraphiteHandler from monitor.calvin.calvin import GraphiteHandler
...@@ -79,6 +81,19 @@ class Node(TimeStampedModel): ...@@ -79,6 +81,19 @@ class Node(TimeStampedModel):
return 'disabled' return 'disabled'
else: else:
return 'offline' return 'offline'
return 'Offline'
def disable(self, user=None):
''' Disable the node.'''
with node_activity(code_suffix='disable', node=self, user=user):
self.enabled = False
self.save()
def enable(self, user=None):
''' Enable the node. '''
with node_activity(code_suffix='enable', node=self, user=user):
self.enabled = True
self.save()
@property @property
@method_cache(300) @method_cache(300)
......
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