diff --git a/metadata.yaml b/metadata.yaml index 72551b7..7d2a950 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -5,7 +5,7 @@ name: mellanox-plugin title: Mellanox Openstack features # Plugin version -version: 2.0.13 +version: 2.0.14 # Description description: Enable features over Mellanox hardware diff --git a/pre_build_hook b/pre_build_hook index 4edbbaa..932de4c 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -15,16 +15,17 @@ # limitations under the License. readonly PLUGIN_DIR="$(dirname $0)" -readonly PLUGIN_VERSION=`cat $PLUGIN_DIR/.version` -readonly REPOSITORY_PATH='bgate.mellanox.com/openstack/mellanox_fuel_plugin/' +readonly PLUGIN_VERSION=`cat ${PLUGIN_DIR}/.version` +readonly REPOSITORY_PATH='bgate.mellanox.com/openstack/mellanox_fuel_plugin' function download { FILE_TYPE=$1 FILE_NAME=$2 case ${FILE_TYPE} in 'bootstrap') - PREFIX_URL=$PLUGIN_VERSION/bootstrap - BUILD_DIR=bootstrap + PREFIX_URL=$PLUGIN_VERSION/bootstrap/latest-build + BUILD_DIR=bootstrap/ + FILE_NAME=`curl http://${REPOSITORY_PATH}/${PREFIX_URL}/ | tr '<' '\n' | tr '>' '\n' | grep ^$FILE_NAME` ;; 'rpm') 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" bootstrap_dir="${PLUGIN_DIR}/bootstrap/" -bootstrap_files="initramfs.img - linux - ofed - kernel" -#get_packages "bootstrap" "$bootstrap_dir" "$bootstrap_files" # Using original bootstrap in 7.0 +bootstrap_files="initrd_mlnx_mos*" +get_packages "bootstrap" "$bootstrap_dir" "$bootstrap_files" diff --git a/specs/post.spec b/specs/post.spec index 577d096..d9595a4 100644 --- a/specs/post.spec +++ b/specs/post.spec @@ -1,24 +1,39 @@ -%%post -if [ -d "/var/www/nailgun/bootstrap/" ]; then - if [ ! -d "/opt/old_bootstrap_image/" ]; then - mkdir -p /opt/old_bootstrap_image/ +#%%post + +FUEL_BOOTSTRAP_DIR="/var/www/nailgun/bootstrap/" +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 - # 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 - \cp /var/www/nailgun/bootstrap/initramfs.img /opt/old_bootstrap_image/ - \cp /var/www/nailgun/bootstrap/linux /opt/old_bootstrap_image/ - fi - if ! [[ `grep release /etc/fuel/version.yaml | grep "7.0"` ]]; then - \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`" + + # Backup all available initrd_mlnx* in Fuel bootstrap dir + for i in `ls $FUEL_BOOTSTRAP_DIR | grep initrd_mlnx` + do + if [ ! -f $BOOTSTRAP_BACKUP_DIR/$i ]; then + \mv $FUEL_BOOTSTRAP_DIR/$i $BOOTSTRAP_BACKUP_DIR 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