Skip to content

Commit

Permalink
[mellanox|ffb] use system level warm reboot for Mellanox fastfast boot (
Browse files Browse the repository at this point in the history
#2374)

* [mellanox|ffb] use system level warm reboot for Mellanox fastfast boot

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>

* [mellanox|ffb] add comments for mellanox start/stop drivers section

Signed-off-by: Stepan Blyschak <stepanb@mellanox.com>
  • Loading branch information
stepanblyschak authored and yxieca committed Jan 10, 2019
1 parent ae19072 commit ff526dd
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 98 deletions.
6 changes: 3 additions & 3 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function preStartAction()
{
{%- if docker_container_name == "database" %}
WARM_DIR=/host/warmboot
if [[ "$BOOT_TYPE" == "warm" && -f $WARM_DIR/dump.rdb ]]; then
if [[ ("$BOOT_TYPE" == "warm" || "$BOOT_TYPE" == "fastfast") && -f $WARM_DIR/dump.rdb ]]; then
# Load redis content from /host/warmboot/dump.rdb
docker cp $WARM_DIR/dump.rdb database:/var/lib/redis/dump.rdb
else
Expand All @@ -49,7 +49,7 @@ function postStartAction()
until [[ $(/usr/bin/docker exec database redis-cli -s $REDIS_SOCK ping | grep -c PONG) -gt 0 ]]; do
sleep 1;
done
if [[ "$BOOT_TYPE" == "warm" && -f $WARM_DIR/dump.rdb ]]; then
if [[ ("$BOOT_TYPE" == "warm" || "$BOOT_TYPE" == "fastfast") && -f $WARM_DIR/dump.rdb ]]; then
rm -f $WARM_DIR/dump.rdb
else
# If there is a config db dump file, load it
Expand All @@ -61,7 +61,7 @@ function postStartAction()
fi
{%- elif docker_container_name == "swss" %}
docker exec swss rm -f /ready # remove cruft
if [[ "$BOOT_TYPE" == "fast" || "$BOOT_TYPE" == "fastfast" ]] && [[ -d /host/fast-reboot ]]; then
if [[ "$BOOT_TYPE" == "fast" ]] && [[ -d /host/fast-reboot ]]; then
test -e /host/fast-reboot/fdb.json && docker cp /host/fast-reboot/fdb.json swss:/
test -e /host/fast-reboot/arp.json && docker cp /host/fast-reboot/arp.json swss:/
test -e /host/fast-reboot/default_routes.json && docker cp /host/fast-reboot/default_routes.json swss:/
Expand Down
6 changes: 1 addition & 5 deletions files/scripts/swss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ start() {

# Don't flush DB during warm boot
if [[ x"$WARM_BOOT" != x"true" ]]; then
# Don't flush APP_DB during MLNX fastfast boot
BOOT_TYPE="$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)"
if [[ x"$BOOT_TYPE" != x"fastfast" ]] && [[ ! -f /var/warmboot/issu_started ]]; then
/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
fi
/usr/bin/docker exec database redis-cli -n 0 FLUSHDB
/usr/bin/docker exec database redis-cli -n 2 FLUSHDB
/usr/bin/docker exec database redis-cli -n 5 FLUSHDB
clean_up_tables 6 "'PORT_TABLE*', 'MGMT_PORT_TABLE*', 'VLAN_TABLE*', 'VLAN_MEMBER_TABLE*', 'INTERFACE_TABLE*', 'MIRROR_SESSION*'"
Expand Down
33 changes: 20 additions & 13 deletions files/scripts/syncd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,12 @@ start() {

# Flush DB during non-warm start
/usr/bin/docker exec database redis-cli -n 1 FLUSHDB

# platform specific tasks
if [ x$sonic_asic_platform == x'cavium' ]; then
/etc/init.d/xpnet.sh start
fi
fi

# platform specific tasks

# start mellanox drivers regardless of
# boot type
if [ x"$sonic_asic_platform" == x"mellanox" ]; then
BOOT_TYPE=`getBootType`
if [[ x"$WARM_BOOT" == x"true" || x"$BOOT_TYPE" == x"fast" ]]; then
Expand All @@ -109,6 +107,13 @@ start() {
/sbin/modprobe i2c-dev
fi

if [[ x"$WARM_BOOT" != x"true" ]]; then
if [ x$sonic_asic_platform == x'cavium' ]; then
/etc/init.d/xpnet.sh start
fi
fi


# start service docker
/usr/bin/${SERVICE}.sh start
debug "Started ${SERVICE} service..."
Expand Down Expand Up @@ -146,21 +151,23 @@ stop() {
/usr/bin/${SERVICE}.sh stop
debug "Stopped ${SERVICE} service..."

# if warm start enabled, don't stop peer service docker
# platform specific tasks

# stop mellanox driver regardless of
# shutdown type
if [ x$sonic_asic_platform == x'mellanox' ]; then
/etc/init.d/sxdkernel stop
/usr/bin/mst stop
fi


if [[ x"$WARM_BOOT" != x"true" ]]; then
# platform specific tasks
if [ x$sonic_asic_platform == x'cavium' ]; then
/etc/init.d/xpnet.sh stop
/etc/init.d/xpnet.sh start
fi
fi

# platform specific tasks
if [ x"$sonic_asic_platform" == x"mellanox" ]; then
/etc/init.d/sxdkernel stop
/usr/bin/mst stop
fi

unlock_service_state_change
}

Expand Down
5 changes: 0 additions & 5 deletions platform/mellanox/docker-syncd-mlnx/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ supervisorctl start syncd

supervisorctl start mlnx-sfpd

BOOT_TYPE="$(cat /proc/cmdline | grep -o 'SONIC_BOOT_TYPE=\S*' | cut -d'=' -f2)"
if [[ x"$BOOT_TYPE" == x"fastfast" ]] && [[ -f /var/warmboot/issu_started ]]; then
rm -f /var/warmboot/issu_started
/usr/bin/ffb &>/dev/null &
fi
15 changes: 13 additions & 2 deletions platform/mellanox/mlnx-ffb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,19 @@ check_sdk_upgrade()
return "${CHECK_RESULT}"
}

check_ffb()
{
check_issu_enabled || {
echo "ISSU is not enabled on this HWSKU"
return "${FFB_FAILURE}"
}
check_sdk_upgrade || {
echo "SDK upgrade check failued"
return "${FFB_FAILURE}"
}
return "${FFB_SUCCESS}";
}

# Perform ISSU start
issu_start()
{
Expand All @@ -70,8 +83,6 @@ issu_start()

EXIT_CODE=$?

touch /host/warmboot/issu_started

return $EXIT_CODE
}

Expand Down
69 changes: 0 additions & 69 deletions platform/mellanox/mlnx-issu/scripts/ffb

This file was deleted.

1 change: 0 additions & 1 deletion platform/mellanox/mlnx-issu/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@
maintainer_email='stepanb@mellanox.com',
scripts=[
'scripts/issu',
'scripts/ffb',
]
)

0 comments on commit ff526dd

Please sign in to comment.