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

Implement reset command

Added a reset bmc command in nodes/<node_name>/configuration/management_controller/reset
This commit is contained in:
Juliana Motira 2015-08-27 08:38:23 -03:00
parent 455feb867d
commit c20f0dc2ae
3 changed files with 34 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()
@ -542,6 +545,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',
@ -642,6 +654,13 @@ class PowerState(ConfluentChoiceMessage):
keyname = 'state'
class BMCReset(ConfluentChoiceMessage):
valid_values = set([
'reset',
])
keyname = 'state'
class EventCollection(ConfluentMessage):
"""A collection of events

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':