Create boot counter management service
The commit [1] introduces a boot failure counter to boot.env, so that a logic can be created to boot the system in the rollback deployment if the system fails to boot the to-release deployment during an upgrade. This commit creates a very simple service to reset the boot failure counter variable to 0 in boot.env when the system boots successfully. [1] https://review.opendev.org/c/starlingx/metal/+/952864 Test Plan PASS: verify the system runs successfully during the boot sequence on the console PASS: verify boot.env once the system boots successfully and confirm that boot_failure is set to 0 PASS: force boot failure, verify the boot_failure counter increment with [1], and verify the boot_failure is reset to 0 when the system boots PASS: integrated test for automatic boot recovery (AIO-SX) 1. upgrade host from stx-10 to stx-11 with LVM snapshot feature enabled 2. force failure during the boot sequence (3x) 3. system boots in the rollback deployment 4. LVM snapshots are restored during the boot sequence and system is rebooted again 5. system boots in from-release ready to 'deploy delete' Story: 2011357 Task: 52428 Change-Id: Ida4d5c811b376018b2703ff0e89bb65697995b3f Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
This commit is contained in:
@@ -45,6 +45,8 @@ override_dh_install:
|
||||
${ROOT}/etc/init.d/usm-initialize
|
||||
install -m 500 service-files/lvm-snapshot-restore.sh \
|
||||
${ROOT}/etc/init.d/lvm-snapshot-restore
|
||||
install -m 500 service-files/reset-boot-counter.sh \
|
||||
${ROOT}/etc/init.d/reset-boot-counter
|
||||
install -m 600 service-files/software.conf \
|
||||
${ROOT}/etc/software/software.conf
|
||||
install -m 644 service-files/policy.json \
|
||||
|
13
software/service-files/reset-boot-counter.service
Normal file
13
software/service-files/reset-boot-counter.service
Normal file
@@ -0,0 +1,13 @@
|
||||
[Unit]
|
||||
Description=Reset Boot Counter
|
||||
DefaultDependencies=no
|
||||
After=controllerconfig.service storageconfig.service workerconfig.service pmon.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/etc/init.d/reset-boot-counter
|
||||
TimeoutStartSec=300
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
23
software/service-files/reset-boot-counter.sh
Normal file
23
software/service-files/reset-boot-counter.sh
Normal file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2025 Wind River Systems, Inc.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
### BEGIN INIT INFO
|
||||
# Description: reset-boot-counter
|
||||
#
|
||||
# Short-Description: Reset Boot Counter
|
||||
# Provides: reset-boot-counter
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: 3 5
|
||||
# Default-Stop: 3 5
|
||||
### END INIT INFO
|
||||
|
||||
NAME=$(basename $0)
|
||||
BOOT_ENV="/boot/efi/EFI/BOOT/boot.env"
|
||||
|
||||
grub-editenv $BOOT_ENV set boot_failure="0"
|
||||
|
||||
exit 0
|
Reference in New Issue
Block a user