Skip to content

Commit

Permalink
[Mellanox] [reboot] [asan] stop asan-enabled containers on reboot (#2107
Browse files Browse the repository at this point in the history
)

During a cold reboot on an image built with ENABLE_ASAN=y, swss and syncd (only on Mellanox platform) are explicitly stopped.
This will make the relevant processes receive SIGTERM and generate the ASAN reports.
The behavior for fast/warm reboots is not affected.
The behavior of regular (ENABLE_ASAN=n) images is not affected.

- What I did
Modified the reboot script so the asan logs are generated on reboot.

- How I did it
Added stop_services_asan() to reboot script.

- How to verify it
Added "asan: 'yes'" to the /etc/sonic/sonic_version.yml
Checked that relevant containers are stopped and logs are generated

Signed-off-by: Yakiv Huryk <yhuryk@nvidia.com>
  • Loading branch information
Yakiv-Huryk committed Apr 25, 2022
1 parent 697aae3 commit 8c07d59
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ REBOOT_USER=$(logname)
PLATFORM=$(sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
ASIC_TYPE=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type)
SUBTYPE=$(sonic-cfggen -d -v DEVICE_METADATA.localhost.subtype)
ASAN=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asan)
VERBOSE=no
EXIT_NEXT_IMAGE_NOT_EXISTS=4
EXIT_SONIC_INSTALLER_VERIFY_REBOOT=21
Expand Down Expand Up @@ -78,6 +79,12 @@ function stop_sonic_services()
stop_pmon_service
}

function stop_services_asan()
{
debug "Stopping swss for ASAN"
systemctl stop swss
}

function clear_warm_boot()
{
# If reboot is requested, make sure the outstanding warm-boot is cleared
Expand Down Expand Up @@ -187,6 +194,11 @@ tag_images
# Stop SONiC services gracefully.
stop_sonic_services

# Stop ASAN-enabled services so the report can be generated
if [[ x"$ASAN" == x"yes" ]]; then
stop_services_asan
fi

clear_warm_boot

# Update the reboot cause file to reflect that user issued 'reboot' command
Expand Down

0 comments on commit 8c07d59

Please sign in to comment.