From 2e3fb905a388e9421074bb6057f4eb7c1107eebe Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Wed, 16 Oct 2019 02:46:09 +0800 Subject: [PATCH] [Mellanox]Correct reboot cause when reboot via power cycle (#3597) * [sonic_platform]remove the handling of reset_sw_reset which indicates rebooted by software. * [sonic_platform]Check "reset_sw_reset" Also check reboot cause file "reset_sw_reset" which indicates the system was rebooted due to software requesting. --- .../mellanox/mlnx-platform-api/sonic_platform/chassis.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index f964bf46fe..fe4f7d452d 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -319,11 +319,11 @@ class Chassis(ChassisBase): 'reset_comex_wd' : "Reset requested from ComEx", 'reset_from_asic' : "Reset requested from ASIC", 'reset_reload_bios' : "Reset caused by BIOS reload", - 'reset_sw_reset' : "Software reset", 'reset_hotswap_or_halt' : "Reset caused by hotswap or halt", 'reset_from_comex' : "Reset from ComEx", 'reset_voltmon_upgrade_fail': "Reset due to voltage monitor devices upgrade failure" } + self.reboot_by_software = 'reset_sw_reset' self.reboot_cause_initialized = True @@ -350,6 +350,11 @@ class Chassis(ChassisBase): if self._verify_reboot_cause(reset_file): return self.REBOOT_CAUSE_HARDWARE_OTHER, reset_cause + if self._verify_reboot_cause(self.reboot_by_software): + logger.log_info("Hardware reboot cause: the system was rebooted due to software requesting") + else: + logger.log_info("Hardware reboot cause: no hardware reboot cause found") + return self.REBOOT_CAUSE_NON_HARDWARE, ''