diff --git a/xCAT/postscripts/check_mlnx_firmware b/xCAT/postscripts/check_mlnx_firmware new file mode 100755 index 000000000..5b7241b93 --- /dev/null +++ b/xCAT/postscripts/check_mlnx_firmware @@ -0,0 +1,28 @@ +#!/bin/sh +# +# Sample postscript that can be executed to check the Mellanox OFED version +# and adapter firmware level on the Mellanox adapters installed on the target nodes +# +# +BINARIES="ofed_info mst ibdev2netdev" +for PROG in ${BINARIES}; do + RC=`command -v ${PROG} >> /dev/nul 2>&1; echo $?` + if [[ ${RC} != 0 ]]; then + echo "${PROG} is not installed on this node, unable to check firmware levels." + exit 1 + fi +done + +MELLANOX_SOFTWARE=`ofed_info -s | cut -d: -f1` +echo "Mellanox Software: $MELLANOX_SOFTWARE" + + +mst start >> /dev/null +if [[ $? != 0 ]]; then + echo "Error: Could not start mst, cannot check adapter firmware level." + exit 1 +fi + +ibdev2netdev -v + +exit 0 diff --git a/xCAT/postscripts/update_mlnx_adapter_firmware b/xCAT/postscripts/update_mlnx_adapter_firmware new file mode 100755 index 000000000..a8da0bdde --- /dev/null +++ b/xCAT/postscripts/update_mlnx_adapter_firmware @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Sample postscript that can be executed to help update the firmware level on +# Mellanox hardware adapters on the target nodes +# +# This script requires passing in the path of the Mellanox OFED ISO +# located on the xCAT Management node under the /install directory. +# +# If OFED file is located here: +# /install/mlnxofed/MLNX_OFED_LINUX-4.1-4.0.7.1-rhel7.4alternate-ppc64le.iso +# +# Call the script as follows: +# updatenode -P "update_mlnx_adapter_firmware /install/mlnxofed/MLNX_OFED_LINUX-4.1-4.0.7.1-rhel7.4alternate-ppc64le.iso" +# +MLNX_OFED_PATH=${1} + +if [[ -z ${1} ]]; then + echo "Error: you must provide the path of the MLNX OFED ISO file" + exit 1 +fi + +WORKING_DIR="/" +MLNX_ISO_FILE=`basename ${MLNX_OFED_PATH}` +TARGET_ISO_FILE="${WORKING_DIR}/${MLNX_ISO_FILE}" + +echo "==> Mellanox OFED PATH: ${MLNX_OFED_PATH}" +echo "==> Mellanox ODEF ISO: ${MLNX_ISO_FILE}" + +if [[ -e ${TARGET_ISO_FILE} ]]; then + rm -f ${TARGET_ISO_FILE} +fi + +echo "==> Retrieving file from http://${MASTER}/${MLNX_OFED_PATH}" +wget -q http://${MASTER}/${MLNX_OFED_PATH} -O ${TARGET_ISO_FILE} + +ls -ltr ${TARGET_ISO_FILE} + +MOUNT_DIR="${WORKING_DIR}/mlnx_tmp_iso_dir" +mkdir -p ${MOUNT_DIR} + +mount -o ro,loop ${TARGET_ISO_FILE} ${MOUNT_DIR} +ls -ltr ${MOUNT_DIR} + +${MOUNT_DIR}/mlnxofedinstall --fw-update-only + +# +# Clean up +# +sleep 1 +umount ${MOUNT_DIR} +rmdir ${MOUNT_DIR} + +rm -f ${TARGET_ISO_FILE} + + +echo "==> " +echo "==> " +echo "==> REBOOT THIS MACHINE FOR THE NEW FIRMWARE LEVEL TO TAKE EFFECT." +echo "==> " +echo "==> " + +exit 0