Skip to content

Commit

Permalink
Stop PMON docker before cold and soft reboots (sonic-net#1514)
Browse files Browse the repository at this point in the history
Prevent potential kernel oops if drivers are removed/devices are deinitialized while PMon daemons are still trying to access those devices.
  • Loading branch information
aravindmani-1 authored Apr 15, 2021
1 parent eba5c04 commit 0e84418
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/reboot
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,30 @@ function tag_images()
fi
}

function stop_pmon_service()
{
CONTAINER_STOP_RC=0
debug "Stopping pmon docker"
docker kill pmon &> /dev/null || CONTAINER_STOP_RC=$?
systemctl stop pmon || debug "Ignore stopping pmon error $?"
if [[ CONTAINER_STOP_RC -ne 0 ]]; then
debug "Failed killing container pmon RC $CONTAINER_STOP_RC ."
fi
}

function stop_sonic_services()
{
if [[ x"$SUBTYPE" == x"DualToR" ]]; then
debug "DualToR detected, stopping mux container before reboot..."
systemctl stop mux
fi

if [[ x"$ASIC_TYPE" != x"mellanox" ]]; then
debug "Stopping syncd process..."
docker exec -i syncd /usr/bin/syncd_request_shutdown --cold > /dev/null
sleep 3
fi
stop_pmon_service
}

function clear_warm_boot()
Expand Down
12 changes: 12 additions & 0 deletions scripts/soft-reboot
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,25 @@ function tag_images()
fi
}

function stop_pmon_service()
{
CONTAINER_STOP_RC=0
debug "Stopping pmon docker"
docker kill pmon &> /dev/null || CONTAINER_STOP_RC=$?
systemctl stop pmon || debug "Ignore stopping pmon error $?"
if [[ CONTAINER_STOP_RC -ne 0 ]]; then
debug "Failed killing container pmon RC $CONTAINER_STOP_RC ."
fi
}

function stop_sonic_services()
{
if [[ x"$ASIC_TYPE" != x"mellanox" ]]; then
debug "Stopping syncd process..."
docker exec -i syncd /usr/bin/syncd_request_shutdown --cold > /dev/null
sleep 3
fi
stop_pmon_service
}

function clear_lingering_reboot_config()
Expand Down

0 comments on commit 0e84418

Please sign in to comment.