From 7f5e300db41a4117152e53a87e9a105170397766 Mon Sep 17 00:00:00 2001 From: Stepan Blyschak Date: Tue, 28 Aug 2018 14:46:27 +0300 Subject: [PATCH] [mellanox] Upgrade FW if neccesary before fast reboot Fast-booting to a new image with new SDK/FW may increase control plane downtime by 1.5 min, because of new FW installation. Upgrading FW before fast reboot does not increase downtime of control/data plane traffic Signed-off-by: Stepan Blyschak --- scripts/fast-reboot | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/fast-reboot b/scripts/fast-reboot index 2a93315273..bd84eac751 100755 --- a/scripts/fast-reboot +++ b/scripts/fast-reboot @@ -36,6 +36,22 @@ INITRD=$(echo $KERNEL_IMAGE | sed 's/vmlinuz/initrd.img/g') sonic_asic_type=$(sonic-cfggen -y /etc/sonic/sonic_version.yml -v asic_type) +# Install new FW for mellanox platforms before control plane goes down +# So on boot switch will not spend time to upgrade FW increasing the CP downtime +if [[ "$sonic_asic_type" == "mellanox" ]]; +then + CURRENT_SONIC_IMAGE=$(sonic_installer list | grep "Current: " | cut -d ' ' -f 2) + if [[ "${CURRENT_SONIC_IMAGE}" != "${NEXT_SONIC_IMAGE}" ]]; then + echo "Prepare ASIC to fast reboot: install new FW if requiered" + NEXT_IMAGE_FS_PATH="/host/image-${NEXT_SONIC_IMAGE#SONiC-OS-}/fs.squashfs" + FS_MOUNTPOINT="/tmp/image-${NEXT_SONIC_IMAGE#SONiC-OS-}-fs" + mkdir -p "$FS_MOUNTPOINT" + mount -t squashfs "$NEXT_IMAGE_FS_PATH" "$FS_MOUNTPOINT" + /usr/bin/mlnx-fw-upgrade.sh "$FS_MOUNTPOINT/etc/mlnx/fw-SPC.mfa" + umount "$FS_MOUNTPOINT" + fi +fi + # Load kernel into the memory /sbin/kexec -l "$KERNEL_IMAGE" --initrd="$INITRD" --append="$BOOT_OPTIONS"