Commit 93155c72 authored by Paul Rich's avatar Paul Rich
Browse files

Admin down was not getting properly detected.

Update node state was resetting an admin down.  Added an additional flag
so we can differentiate between admin down and hardware down.

If a node is marked down with an admin command, then no matter what, it
will remain marked down.
parent 8fdaae4a
......@@ -50,6 +50,10 @@ class CrayNode(ClusterNode):
idle.
'''
#admin down wins. If an admin says it's down, it's down.
if self.admin_down:
self._status = 'down'
return
if new_status.upper() in self.CRAY_STATE_MAP.keys():
self._status = self.CRAY_STATE_MAP[new_status.upper()]
self.ALPS_status = new_status
......
......@@ -980,8 +980,10 @@ class CraySystem(BaseSystem):
node = self.nodes[str(node_id)]
try:
if updates.get('down', False):
node.admin_down = True
node.status = 'down'
elif updates.get('up', False):
node.admin_down = False
node.status = 'idle'
elif updates.get('queues', None):
node.queues = list(updates['queues'].split(':'))
......
......@@ -31,6 +31,7 @@ class Resource(object):
self.managed = False
self.init_actions = []
self.cleanup_actions = []
self.admin_down = False
def reset_info(self, node):
'''reset node information on restart from a stored node object'''
......@@ -39,6 +40,7 @@ class Resource(object):
self.reserved_jobid = node.reserved_jobid
self.reserved_until = node.reserved_until
self.managed = node.managed
self.admin_down = node.admin_down
def __hash__(self):
'''Hash is the hash of the string name for the resource.'''
......@@ -73,7 +75,10 @@ class Resource(object):
if value not in self.RESOURCE_STATUSES:
raise InvalidStatusError('%s status invalid. Must be one of %s' % \
(value, self.RESOURCE_STATUSES))
self._status = value
if self.admin_down:
self._status = 'down'
else:
self._status = value
@property
def available_attributes(self):
......
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 to comment