[202012][mlnx-ffb.sh] Update issu-version location (#14927)

BACKPORT OF https://github.com/sonic-net/sonic-buildimage/pull/14925

#### Why I did it

ISSU version check fails due to inability to mount squashfs from 202211 on 201911

#### How I did it

Put ISSU version file under platform directory

#### How to verify it

202012 (with [202012][mlnx-ffb.sh] Update issu-version location  #14927) to master
This commit is contained in:
Stepan Blyshchak 2023-07-02 09:43:51 +03:00 committed by GitHub
parent 406852cf30
commit bc58e2d841
No account linked to committer's email address
2 changed files with 40 additions and 33 deletions

View File

@ -823,7 +823,8 @@ for fw_file_name in ${!FW_FILE_MAP[@]}; do
# Link old FW location to not break existing automation/scripts # Link old FW location to not break existing automation/scripts
sudo ln -s /host/image-$SONIC_IMAGE_VERSION/$PLATFORM_DIR/fw/asic/${FW_FILE_MAP[$fw_file_name]} $FILESYSTEM_ROOT/etc/mlnx/${FW_FILE_MAP[$fw_file_name]} sudo ln -s /host/image-$SONIC_IMAGE_VERSION/$PLATFORM_DIR/fw/asic/${FW_FILE_MAP[$fw_file_name]} $FILESYSTEM_ROOT/etc/mlnx/${FW_FILE_MAP[$fw_file_name]}
done done
sudo cp $files_path/$ISSU_VERSION_FILE $FILESYSTEM_ROOT/etc/mlnx/issu-version sudo cp $files_path/$ISSU_VERSION_FILE $FILESYSTEM_ROOT/$PLATFORM_DIR/fw/asic/issu-version
sudo ln -s /host/image-$SONIC_IMAGE_VERSION/$PLATFORM_DIR/fw/asic/issu-version $FILESYSTEM_ROOT/etc/mlnx/issu-version
sudo cp $files_path/$MLNX_FFB_SCRIPT $FILESYSTEM_ROOT/usr/bin/mlnx-ffb.sh sudo cp $files_path/$MLNX_FFB_SCRIPT $FILESYSTEM_ROOT/usr/bin/mlnx-ffb.sh
sudo cp $files_path/$MLNX_ONIE_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_ONIE_FW_UPDATE sudo cp $files_path/$MLNX_ONIE_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_ONIE_FW_UPDATE
sudo cp $files_path/$MLNX_SSD_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_SSD_FW_UPDATE sudo cp $files_path/$MLNX_SSD_FW_UPDATE $FILESYSTEM_ROOT/usr/bin/$MLNX_SSD_FW_UPDATE

View File

@ -33,6 +33,16 @@ check_sdk_upgrade()
return "${FFB_SUCCESS}" return "${FFB_SUCCESS}"
fi fi
ISSU_VERSION_FILE_PATH="/etc/mlnx/issu-version"
CURRENT_ISSU_VERSION="$(cat ${ISSU_VERSION_FILE_PATH})"
NEXT_ISSU_VERSION="Unknown"
# /host/image-<version>/platform/fw/asic/issu-version is now the new location for ISSU version.
NEXT_IMAGE_ISSU_VERSION_FILE_PATH="/host/image-${NEXT_SONIC_IMAGE#SONiC-OS-}/platform/fw/asic/issu-version"
if [ -f "${NEXT_IMAGE_ISSU_VERSION_FILE_PATH}" ]; then
NEXT_ISSU_VERSION="$(cat ${NEXT_IMAGE_ISSU_VERSION_FILE_PATH})"
else
while :; do while :; do
mkdir -p "${FS_MOUNTPOINT}" mkdir -p "${FS_MOUNTPOINT}"
mount -t squashfs "${FS_PATH}" "${FS_MOUNTPOINT}" || { mount -t squashfs "${FS_PATH}" "${FS_MOUNTPOINT}" || {
@ -40,8 +50,6 @@ check_sdk_upgrade()
break break
} }
ISSU_VERSION_FILE_PATH="/etc/mlnx/issu-version"
[ -f "${ISSU_VERSION_FILE_PATH}" ] || { [ -f "${ISSU_VERSION_FILE_PATH}" ] || {
>&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH}" >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH}"
break break
@ -51,9 +59,13 @@ check_sdk_upgrade()
>&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH} in ${NEXT_SONIC_IMAGE}" >&2 echo "No ISSU version file found ${ISSU_VERSION_FILE_PATH} in ${NEXT_SONIC_IMAGE}"
break break
} }
CURRENT_ISSU_VERSION="$(cat ${ISSU_VERSION_FILE_PATH})"
NEXT_ISSU_VERSION="$(cat ${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH})" NEXT_ISSU_VERSION="$(cat ${FS_MOUNTPOINT}/${ISSU_VERSION_FILE_PATH})"
break
done
umount -rf "${FS_MOUNTPOINT}" 2> /dev/null || true
rm -rf "${FS_MOUNTPOINT}" 2> /dev/null || true
fi
if [[ "${CURRENT_ISSU_VERSION}" == "${NEXT_ISSU_VERSION}" ]]; then if [[ "${CURRENT_ISSU_VERSION}" == "${NEXT_ISSU_VERSION}" ]]; then
CHECK_RESULT="${FFB_SUCCESS}" CHECK_RESULT="${FFB_SUCCESS}"
@ -63,12 +75,6 @@ check_sdk_upgrade()
>&2 echo "Next ISSU version: ${NEXT_ISSU_VERSION}" >&2 echo "Next ISSU version: ${NEXT_ISSU_VERSION}"
fi fi
break
done
umount -rf "${FS_MOUNTPOINT}" 2> /dev/null || true
rm -rf "${FS_MOUNTPOINT}" 2> /dev/null || true
return "${CHECK_RESULT}" return "${CHECK_RESULT}"
} }