Add bootstrap initrd update for VPI discovery
This change provides extension for the bootstrap discovery image, by adding an initrd update image, that includes the relevant modules for the latest bootstrap kernel and extra configuration files. Change-Id: Id2a5a3ffe97b5a5bd60254168775a4625e34922c
This commit is contained in:
parent
4d203269d2
commit
c86e56b70a
@ -5,7 +5,7 @@ name: mellanox-plugin
|
|||||||
title: Mellanox Openstack features
|
title: Mellanox Openstack features
|
||||||
|
|
||||||
# Plugin version
|
# Plugin version
|
||||||
version: 2.0.13
|
version: 2.0.14
|
||||||
|
|
||||||
# Description
|
# Description
|
||||||
description: Enable features over Mellanox hardware
|
description: Enable features over Mellanox hardware
|
||||||
|
@ -15,16 +15,17 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
readonly PLUGIN_DIR="$(dirname $0)"
|
readonly PLUGIN_DIR="$(dirname $0)"
|
||||||
readonly PLUGIN_VERSION=`cat $PLUGIN_DIR/.version`
|
readonly PLUGIN_VERSION=`cat ${PLUGIN_DIR}/.version`
|
||||||
readonly REPOSITORY_PATH='bgate.mellanox.com/openstack/mellanox_fuel_plugin/'
|
readonly REPOSITORY_PATH='bgate.mellanox.com/openstack/mellanox_fuel_plugin'
|
||||||
|
|
||||||
function download {
|
function download {
|
||||||
FILE_TYPE=$1
|
FILE_TYPE=$1
|
||||||
FILE_NAME=$2
|
FILE_NAME=$2
|
||||||
case ${FILE_TYPE} in
|
case ${FILE_TYPE} in
|
||||||
'bootstrap')
|
'bootstrap')
|
||||||
PREFIX_URL=$PLUGIN_VERSION/bootstrap
|
PREFIX_URL=$PLUGIN_VERSION/bootstrap/latest-build
|
||||||
BUILD_DIR=bootstrap
|
BUILD_DIR=bootstrap/
|
||||||
|
FILE_NAME=`curl http://${REPOSITORY_PATH}/${PREFIX_URL}/ | tr '<' '\n' | tr '>' '\n' | grep ^$FILE_NAME`
|
||||||
;;
|
;;
|
||||||
'rpm')
|
'rpm')
|
||||||
PREFIX_URL=$PLUGIN_VERSION/repositories/centos/Packages
|
PREFIX_URL=$PLUGIN_VERSION/repositories/centos/Packages
|
||||||
@ -77,8 +78,5 @@ deb_files="cirros-testvm-mellanox_0.3.2-ubuntu3_amd64.deb
|
|||||||
get_packages "deb" "$old_debs" "$deb_files"
|
get_packages "deb" "$old_debs" "$deb_files"
|
||||||
|
|
||||||
bootstrap_dir="${PLUGIN_DIR}/bootstrap/"
|
bootstrap_dir="${PLUGIN_DIR}/bootstrap/"
|
||||||
bootstrap_files="initramfs.img
|
bootstrap_files="initrd_mlnx_mos*"
|
||||||
linux
|
get_packages "bootstrap" "$bootstrap_dir" "$bootstrap_files"
|
||||||
ofed
|
|
||||||
kernel"
|
|
||||||
#get_packages "bootstrap" "$bootstrap_dir" "$bootstrap_files" # Using original bootstrap in 7.0
|
|
||||||
|
@ -1,24 +1,39 @@
|
|||||||
|
|
||||||
%%post
|
#%%post
|
||||||
if [ -d "/var/www/nailgun/bootstrap/" ]; then
|
|
||||||
if [ ! -d "/opt/old_bootstrap_image/" ]; then
|
FUEL_BOOTSTRAP_DIR="/var/www/nailgun/bootstrap/"
|
||||||
mkdir -p /opt/old_bootstrap_image/
|
PLUGINS_DIR="/var/www/nailgun/plugins/"
|
||||||
|
BOOTSTRAP_BACKUP_DIR="/opt/old_bootstrap_initrd/"
|
||||||
|
|
||||||
|
if [ -d $FUEL_BOOTSTRAP_DIR ]; then
|
||||||
|
if [ ! -d $BOOTSTRAP_BACKUP_DIR ]; then
|
||||||
|
mkdir -p $BOOTSTRAP_BACKUP_DIR
|
||||||
fi
|
fi
|
||||||
# If an old bootstrap already exists in the backup dir do not override it with the plugins's new bootstrap
|
|
||||||
if [ ! -f /opt/old_bootstrap_image/initramfs.img ]; then
|
# Backup all available initrd_mlnx* in Fuel bootstrap dir
|
||||||
\cp /var/www/nailgun/bootstrap/initramfs.img /opt/old_bootstrap_image/
|
for i in `ls $FUEL_BOOTSTRAP_DIR | grep initrd_mlnx`
|
||||||
\cp /var/www/nailgun/bootstrap/linux /opt/old_bootstrap_image/
|
do
|
||||||
fi
|
if [ ! -f $BOOTSTRAP_BACKUP_DIR/$i ]; then
|
||||||
if ! [[ `grep release /etc/fuel/version.yaml | grep "7.0"` ]]; then
|
\mv $FUEL_BOOTSTRAP_DIR/$i $BOOTSTRAP_BACKUP_DIR
|
||||||
\cp $(ls /var/www/nailgun/plugins/mellanox-plugin*/bootstrap/initramfs.img) /var/www/nailgun/bootstrap/
|
|
||||||
\cp $(ls /var/www/nailgun/plugins/mellanox-plugin*/bootstrap/linux) /var/www/nailgun/bootstrap/
|
|
||||||
command -v dockerctl >/dev/null 2>&1
|
|
||||||
if [ $? -eq 0 ];then
|
|
||||||
dockerctl copy /var/www/nailgun/bootstrap/initramfs.img cobbler:/var/lib/tftpboot/images/bootstrap/initramfs.img
|
|
||||||
dockerctl copy /var/www/nailgun/bootstrap/linux cobbler:/var/lib/tftpboot/images/bootstrap/linux
|
|
||||||
\cp $(ls /var/www/nailgun/plugins/mellanox-plugin*/scripts/reboot_bootstrap_nodes) /sbin/
|
|
||||||
echo " `tput bold`Bootstrap discovery image has been replaced for detecting Mellanox Infiniband HW."
|
|
||||||
echo " please reboot your old bootstrap nodes ('reboot_bootstrap_nodes [-e environment_id] [-a] [-h]' can be used).`tput sgr0`"
|
|
||||||
fi
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
\cp $(ls $PLUGINS_DIR/mellanox-plugin*/bootstrap/initrd_mlnx*) $FUEL_BOOTSTRAP_DIR
|
||||||
|
command -v dockerctl >/dev/null 2>&1
|
||||||
|
if [ $? -eq 0 ];then
|
||||||
|
dockerctl copy $(ls $FUEL_BOOTSTRAP_DIR/initrd_mlnx*) cobbler:/var/lib/tftpboot/
|
||||||
|
\cp $(ls $PLUGINS_DIR/mellanox-plugin*/scripts/reboot_bootstrap_nodes) /sbin/
|
||||||
|
cobbler_profile_vars=$(dockerctl shell cobbler cobbler profile dumpvars --name=bootstrap | grep "kernel_options :" | cut -d':' -f2-)
|
||||||
|
initrd_update_image=$(ls $PLUGINS_DIR/mellanox-plugin*/bootstrap/ | grep initrd_mlnx* )
|
||||||
|
prefix=`echo "initrd=$initrd_update_image"`
|
||||||
|
if [[ ! $cobbler_profile_vars == *$initrd_update_image* ]]
|
||||||
|
then
|
||||||
|
# Add the initrd update if not in cobbler vars
|
||||||
|
new_cobbler_profile_vars=$(echo " $prefix $(echo $cobbler_profile_vars | sed s/initrd=.*img//)")
|
||||||
|
dockerctl shell cobbler cobbler profile edit --name bootstrap --kopts="${new_cobbler_profile_vars}"
|
||||||
|
fi
|
||||||
|
dockerctl shell cobbler cobbler sync
|
||||||
|
echo " `tput bold`Bootstrap discovery image has been replaced for detecting Mellanox Infiniband HW."
|
||||||
|
echo " please reboot your old bootstrap nodes ('reboot_bootstrap_nodes [-e environment_id] [-a] [-h]' can be used).`tput sgr0`"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user