Skip to content

Commit 1d57472

Browse files
[graceful reboot] Rename the platform_reboot to the pre_reboot_hook, remove the sysfs power cycle (#18324)
**DEPENDS ON: [[graceful reboot] Add the pre_reboot_hook script execution, add the watchdog arm before the reboot](sonic-net/sonic-utilities#3203 #### Why I did it Add support for the `graceful reboot` instead of the `sysfs power cycle` to avoid filesystem corruption ### How I did it Rename the `platform_reboot` script to the `pre_reboot_hook`. Remove the sysfs power cycle function, from now on the Debian reboot (`/sbin/reboot`) will be executed instead of the sysfs power cycle. #### How to verify it 1. Start watching logs by using `show log -f` and `journalctl -p debug -f` 2. Execute the `reboot` command from the switch CLI 3. Check in logs that all systemd services terminated
1 parent e877ca4 commit 1d57472

36 files changed

Lines changed: 51 additions & 72 deletions

File tree

device/mellanox/x86_64-mlnx_lssn2700-r0/platform_reboot

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../x86_64-mlnx_msn2700-r0/pre_reboot_hook

device/mellanox/x86_64-mlnx_msn2010-r0/platform_reboot

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../x86_64-mlnx_msn2700-r0/pre_reboot_hook

device/mellanox/x86_64-mlnx_msn2100-r0/platform_reboot

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../x86_64-mlnx_msn2700-r0/pre_reboot_hook

device/mellanox/x86_64-mlnx_msn2410-r0/platform_reboot

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../x86_64-mlnx_msn2700-r0/pre_reboot_hook

device/mellanox/x86_64-mlnx_msn2700-r0/platform_reboot

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/bash
2+
3+
# Copyright (c) 2020-2023 NVIDIA CORPORATION & AFFILIATES.
4+
# Apache-2.0
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
declare -r EXIT_SUCCESS=0
19+
declare -r EXIT_ERROR=1
20+
21+
declare -r PENDING_COMPONENT_FW="/usr/bin/install-pending-fw.py"
22+
declare -r FW_UPGRADE_SCRIPT="/usr/bin/mlnx-fw-upgrade.sh"
23+
24+
25+
${FW_UPGRADE_SCRIPT} --upgrade --verbose
26+
EXIT_CODE=$?
27+
if [[ ${EXIT_CODE} != ${EXIT_SUCCESS} ]]; then
28+
echo "Failed to burn MLNX FW: errno=${EXIT_CODE}"
29+
exit ${EXIT_ERROR}
30+
fi
31+
32+
${PENDING_COMPONENT_FW}
33+
34+
exit ${EXIT_SUCCESS}

0 commit comments

Comments
 (0)