From 07cd938687b1a1b19f11497b7bb8bb52602f5364 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Thu, 10 Oct 2019 06:36:46 +0300 Subject: [PATCH 1/2] [sonic_platform]remove the handling of reset_sw_reset which indicates rebooted by software. --- platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py | 1 - 1 file changed, 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 f5c7c04a4204..7c9ab1e6fdeb 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -320,7 +320,6 @@ def initialize_reboot_cause(self): '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" From 6ac57bc71ee8868a89fbf0da4c236ccf823d3e24 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Sat, 12 Oct 2019 10:00:50 +0300 Subject: [PATCH 2/2] [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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 7c9ab1e6fdeb..a5415225691e 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -324,6 +324,7 @@ def initialize_reboot_cause(self): '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 +351,11 @@ def get_reboot_cause(self): 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, ''