mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-05-29 17:23:08 +00:00
[DO NOT MERGE} OpenBMC reventlog clear in Python
This commit is contained in:
parent
6d633af336
commit
8491449266
@ -56,6 +56,15 @@ class OpenBMCEventlogTask(ParallelNodesCommand):
|
||||
def clear_all_ev_records(self, **kw):
|
||||
|
||||
node = kw['node']
|
||||
obmc = openbmc.OpenBMCRest(name=node, nodeinfo=kw['nodeinfo'], messager=self.callback, debugmode=self.debugmode, verbose=self.verbose)
|
||||
try:
|
||||
obmc.login()
|
||||
obmc.clear_all_eventlog_records()
|
||||
|
||||
except (SelfServerException, SelfClientException) as e:
|
||||
self.callback.error('%s' % e.message, node)
|
||||
|
||||
self.callback.info('%s: %s' % (node, "Logs cleared"))
|
||||
|
||||
def resolve_ev_records(self, resolve_list, **kw):
|
||||
|
||||
|
@ -219,7 +219,11 @@ RSPCONFIG_APIS = {
|
||||
},
|
||||
}
|
||||
|
||||
EVENTLOG_URL = "/logging/enumerate"
|
||||
EVENTLOG_URLS = {
|
||||
"list": "/logging/enumerate",
|
||||
"clear_all": "/logging/action/deleteAll",
|
||||
}
|
||||
|
||||
RAS_POLICY_TABLE = "/opt/ibm/ras/lib/policyTable.json"
|
||||
RAS_POLICY_MSG = "Install the OpenBMC RAS package to obtain more details logging messages."
|
||||
RAS_NOT_FOUND_MSG = " Not found in policy table: "
|
||||
@ -559,7 +563,7 @@ class OpenBMCRest(object):
|
||||
# Extract all eventlog info and parse it
|
||||
def get_eventlog_info(self):
|
||||
|
||||
eventlog_data = self.request('GET', EVENTLOG_URL, cmd='get_eventlog_info')
|
||||
eventlog_data = self.request('GET', EVENTLOG_URLS['list'], cmd='get_eventlog_info')
|
||||
|
||||
return self.parse_eventlog_data(eventlog_data)
|
||||
|
||||
@ -584,6 +588,11 @@ class OpenBMCRest(object):
|
||||
id, event_log_line = self.parse_eventlog_data_record(value, ras_event_mapping)
|
||||
if int(id) != 0:
|
||||
eventlog_dict[str(id)] = event_log_line
|
||||
|
||||
if not eventlog_dict:
|
||||
# Nothing was returned from BMC
|
||||
eventlog_dict['0'] ='No attributes returned from the BMC.'
|
||||
|
||||
return eventlog_dict
|
||||
except KeyError:
|
||||
error = 'Error: Received wrong format response: %s' % eventlog_data
|
||||
@ -649,6 +658,12 @@ class OpenBMCRest(object):
|
||||
formatted_line += LED_tag
|
||||
return id_str, formatted_line
|
||||
|
||||
# Clear all eventlog records
|
||||
def clear_all_eventlog_records(self):
|
||||
|
||||
return self.request('POST', EVENTLOG_URLS['clear_all'], cmd='clear_all_eventlog_records')
|
||||
|
||||
|
||||
def set_apis_values(self, key, value):
|
||||
attr_info = RSPCONFIG_APIS[key]
|
||||
if 'set_url' not in attr_info:
|
||||
|
@ -872,7 +872,6 @@ class OpenBMCManager(base.BaseManager):
|
||||
|
||||
# 3, run the subcommands
|
||||
runner = OpenBMCEventlogTask(nodesinfo, callback=self.messager, debugmode=self.debugmode, verbose=self.verbose)
|
||||
self.messager.info('revetlog.py processing action=%s args=%s' % (action, args))
|
||||
if action == 'clear':
|
||||
DefaultEventlogManager().clear_all_eventlog_records(runner)
|
||||
elif action == 'resolved':
|
||||
|
Loading…
x
Reference in New Issue
Block a user