diff options
author | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-03-02 22:46:45 +0100 |
---|---|---|
committer | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-03-09 23:00:13 +0100 |
commit | 6cb518c68eb136ad448e96716ef8b1348440949f (patch) | |
tree | 757551a8efdc4e85e19fc1b0f27555825580e5c9 /fuel/build/f_isoroot/f_bootstrap | |
parent | 1e106bbaca2780c10bd02b4e5fa3702d36acdf39 (diff) |
Starting point for ODL Integration
***CAN BE MERGED***
- ODL build and installation (puppet manifests) including needed dependencies
- Modified in accordance with Randy Levensalors comments
- Added chmod 4755 /bin/fusermount due to that lately some systems dont install fuseiso
withe SUID set for fusermount. Investing ongoing on why and why not consistent.
- Rebased with master
- ODL disabled in top Make (enable it by uncommenting the odl dirs
- Removed white spaces
- Hopefully fixed an issue with the docker ubuntu repos, added --no-cache=true to the fuel/docker/Make file.
TODO:
- Refactor collecting ODL and Java dependencies to one common place
- Refactoring top Makefile
- Adding CI hooks for build and deploy
- Finishing integration plumbing wit Neutron/ML2 and OVS/OVSDB
Change-Id: I13dd4d3a72d099316dfaa9f7cd9140781be2397b
Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'fuel/build/f_isoroot/f_bootstrap')
8 files changed, 274 insertions, 0 deletions
diff --git a/fuel/build/f_isoroot/f_bootstrap/Makefile b/fuel/build/f_isoroot/f_bootstrap/Makefile new file mode 100644 index 0000000..7404319 --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/Makefile @@ -0,0 +1,29 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +TOP := $(shell pwd) + +.PHONY: all +all: + @mkdir -p release/opnfv/bootstrap/pre.d + @mkdir -p release/opnfv/bootstrap/post.d + @mkdir -p release/usr/local/sbin + @cp pre-scripts/* release/opnfv/bootstrap/pre.d + @cp post-scripts/* release/opnfv/bootstrap/post.d + @cp bootstrap_admin_node.sh release + @cp bootstrap_admin_node.sh.orig release + +.PHONY: clean +clean: + @rm -rf release + +.PHONY: release +release:all + @cp -Rvp release/* ../release diff --git a/fuel/build/f_isoroot/f_bootstrap/README b/fuel/build/f_isoroot/f_bootstrap/README new file mode 100644 index 0000000..5da954c --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/README @@ -0,0 +1,24 @@ +############################################################################## +# Copyright (c) 2015 Ericsson AB and others. +# stefan.k.berg@ericsson.com +# jonas.bjurel@ericsson.com +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +This function modifies the adds hooks to the beginning and end of +/usr/local/sbin/bootstrap_admin_nodes.sh, which is run as the +last post step from ks.cfg + +This enables other functions to place scripts into two directories +run either at the beginning or the end of the bootstrap procedure: + + /opt/opnfv/bootstrap/pre.d + /opt/opnfv/bootstrap/post.d + +These will be run in lexical order at pre or post. + +CI note: Using pre.d, it would be possible to "inject" a pre-defined +astute.yaml for Fuel. diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh new file mode 100755 index 0000000..348ce3c --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh @@ -0,0 +1,105 @@ +#!/bin/bash + +function countdown() { + local i + sleep 1 + for ((i=$1-1; i>=1; i--)); do + printf '\b\b%02d' "$i" + sleep 1 + done +} + +function fail() { + echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2 + exit 1 +} +# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details +export LANG=en_US.UTF8 +showmenu="no" +if [ -f /root/.showfuelmenu ]; then + . /root/.showfuelmenu +fi + +echo -n "Applying default Fuel settings..." +fuelmenu --save-only --iface=eth0 +echo "Done!" + +### OPNFV addition BEGIN +shopt -s nullglob +for script in /opt/opnfv/bootstrap/pre.d/*.sh +do + echo "Pre script: $script" >> /root/pre.log 2>&1 + $script >> /root/pre.log 2>&1 +done +shopt -u nullglob +### OPNFV addition END + +if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then + fuelmenu + else + #Give user 15 seconds to enter fuelmenu or else continue + echo + echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15" + countdown 15 & pid=$! + if ! read -s -n 1 -t 15 key; then + echo -e "\nSkipping Fuel Setup..." + else + { kill "$pid"; wait $!; } 2>/dev/null + case "$key" in + $'\e') echo "Skipping Fuel Setup.." + echo -n "Applying default Fuel setings..." + fuelmenu --save-only --iface=eth0 + echo "Done!" + ;; + *) echo -e "\nEntering Fuel Setup..." + fuelmenu + ;; + esac + fi +fi +#Reread /etc/sysconfig/network to inform puppet of changes +. /etc/sysconfig/network +hostname "$HOSTNAME" + +### docker stuff +images_dir="/var/www/nailgun/docker/images" + +# extract docker images +mkdir -p $images_dir $sources_dir +rm -f $images_dir/*tar +pushd $images_dir &>/dev/null + +echo "Extracting and loading docker images. (This may take a while)" +lrzip -d -o fuel-images.tar fuel-images.tar.lrz && tar -xf fuel-images.tar && rm -f fuel-images.tar +popd &>/dev/null +service docker start + +# load docker images +for image in $images_dir/*tar ; do + echo "Loading docker image ${image}..." + docker load -i "$image" + # clean up extracted image + rm -f "$image" +done + +# apply puppet +puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp +if [ $? -ge 4 ];then + fail +fi +rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote + +dockerctl check || fail +bash /etc/rc.local + +### OPNFV addition BEGIN +shopt -s nullglob +for script in /opt/opnfv/bootstrap/post.d/*.sh +do + echo "Post script: $script" >> /root/post.log 2>&1 + $script >> /root/post.log 2>&1 +done +shopt -u nullglob +### OPNFV addition END + +echo "Fuel node deployment complete!" diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig new file mode 100755 index 0000000..7b6e6bd --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig @@ -0,0 +1,84 @@ +#!/bin/bash + +function countdown() { + local i + sleep 1 + for ((i=$1-1; i>=1; i--)); do + printf '\b\b%02d' "$i" + sleep 1 + done +} + +function fail() { + echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2 + exit 1 +} +# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details +export LANG=en_US.UTF8 +showmenu="no" +if [ -f /root/.showfuelmenu ]; then + . /root/.showfuelmenu +fi + +echo -n "Applying default Fuel settings..." +fuelmenu --save-only --iface=eth0 +echo "Done!" + +if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then + fuelmenu + else + #Give user 15 seconds to enter fuelmenu or else continue + echo + echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15" + countdown 15 & pid=$! + if ! read -s -n 1 -t 15 key; then + echo -e "\nSkipping Fuel Setup..." + else + { kill "$pid"; wait $!; } 2>/dev/null + case "$key" in + $'\e') echo "Skipping Fuel Setup.." + echo -n "Applying default Fuel setings..." + fuelmenu --save-only --iface=eth0 + echo "Done!" + ;; + *) echo -e "\nEntering Fuel Setup..." + fuelmenu + ;; + esac + fi +fi +#Reread /etc/sysconfig/network to inform puppet of changes +. /etc/sysconfig/network +hostname "$HOSTNAME" + +### docker stuff +images_dir="/var/www/nailgun/docker/images" + +# extract docker images +mkdir -p $images_dir $sources_dir +rm -f $images_dir/*tar +pushd $images_dir &>/dev/null + +echo "Extracting and loading docker images. (This may take a while)" +lrzip -d -o fuel-images.tar fuel-images.tar.lrz && tar -xf fuel-images.tar && rm -f fuel-images.tar +popd &>/dev/null +service docker start + +# load docker images +for image in $images_dir/*tar ; do + echo "Loading docker image ${image}..." + docker load -i "$image" + # clean up extracted image + rm -f "$image" +done + +# apply puppet +puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp +if [ $? -ge 4 ];then + fail +fi +rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote + +dockerctl check || fail +bash /etc/rc.local +echo "Fuel node deployment complete!" diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh new file mode 100755 index 0000000..7ac8965 --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/00_post_example.sh @@ -0,0 +1,4 @@ +#/bin/sh +date +echo "This is an example file run at post-bootstrap." +exit 0 diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/01_fix_iommubug.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/01_fix_iommubug.sh new file mode 100755 index 0000000..79aa31a --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/01_fix_iommubug.sh @@ -0,0 +1,9 @@ +#/bin/sh +echo "Setting intel_iommu=off in bootstrap profile - a fix for the Dell systems" +echo "Old settings" +dockerctl shell cobbler cobbler profile report --name bootstrap +echo "Modifying" +dockerctl shell cobbler cobbler profile edit --name bootstrap --kopts "intel_iommu=off" --in-place +echo "New settings" +dockerctl shell cobbler cobbler profile report --name bootstrap + diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh new file mode 100755 index 0000000..bf7591b --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh @@ -0,0 +1,15 @@ +#/bin/sh +echo "Changing console speed to 115200 (std is 9600) on bootstrap" +echo "Old settings" +dockerctl shell cobbler cobbler profile report --name bootstrap +echo "Modifying" +dockerctl shell cobbler cobbler profile edit --name bootstrap --kopts "console=tty0 console=ttyS0,115200" --in-place +echo "New settings" +dockerctl shell cobbler cobbler profile report --name bootstrap +echo "Setting console speed to 115200 on ubuntu_1204_x86_64 (std is no serial console)" +echo "Old settings" +dockerctl shell cobbler cobbler profile report --name ubuntu_1204_x86_64 +echo "Modifying" +dockerctl shell cobbler cobbler profile edit --name ubuntu_1204_x86_64 --kopts "console=tty0 console=ttyS0,115200" --in-place +echo "New settings" +dockerctl shell cobbler cobbler profile report --name ubuntu_1204_x86_64 diff --git a/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh b/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh new file mode 100755 index 0000000..ac427bf --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/pre-scripts/00_pre_example.sh @@ -0,0 +1,4 @@ +#/bin/sh +date +echo "This is an example file run at pre-bootstrap." +exit 0 |