2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-01-17 21:23:18 +00:00

Merge pull request #14 from jufm/reset

Implement reset bmc and NMI diag command
This commit is contained in:
Jarrod Johnson 2015-08-27 10:18:05 -04:00
commit 044def59ba
3 changed files with 36 additions and 0 deletions

View File

@ -135,6 +135,10 @@ noderesources = {
'pluginattrs': ['hardwaremanagement.method'],
'default': 'ipmi',
}),
'reset': PluginRoute({
'pluginattrs': ['hardwaremanagement.method'],
'default': 'ipmi',
}),
}
},
'_console': {

View File

@ -328,6 +328,9 @@ def get_input_message(path, operation, inputdata, nodes=None, multinode=False):
elif (path[:3] == ['configuration', 'management_controller', 'users'] and
operation not in ('retrieve', 'delete') and path[-1] != 'all'):
return InputCredential(path, inputdata, nodes)
elif (path[:3] == ['configuration', 'management_controller', 'reset']
and operation != 'retrieve'):
return InputBMCReset(path, nodes, inputdata)
elif inputdata:
raise exc.InvalidArgumentException()
@ -535,6 +538,7 @@ class InputPowerMessage(ConfluentInputMessage):
'off',
'reset',
'boot',
'diag',
'shutdown',
])
@ -542,6 +546,15 @@ class InputPowerMessage(ConfluentInputMessage):
return self.inputbynode[node]
class InputBMCReset(ConfluentInputMessage):
valid_values = set([
'reset',
])
def state(self, node):
return self.inputbynode[node]
class BootDevice(ConfluentChoiceMessage):
valid_values = set([
'network',
@ -638,6 +651,14 @@ class PowerState(ConfluentChoiceMessage):
'off',
'reset',
'boot',
'diag',
])
keyname = 'state'
class BMCReset(ConfluentChoiceMessage):
valid_values = set([
'reset',
])
keyname = 'state'

View File

@ -367,6 +367,8 @@ class IpmiHandler(object):
return self.handle_users()
elif self.element[1:3] == ['management_controller', 'net_interfaces']:
return self.handle_nets()
elif self.element[1:3] == ['management_controller', 'reset']:
return self.handle_reset()
raise Exception('Not implemented')
def decode_alert(self):
@ -739,6 +741,15 @@ class IpmiHandler(object):
state=power['powerstate']))
return
def handle_reset(self):
if 'read' == self.op:
self.output.put(msg.BMCReset(node=self.node,
state='reset'))
return
elif 'update' == self.op:
self.ipmicmd.reset_bmc()
return
def _str_health(health):
if health == 'unknown':