2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-22 03:32:04 +00:00

Merge pull request #4949 from xuweibj/enhance_bmcreboot

Enhance rpower bmcreboot, clear dumps if reboot to new firmware
This commit is contained in:
zet809 2018-03-19 16:38:35 +08:00 committed by GitHub
commit ae89233395
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 deletions

View File

@ -159,13 +159,32 @@ class OpenBMCPowerTask(ParallelNodesCommand):
new_status = ''
try:
obmc.login()
except (SelfServerException, SelfClientException) as e:
return self.callback.error(e.message, node)
firm_obj_dict = {}
try:
has_functional, firm_obj_dict = obmc.list_firmware()
except (SelfServerException, SelfClientException) as e:
self.callback.syslog('%s: %s' % (node, e.message))
clear_flag = False
for key, value in firm_obj_dict.items():
if not value.functional and value.priority == 0:
clear_flag = True
break
if clear_flag:
self.callback.info('%s: Firmware will be flashed on reboot, deleting all BMC diagnostics...' % node)
try:
obmc.clear_dump('all')
except (SelfServerException, SelfClientException) as e:
self.callback.warn('%s: Could not clear BMC diagnostics successfully %s' % (node, e.message))
try:
obmc.reboot_bmc(optype)
except (SelfServerException, SelfClientException) as e:
self.callback.error(e.message, node)
else:
try:
obmc.reboot_bmc(optype)
except (SelfServerException, SelfClientException) as e:
self.callback.error(e.message, node)
else:
self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES['bmcreboot']))
self.callback.info('%s: %s' % (node, openbmc.RPOWER_STATES['bmcreboot']))

View File

@ -3879,7 +3879,7 @@ sub rspconfig_dump_response {
my $dump_id = $status_info{RSPCONFIG_DUMP_CLEAR_RESPONSE}{argv};
xCAT::MsgUtils->message("I", { data => ["[$dump_id] clear"] }, $callback) unless ($next_status{ $node_info{$node}{cur_status} });
} else {
my $error_msg = "Could not clear BMC diagnostics successfully (". $response_info->{'message'} . "), ignoring...";
my $error_msg = "Could not clear BMC diagnostics successfully (". $response_info->{'message'} . ")";
xCAT::MsgUtils->message("W", { data => ["$node: $error_msg"] }, $callback) if ($next_status{ $node_info{$node}{cur_status} });
}
}