Commit 8b39c899 by Őry Máté

vm: add Node.get_status_display

parent 41f26955
......@@ -77,18 +77,19 @@ class Node(TimeStampedModel):
num_cores = property(get_num_cores)
STATES = {False: {False: ('OFFLINE', _('offline')),
True: ('DISABLED', _('disabled'))},
True: {False: ('MISSING', _('missing')),
True: ('ONLINE', _('online'))}}
def state(self):
"""The state combined of online and enabled attributes.
if self.enabled and
return 'ONLINE'
elif self.enabled and not
return 'MISSING'
elif not self.enabled and
return 'DISABLED'
return 'OFFLINE'
return self.STATES[self.enabled][][0]
def get_status_display(self):
return self.STATES[self.enabled][][1]
def disable(self, user=None):
''' Disable the node.'''
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