diff options
author | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2016-05-11 12:48:40 +0200 |
---|---|---|
committer | Stefan Berg <stefan.k.berg@ericsson.com> | 2016-05-30 15:09:16 +0000 |
commit | 6d672885e96f25309ef36da9a6b3c93968ec0c5e (patch) | |
tree | 9f55d1ea4abbccb9891c0c6d7fbab4a0946a7d18 /build | |
parent | 370cf3546e2f5e3a7afa69b4f306bd7c90d44397 (diff) |
Build system uplift to Fuel 9.0/Mitaka
Switching to Fuel 9.0/Mitaka for the build system.
Overhaul of the patching mechanism. As bootstrap_admin_node.sh has
been transitioned into an RPM (fuel-support), the lazy designer found
it more simple to patch that script during the Fuel build phase than
at the OPNFV ISO generation. The patch mechanism has been changed to a
normal context diff instead of the orig/modified file tuples
previously used. Hopefully this will require fewer manual rebases (may
the fuzz be with us!).
Also the ks.cfg patching has transitioned to a context based ordinary
patch for the same reasons, but this is as before taking place during
OPNFV ISO generation.
Patch naming made more descriptive.
The reaping mechanism has been slightly modified due to a change in
the naming of the node files when these are generated by the Fuel CLI.
IMPORTANT 1: The package cache mechanism is currently disabled, it is
only possible to install Fuel with a direct internet connection. This
will be fixed in a later change set!
IMPORTANT 2: All plugins has been disabled! As you have re-certified
your plugin with Fuel 9.0, please re-enable it in build/Makefile!
Change-Id: Ia918d16a74b68f89d178e06befe6e8a7a9367bf9
Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'build')
-rw-r--r-- | build/Makefile | 39 | ||||
-rw-r--r-- | build/bootstrap_admin_node.sh.patch | 73 | ||||
-rw-r--r-- | build/config.mk | 6 | ||||
-rw-r--r-- | build/docker/Dockerfile | 2 | ||||
-rw-r--r-- | build/f_isoroot/Makefile | 12 | ||||
-rw-r--r-- | build/f_isoroot/f_bootstrap/Makefile | 2 | ||||
-rwxr-xr-x | build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh | 498 | ||||
-rwxr-xr-x | build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig | 475 | ||||
-rw-r--r-- | build/f_isoroot/f_isolinux/Makefile | 15 | ||||
-rw-r--r-- | build/f_isoroot/f_isolinux/isolinux.cfg | 32 | ||||
-rw-r--r-- | build/f_isoroot/f_isolinux/isolinux.cfg.orig | 32 | ||||
-rw-r--r-- | build/f_isoroot/f_kscfg/Makefile | 16 | ||||
-rw-r--r-- | build/f_isoroot/f_kscfg/ks.cfg | 658 | ||||
-rwxr-xr-x | build/f_isoroot/f_kscfg/ks.cfg.orig | 650 | ||||
-rw-r--r-- | build/f_isoroot/f_kscfg/ks.cfg.patch | 31 | ||||
-rw-r--r-- | build/fuel-main_5.patch | 19 | ||||
-rw-r--r-- | build/fuel-main_cpio.patch | 36 | ||||
-rwxr-xr-x | build/fuel_build_loop | 2 | ||||
-rw-r--r-- | build/isolinux.cfg.patch | 24 | ||||
-rw-r--r-- | build/repo-mirror-cz.patch (renamed from build/fuel-main_7.patch) | 0 |
20 files changed, 187 insertions, 2435 deletions
diff --git a/build/Makefile b/build/Makefile index 7e4d5a09d..94e5b3460 100644 --- a/build/Makefile +++ b/build/Makefile @@ -18,10 +18,12 @@ SHELL = /bin/bash # BEGIN of variables to customize # #Input args -export ISOSRC = file:$(shell pwd)/fuel-8.0.iso +export MOSVERSION = 9.0 +export ISOSRC = file:$(shell pwd)/fuel-$(MOSVERSION).iso export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC)) export PRODNO = "OPNFV_FUEL" export REVSTATE = "P0000" +export USER ?= $(shell whoami) ifdef BUILD_FUEL_PLUGINS $(warning Overriding plugin build selection to $(BUILD_FUEL_PLUGINS)) @@ -52,11 +54,11 @@ export MIRROR_UBUNTU_ROOT := $(shell echo -n '/' ; echo "$(MIRROR_UBUNTU_URL)" | export LATEST_MIRROR_ID_URL := http://$(shell ./select_closest_fuel_mirror.py) export MIRROR_MOS_UBUNTU := $(shell echo "$(LATEST_MIRROR_ID_URL)" | cut -d'/' -f3) -export LATEST_TARGET_UBUNTU := $(shell curl -sSf "$(MIRROR_MOS_UBUNTU)/mos-repos/ubuntu/8.0.target.txt" | head -1) +export LATEST_TARGET_UBUNTU := $(shell curl -sSf "$(MIRROR_MOS_UBUNTU)/mos-repos/ubuntu/$(MOSVERSION).target.txt" | head -1) export MIRROR_MOS_UBUNTU_ROOT := /mos-repos/ubuntu/$(LATEST_TARGET_UBUNTU) -export LATEST_TARGET_CENTOS := $(shell curl -sSf "$(LATEST_MIRROR_ID_URL)/mos-repos/centos/mos8.0-centos7-fuel/os.target.txt" | head -1) -export MIRROR_FUEL := "$(LATEST_MIRROR_ID_URL)/mos-repos/centos/mos8.0-centos7-fuel/$(LATEST_TARGET_CENTOS)/x86_64" +export LATEST_TARGET_CENTOS := $(shell curl -sSf "$(LATEST_MIRROR_ID_URL)/mos-repos/centos/mos$(MOSVERSION)-centos7/os.target.txt" | head -1) +export MIRROR_FUEL := "$(LATEST_MIRROR_ID_URL)/mos-repos/centos/mos$(MOSVERSION)-centos7/$(LATEST_TARGET_CENTOS)/x86_64" # uncomment and use: make print-VARIABLE #print-% : ; @echo $* = $($*) @@ -104,26 +106,39 @@ $(ISOCACHE): fi cd /tmp/fuel-main && git checkout $(FUEL_MAIN_TAG) @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE) - # Patch for adding dosfstools, as Fuel 6.1 is running mkfs.vfat - cd /tmp/fuel-main && patch -f -p0 < $(TOPDIR)/fuel-main_5.patch # Patch for using the Czech Fuel mirror - # cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_7.patch - # Patch to counteract new cpio behavior - cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_cpio.patch + cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/repo-mirror-cz.patch # Remove Docker optimizations, otherwise multistrap will fail during # Fuel build. sudo rm -f /etc/apt/apt.conf.d/docker* # # Need to replace the old Docker v. 1.5.0 with a later version to be # able to access the Docker remote repository! - cd /tmp/fuel-main && patch -f -p0 < $(TOPDIR)/fuel-main_docker_version.patch - # + sudo apt-get install apt-transport-https ca-certificates -y + sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list + sudo apt-get update -y + sudo apt-get install docker-engine -y + sudo sh -c 'echo DOCKER_OPTS=\"--bip 172.45.0.1/24\" > /etc/default/docker' + sudo service docker stop || exit 0 + sudo service docker start + cd /tmp/fuel-main && ./prepare-build-env.sh # Verify that Docker is alive sudo docker info cd /tmp/fuel-main && make repos $(REPOINFO) -r /tmp/fuel-main > gitinfo_fuel.txt - # Repeat build up to ten times + # OPNFV patches at Fuel build time + # Need to be commited in order for them to be considered by the Fuel + # build system + cd /tmp/fuel-main/iso && git config user.name "Fuel OPNFV" + cd /tmp/fuel-main/iso && git config user.email "fuel@opnfv.org" + cd /tmp/fuel-main/iso && patch -p0 < $(TOPDIR)/bootstrap_admin_node.sh.patch + cd /tmp/fuel-main/iso && git add -u bootstrap_admin_node.sh + cd /tmp/fuel-main/iso/isolinux && patch -p0 < $(TOPDIR)/isolinux.cfg.patch + cd /tmp/fuel-main/iso/isolinux && git add -u isolinux.cfg + cd /tmp/fuel-main/iso && git commit -m "Added OPNFV patches" + # Repeat build up to three times sudo -E ./fuel_build_loop cp /tmp/fuel-main/build/artifacts/fuel*.iso . # Store artifact in cache straight away if caching is enabled diff --git a/build/bootstrap_admin_node.sh.patch b/build/bootstrap_admin_node.sh.patch new file mode 100644 index 000000000..aeef3f7b4 --- /dev/null +++ b/build/bootstrap_admin_node.sh.patch @@ -0,0 +1,73 @@ +*** bootstrap_admin_node.sh.orig Mon May 30 06:31:38 2016 +--- bootstrap_admin_node.sh Mon May 30 06:35:11 2016 +*************** +*** 339,346 **** + set +x + echo "Done!" + + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then +! fuelmenu || fail + else + # Give user 15 seconds to enter fuelmenu or else continue + echo +--- 339,360 ---- + set +x + 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 ++ ++ # Enable sshd ++ systemctl enable sshd ++ systemctl start sshd ++ + if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then +! fuelmenu + else + # Give user 15 seconds to enter fuelmenu or else continue + echo +*************** +*** 374,382 **** + [ ! -f /etc/fuel_build_id ] && \ + sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}" + +! # Enable sshd +! systemctl enable sshd +! systemctl start sshd + + # Enable iptables + systemctl enable iptables.service +--- 388,394 ---- + [ ! -f /etc/fuel_build_id ] && \ + sed -i "s|127.0.0.1:8080/ubuntu/x86_64|mirror.fuel-infra.org/mos-repos/ubuntu/${FUEL_RELEASE}|g" "${ASTUTE_YAML}" + +! systemctl reload sshd + + # Enable iptables + systemctl enable iptables.service +*************** +*** 529,534 **** +--- 541,556 ---- + + 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 ++ + if [ "`get_bootstrap_skip`" = "False" ]; then + build_ubuntu_bootstrap bs_status || true + else diff --git a/build/config.mk b/build/config.mk index eca426773..23bda18b2 100644 --- a/build/config.mk +++ b/build/config.mk @@ -9,9 +9,9 @@ ############################################################################## FUEL_MAIN_REPO := https://github.com/openstack/fuel-main -FUEL_MAIN_TAG = stable/8.0 -MOS_VERSION = 8.0 -OPENSTACK_VERSION = liberty-8.0 +FUEL_MAIN_TAG = 9.0 +MOS_VERSION = 9.0 +OPENSTACK_VERSION = mitaka-9.0 DOCKER_REPO := http://get.docker.com/builds/Linux/x86_64 DOCKER_TAG := docker-latest diff --git a/build/docker/Dockerfile b/build/docker/Dockerfile index 44ba74790..41a555f6c 100644 --- a/build/docker/Dockerfile +++ b/build/docker/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update RUN apt-get install -y software-properties-common python-software-properties \ make python-setuptools python-all dpkg-dev debhelper \ fuseiso git genisoimage bind9-host wget curl lintian tmux lxc iptables \ - ca-certificates sudo apt-utils lsb-release dosfstools debmirror + ca-certificates sudo apt-utils lsb-release dosfstools debmirror p7zip-full RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo RUN echo "Defaults env_keep += \"ftp_proxy http_proxy https_proxy no_proxy RSYNC_PROXY RSYNC_CONNECT_PROG npm_config_registry\"" > /etc/sudoers.d/keep-proxies diff --git a/build/f_isoroot/Makefile b/build/f_isoroot/Makefile index 878278942..20d2fb0b0 100644 --- a/build/f_isoroot/Makefile +++ b/build/f_isoroot/Makefile @@ -9,20 +9,24 @@ ############################################################################## # Add Fuel plugin build targets here -PLUGINS = f_odlpluginbuild f_onosfwpluginbuild f_ovsnfv-dpdk-pluginbuild f_vsperfpluginbuild f_qemupluginbuild f_ovs-nsh-dpdk-pluginbuild f_bgpvpn-pluginbuild +# Plugins disabled for the Fuel Mitaka uplift. Please re-enable your plugin as you have +# verified it! +PLUGINS = +#PLUGINS = f_odlpluginbuild f_onosfwpluginbuild f_ovsnfv-dpdk-pluginbuild f_vsperfpluginbuild f_qemupluginbuild f_ovs-nsh-dpdk-pluginbuild f_bgpvpn-pluginbuild export PLUGINS #NON_8-0_REBASED_PLUGINS = f_bgpvpn-pluginbuild # If the BUILD_FUEL_PLUGINS environment variable is set, only build the plugins # indicated therein. # Temporarilu disabling f_repobuild that currently have some issues on -# Fuel 8. +# Fuel Mitaka. ifdef BUILD_FUEL_PLUGINS export BUILD_FUEL_PLUGINS -SUBDIRS = f_kscfg f_bootstrap f_isolinux f_repobuild $(BUILD_FUEL_PLUGINS) +#SUBDIRS = f_kscfg f_bootstrap f_isolinux f_repobuild $(BUILD_FUEL_PLUGINS) +SUBDIRS = f_kscfg f_bootstrap f_isolinux $(BUILD_FUEL_PLUGINS) $(warning Overriding plugin build selection to $(BUILD_FUEL_PLUGINS)) else -SUBDIRS = f_kscfg f_bootstrap f_isolinux f_repobuild $(PLUGINS) +SUBDIRS = f_kscfg f_bootstrap f_isolinux $(PLUGINS) endif SUBCLEAN = $(addsuffix .clean,$(SUBDIRS)) diff --git a/build/f_isoroot/f_bootstrap/Makefile b/build/f_isoroot/f_bootstrap/Makefile index a958aa2d6..1c08405ab 100644 --- a/build/f_isoroot/f_bootstrap/Makefile +++ b/build/f_isoroot/f_bootstrap/Makefile @@ -17,8 +17,6 @@ all: @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: diff --git a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh deleted file mode 100755 index b096a7812..000000000 --- a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh +++ /dev/null @@ -1,498 +0,0 @@ -#!/bin/bash -mkdir -p /var/log/puppet -exec > >(tee -i /var/log/puppet/bootstrap_admin_node.log) -exec 2>&1 - -FUEL_RELEASE=$(cat /etc/fuel_release) -ASTUTE_YAML='/etc/fuel/astute.yaml' -BOOTSTRAP_NODE_CONFIG="/etc/fuel/bootstrap_admin_node.conf" -bs_build_log='/var/log/fuel-bootstrap-image-build.log' -bs_status=0 -# Backup network configs to this folder. Folder will be created only if -# backup process actually will be. -bup_folder="/var/bootstrap_admin_node_bup_$(date +%Y-%m-%d-%H-%M-%S)/" -### Long messages inside code makes them more complicated to read... -# bootstrap messages -# FIXME fix help links -bs_skip_message="WARNING: Ubuntu bootstrap build has been skipped. \ -Please build and activate bootstrap manually with CLI command \ -\`fuel-bootstrap build --activate\`. \ -While you don't activate any bootstrap - new nodes cannot be discovered \ -and added to cluster. \ -For more information please visit \ -https://docs.mirantis.com/openstack/fuel/fuel-master/" -bs_error_message="WARNING: Failed to build the bootstrap image, see $bs_build_log \ -for details. Perhaps your Internet connection is broken. Please fix the \ -problem and run \`fuel-bootstrap build --activate\`. \ -While you don\'t activate any bootstrap - new nodes cannot be discovered \ -and added to cluster. \ -For more information please visit \ -https://docs.mirantis.com/openstack/fuel/fuel-master/" -bs_progress_message="There is no active bootstrap. Bootstrap image building \ -is in progress. Usually it takes 15-20 minutes. It depends on your internet \ -connection and hardware performance. Please reboot failed to discover nodes \ -after bootstrap image become available." -bs_done_message="Default bootstrap image building done. Now you can boot new \ -nodes over PXE, they will be discovered and become available for installing \ -OpenStack on them" -bs_centos_message="WARNING: Deprecated Centos bootstrap has been chosen \ -and activated. Now you can boot new nodes over PXE, they will be discovered \ -and become available for installing OpenStack on them." -# Update issues messages -update_warn_message="There is an issue connecting to the Fuel update repository. \ -Please fix your connection prior to applying any updates. \ -Once the connection is fixed, we recommend reviewing and applying \ -Maintenance Updates for this release of Mirantis OpenStack: \ -https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\ -release-notes.html#maintenance-updates" -update_done_message="We recommend reviewing and applying Maintenance Updates \ -for this release of Mirantis OpenStack: \ -https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\ -release-notes.html#maintenance-updates" -fuelmenu_fail_message="Fuelmenu was not able to generate '/etc/fuel/astute.yaml' file! \ -Please, restart it manualy using 'fuelmenu' command." - -function countdown() { - local i - sleep 1 - for ((i=$1-1; i>=1; i--)); do - printf '\b\b\b\b%04d' "$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 -} - -function get_ethernet_interfaces() { - # Get list of all ethernet interfaces, non-virtual, not a wireless - for DEV in /sys/class/net/* ; do - # Take only links into account, skip files - if test ! -L $DEV ; then - continue - fi - DEVPATH=$(readlink -f $DEV) - # Avoid virtual devices like loopback, tunnels, bonding, vlans ... - case $DEVPATH in - */virtual/*) - continue - ;; - esac - IF=${DEVPATH##*/} - # Check ethernet only - case "`cat $DEV/type`" in - 1) - # TYPE=1 is ethernet, may also be wireless, bond, tunnel ... - # Virtual lo, bound, vlan, tunneling has been skipped before - if test -d $DEV/wireless -o -L $DEV/phy80211 ; - then - continue - else - # Catch ethernet non-virtual device - echo $IF - fi - ;; - *) continue - ;; - esac - done -} - -# Get value of a key from ifcfg-* files -# Usage: -# get_ifcfg_value NAME /etc/sysconfig/network-scripts/ifcfg-eth0 -function get_ifcfg_value { - local key=$1 - local path=$2 - local value='' - if [[ -f ${path} ]]; then - value=$(awk -F\= "\$1==\"${key}\" {print \$2}" ${path}) - value=${value//\"/} - fi - echo ${value} -} - -# Workaround to fix dracut network configuration approach: -# Bring down all network interfaces which have the same IP -# address statically configured as 'primary' interface -function ifdown_ethernet_interfaces { - local adminif_ipaddr - local if_config - local if_name - local if_ipaddr - - adminif_ipaddr=$(get_ifcfg_value IPADDR /etc/sysconfig/network-scripts/ifcfg-${ADMIN_INTERFACE}) - if [[ -z "${adminif_ipaddr}" ]]; then - return - fi - for if_config in $(find /etc/sysconfig/network-scripts -name 'ifcfg-*' ! -name 'ifcfg-lo'); do - if_name=$(get_ifcfg_value NAME $if_config) - if [[ "${if_name}" == "${ADMIN_INTERFACE}" ]]; then - continue - fi - if_ipaddr=$(get_ifcfg_value IPADDR $if_config) - if [[ "${if_ipaddr}" == "${adminif_ipaddr}" ]]; then - echo "Interface '${if_name}' uses the same ip '${if_ipaddr}' as admin interface '${ADMIN_INTERFACE}', removing ..." - ifdown ${if_name} - mkdir -p "${bup_folder}" - mv -f "${if_config}" "${bup_folder}" - fi - done -} - -# Check if interface name is valid by checking that -# a config file with NAME equal to given name exists. -function ifname_valid { - local adminif_name=$1 - local if_name - local if_config - for if_config in $(find /etc/sysconfig/network-scripts -name 'ifcfg-*' ! -name 'ifcfg-lo'); do - if_name=$(get_ifcfg_value NAME $if_config) - if [[ "${if_name}" == "${adminif_name}" ]]; then - return 0 - fi - done - return 1 -} - - -# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details -export LANG=en_US.UTF8 -# Be sure, that network devices have been initialized -udevadm trigger --subsystem-match=net -udevadm settle - -# Import bootstrap_admin_node.conf if exists -if [ -f "${BOOTSTRAP_NODE_CONFIG}" ]; then - source "${BOOTSTRAP_NODE_CONFIG}" -fi - -# Set defaults to unset / empty variables -# Although eth0 is not always valid it's a good well-known default -# If there is no such interface it will fail to pass ifname_valid -# check and will be replaced. -OLD_ADMIN_INTERFACE=${ADMIN_INTERFACE} -ADMIN_INTERFACE=${ADMIN_INTERFACE:-'eth0'} -showmenu=${showmenu:-'no'} - -# Now check that ADMIN_INTERFACE points to a valid interface -# If it doesn't fallback to getting the first interface name -# from a list of all available interfaces sorted alphabetically -if ! ifname_valid $ADMIN_INTERFACE; then - # Take the very first ethernet interface as an admin interface - ADMIN_INTERFACE=$(get_ethernet_interfaces | sort -V | head -1) -fi - -if [[ "${OLD_ADMIN_INTERFACE}" != "${ADMIN_INTERFACE}" ]]; then - echo "Saving ADMIN_INTERFACE value" - sed -ie "s/^ADMIN_INTERFACE=.*/ADMIN_INTERFACE=${ADMIN_INTERFACE}/g" \ - ${BOOTSTRAP_NODE_CONFIG} -fi - -echo "Applying admin interface '$ADMIN_INTERFACE'" -export ADMIN_INTERFACE - -echo "Bringing down ALL network interfaces except '${ADMIN_INTERFACE}'" -ifdown_ethernet_interfaces -systemctl restart network - -echo "Applying default Fuel settings..." -set -x -fuelmenu --save-only --iface=$ADMIN_INTERFACE -set +x -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 - -# Enable sshd -systemctl enable sshd -systemctl start sshd - -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 -e "\nEntering Fuel Setup..." - fuelmenu - ;; - esac - fi -fi - -if [ ! -f "${ASTUTE_YAML}" ]; then - echo ${fuelmenu_fail_message} - fail -fi - -systemctl reload sshd - -# Enable iptables -systemctl enable iptables.service -systemctl start iptables.service - - -if [ "$wait_for_external_config" == "yes" ]; then - wait_timeout=3000 - pidfile=/var/lock/wait_for_external_config - echo -n "Waiting for external configuration (or press ESC to skip)... -$wait_timeout" - countdown $wait_timeout & countdown_pid=$! - exec -a wait_for_external_config sleep $wait_timeout & wait_pid=$! - echo $wait_pid > $pidfile - while ps -p $countdown_pid &> /dev/null && ps -p $wait_pid &>/dev/null; do - read -s -n 1 -t 2 key - case "$key" in - $'\e') echo -e "\b\b\b\b abort on user input" - break - ;; - *) ;; - esac - done - { kill $countdown_pid $wait_pid & wait $!; } - rm -f $pidfile -fi - - -#Reread /etc/sysconfig/network to inform puppet of changes -. /etc/sysconfig/network -hostname "$HOSTNAME" - -# XXX: ssh keys which should be included into the bootstrap image are -# generated during containers deployment. However cobbler checkfs for -# a kernel and initramfs when creating a profile, which poses chicken -# and egg problem. Fortunately cobbler is pretty happy with empty files -# so it's easy to break the loop. -make_ubuntu_bootstrap_stub () { - local bootstrap_dir='/var/www/nailgun/bootstraps/active_bootstrap' - local bootstrap_stub_dir='/var/www/nailgun/bootstraps/bootstrap_stub' - mkdir -p ${bootstrap_stub_dir} - for item in vmlinuz initrd.img; do - touch "${bootstrap_stub_dir}/$item" - done - ln -s ${bootstrap_stub_dir} ${bootstrap_dir} || true -} - -get_bootstrap_flavor () { - python <<-EOF - from yaml import safe_load - with open("$ASTUTE_YAML", 'r') as f: - conf = safe_load(f).get('BOOTSTRAP', {}) - print(conf.get('flavor', 'centos').lower()) - EOF -} - -get_bootstrap_skip () { - python <<-EOF - from yaml import safe_load - with open("$ASTUTE_YAML", 'r') as f: - conf = safe_load(f).get('BOOTSTRAP', {}) - print(conf.get('skip_default_img_build', False)) - EOF -} - -set_ui_bootstrap_error () { - # This notify can't be closed or removed by user. - # For remove notify - send empty string. - local message=$1 - python <<-EOF - from fuel_bootstrap.utils import notifier - notifier.notify_webui('${message}') - EOF -} - -# Actually build the bootstrap image -build_ubuntu_bootstrap () { - local ret=1 - echo ${bs_progress_message} >&2 - set_ui_bootstrap_error "${bs_progress_message}" >&2 - if fuel-bootstrap -v --debug build --activate >>"$bs_build_log" 2>&1; then - ret=0 - fuel notify --topic "done" --send "${bs_done_message}" - else - ret=1 - set_ui_bootstrap_error "${bs_error_message}" >&2 - fi - # perform hard-return from func - # this part will update input $1 variable - local __resultvar=$1 - eval $__resultvar="'${ret}'" - return $ret -} - -# Create empty files to make cobbler happy -# (even if we don't use Ubuntu based bootstrap) -make_ubuntu_bootstrap_stub - -service docker start - -old_sysctl_vm_value=$(sysctl -n vm.min_free_kbytes) -if [ ${old_sysctl_vm_value} -lt 65535 ]; then - echo "Set vm.min_free_kbytes..." - sysctl -w vm.min_free_kbytes=65535 -fi - -if [ -f /root/.build_images ]; then - #Fail on all errors - set -e - trap fail EXIT - - echo "Loading Fuel base image for Docker..." - docker load -i /var/www/nailgun/docker/images/fuel-images.tar - - echo "Building Fuel Docker images..." - WORKDIR=$(mktemp -d /tmp/docker-buildXXX) - SOURCE=/var/www/nailgun/docker - REPO_CONT_ID=$(docker -D run -d -p 80 -v /var/www/nailgun:/var/www/nailgun fuel/centos sh -c 'mkdir -p /var/www/html/repo/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/repo/os/x86_64;ln -s /var/www/nailgun/mos-centos/x86_64 /var/www/html/mos-repo;/usr/sbin/apachectl -DFOREGROUND') - RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2) - - for imagesource in /var/www/nailgun/docker/sources/*; do - if ! [ -f "$imagesource/Dockerfile" ]; then - echo "Skipping ${imagesource}..." - continue - fi - image=$(basename "$imagesource") - cp -R "$imagesource" $WORKDIR/$image - mkdir -p $WORKDIR/$image/etc - cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc - sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile - sed -r -e 's/^"?PRODUCTION"?:.*/PRODUCTION: "docker-build"/' -i $WORKDIR/$image/etc/fuel/astute.yaml - # FIXME(kozhukalov): Once this patch https://review.openstack.org/#/c/219581/ is merged - # remove this line. fuel-library is to use PRODUCTION value from astute.yaml instead of - # the same value from version.yaml. It is a part of version.yaml deprecation plan. - sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml - docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image - done - docker rm -f $REPO_CONT_ID - rm -rf "$WORKDIR" - - #Remove trap for normal deployment - trap - EXIT - set +e -else - echo "Loading docker images. (This may take a while)" - docker load -i /var/www/nailgun/docker/images/fuel-images.tar -fi - -if [ ${old_sysctl_vm_value} -lt 65535 ]; then - echo "Restore sysctl vm.min_free_kbytes value..." - sysctl -w vm.min_free_kbytes=${old_sysctl_vm_value} -fi - -# apply puppet -puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp -if [ $? -ge 4 ];then - fail -fi - -# Sync time -systemctl stop ntpd -systemctl start ntpdate || echo "Failed to synchronize time with 'ntpdate'" -systemctl start ntpd - -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 - -if [ "`get_bootstrap_flavor`" = "ubuntu" ]; then - if [ "`get_bootstrap_skip`" = "False" ]; then - build_ubuntu_bootstrap bs_status || true - else - fuel notify --topic "warning" --send "${bs_skip_message}" - bs_status=2 - fi -else - fuel notify --topic "warning" --send "${bs_centos_message}" - bs_status=3 -fi - - -# Enable updates repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF -[mos${FUEL_RELEASE}-updates] -name=mos${FUEL_RELEASE}-updates -baseurl=http://mirror.fuel-infra.org/mos-repos/centos/mos${FUEL_RELEASE}-centos\$releasever-fuel/updates/x86_64/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -# Enable security repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF -[mos${FUEL_RELEASE}-security] -name=mos${FUEL_RELEASE}-security -baseurl=http://mirror.fuel-infra.org/mos-repos/centos/mos${FUEL_RELEASE}-centos\$releasever-fuel/security/x86_64/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -#Check if repo is accessible -echo "Checking for access to updates repository..." -repourl=$(yum repolist all -v | awk '{if ($1 ~ "baseurl" && $3 ~ "updates") print $3}' | head -1) -if urlaccesscheck check "$repourl" ; then - UPDATE_ISSUES=0 -else - UPDATE_ISSUES=1 -fi - -if [ $UPDATE_ISSUES -eq 1 ]; then - message=${update_warn_message} - level="warning" -else - message=${update_done_message} - level="done" -fi -echo -echo "*************************************************" -echo -e "${message}" -echo "*************************************************" -fuel notify --topic "${level}" --send $(echo "${message}" | tr '\r\n' ' ') 2>&1 - -# Perform bootstrap messaging to stdout -case ${bs_status} in - 1) - echo -e "${bs_error_message}" - echo "*************************************************" - ;; - 2) - echo -e "${bs_skip_message}" - echo "*************************************************" - ;; - 3) - echo -e "${bs_centos_message}" - echo "*************************************************" - ;; -esac - -echo "Fuel node deployment complete!" -# Sleep for agetty autologon -sleep 3 diff --git a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig deleted file mode 100755 index 69e38e42a..000000000 --- a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig +++ /dev/null @@ -1,475 +0,0 @@ -#!/bin/bash -mkdir -p /var/log/puppet -exec > >(tee -i /var/log/puppet/bootstrap_admin_node.log) -exec 2>&1 - -FUEL_RELEASE=$(cat /etc/fuel_release) -ASTUTE_YAML='/etc/fuel/astute.yaml' -BOOTSTRAP_NODE_CONFIG="/etc/fuel/bootstrap_admin_node.conf" -bs_build_log='/var/log/fuel-bootstrap-image-build.log' -bs_status=0 -# Backup network configs to this folder. Folder will be created only if -# backup process actually will be. -bup_folder="/var/bootstrap_admin_node_bup_$(date +%Y-%m-%d-%H-%M-%S)/" -### Long messages inside code makes them more complicated to read... -# bootstrap messages -# FIXME fix help links -bs_skip_message="WARNING: Ubuntu bootstrap build has been skipped. \ -Please build and activate bootstrap manually with CLI command \ -\`fuel-bootstrap build --activate\`. \ -While you don't activate any bootstrap - new nodes cannot be discovered \ -and added to cluster. \ -For more information please visit \ -https://docs.mirantis.com/openstack/fuel/fuel-master/" -bs_error_message="WARNING: Failed to build the bootstrap image, see $bs_build_log \ -for details. Perhaps your Internet connection is broken. Please fix the \ -problem and run \`fuel-bootstrap build --activate\`. \ -While you don\'t activate any bootstrap - new nodes cannot be discovered \ -and added to cluster. \ -For more information please visit \ -https://docs.mirantis.com/openstack/fuel/fuel-master/" -bs_progress_message="There is no active bootstrap. Bootstrap image building \ -is in progress. Usually it takes 15-20 minutes. It depends on your internet \ -connection and hardware performance. Please reboot failed to discover nodes \ -after bootstrap image become available." -bs_done_message="Default bootstrap image building done. Now you can boot new \ -nodes over PXE, they will be discovered and become available for installing \ -OpenStack on them" -bs_centos_message="WARNING: Deprecated Centos bootstrap has been chosen \ -and activated. Now you can boot new nodes over PXE, they will be discovered \ -and become available for installing OpenStack on them." -# Update issues messages -update_warn_message="There is an issue connecting to the Fuel update repository. \ -Please fix your connection prior to applying any updates. \ -Once the connection is fixed, we recommend reviewing and applying \ -Maintenance Updates for this release of Mirantis OpenStack: \ -https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\ -release-notes.html#maintenance-updates" -update_done_message="We recommend reviewing and applying Maintenance Updates \ -for this release of Mirantis OpenStack: \ -https://docs.mirantis.com/openstack/fuel/fuel-${FUEL_RELEASE}/\ -release-notes.html#maintenance-updates" -fuelmenu_fail_message="Fuelmenu was not able to generate '/etc/fuel/astute.yaml' file! \ -Please, restart it manualy using 'fuelmenu' command." - -function countdown() { - local i - sleep 1 - for ((i=$1-1; i>=1; i--)); do - printf '\b\b\b\b%04d' "$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 -} - -function get_ethernet_interfaces() { - # Get list of all ethernet interfaces, non-virtual, not a wireless - for DEV in /sys/class/net/* ; do - # Take only links into account, skip files - if test ! -L $DEV ; then - continue - fi - DEVPATH=$(readlink -f $DEV) - # Avoid virtual devices like loopback, tunnels, bonding, vlans ... - case $DEVPATH in - */virtual/*) - continue - ;; - esac - IF=${DEVPATH##*/} - # Check ethernet only - case "`cat $DEV/type`" in - 1) - # TYPE=1 is ethernet, may also be wireless, bond, tunnel ... - # Virtual lo, bound, vlan, tunneling has been skipped before - if test -d $DEV/wireless -o -L $DEV/phy80211 ; - then - continue - else - # Catch ethernet non-virtual device - echo $IF - fi - ;; - *) continue - ;; - esac - done -} - -# Get value of a key from ifcfg-* files -# Usage: -# get_ifcfg_value NAME /etc/sysconfig/network-scripts/ifcfg-eth0 -function get_ifcfg_value { - local key=$1 - local path=$2 - local value='' - if [[ -f ${path} ]]; then - value=$(awk -F\= "\$1==\"${key}\" {print \$2}" ${path}) - value=${value//\"/} - fi - echo ${value} -} - -# Workaround to fix dracut network configuration approach: -# Bring down all network interfaces which have the same IP -# address statically configured as 'primary' interface -function ifdown_ethernet_interfaces { - local adminif_ipaddr - local if_config - local if_name - local if_ipaddr - - adminif_ipaddr=$(get_ifcfg_value IPADDR /etc/sysconfig/network-scripts/ifcfg-${ADMIN_INTERFACE}) - if [[ -z "${adminif_ipaddr}" ]]; then - return - fi - for if_config in $(find /etc/sysconfig/network-scripts -name 'ifcfg-*' ! -name 'ifcfg-lo'); do - if_name=$(get_ifcfg_value NAME $if_config) - if [[ "${if_name}" == "${ADMIN_INTERFACE}" ]]; then - continue - fi - if_ipaddr=$(get_ifcfg_value IPADDR $if_config) - if [[ "${if_ipaddr}" == "${adminif_ipaddr}" ]]; then - echo "Interface '${if_name}' uses the same ip '${if_ipaddr}' as admin interface '${ADMIN_INTERFACE}', removing ..." - ifdown ${if_name} - mkdir -p "${bup_folder}" - mv -f "${if_config}" "${bup_folder}" - fi - done -} - -# Check if interface name is valid by checking that -# a config file with NAME equal to given name exists. -function ifname_valid { - local adminif_name=$1 - local if_name - local if_config - for if_config in $(find /etc/sysconfig/network-scripts -name 'ifcfg-*' ! -name 'ifcfg-lo'); do - if_name=$(get_ifcfg_value NAME $if_config) - if [[ "${if_name}" == "${adminif_name}" ]]; then - return 0 - fi - done - return 1 -} - - -# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details -export LANG=en_US.UTF8 -# Be sure, that network devices have been initialized -udevadm trigger --subsystem-match=net -udevadm settle - -# Import bootstrap_admin_node.conf if exists -if [ -f "${BOOTSTRAP_NODE_CONFIG}" ]; then - source "${BOOTSTRAP_NODE_CONFIG}" -fi - -# Set defaults to unset / empty variables -# Although eth0 is not always valid it's a good well-known default -# If there is no such interface it will fail to pass ifname_valid -# check and will be replaced. -OLD_ADMIN_INTERFACE=${ADMIN_INTERFACE} -ADMIN_INTERFACE=${ADMIN_INTERFACE:-'eth0'} -showmenu=${showmenu:-'no'} - -# Now check that ADMIN_INTERFACE points to a valid interface -# If it doesn't fallback to getting the first interface name -# from a list of all available interfaces sorted alphabetically -if ! ifname_valid $ADMIN_INTERFACE; then - # Take the very first ethernet interface as an admin interface - ADMIN_INTERFACE=$(get_ethernet_interfaces | sort -V | head -1) -fi - -if [[ "${OLD_ADMIN_INTERFACE}" != "${ADMIN_INTERFACE}" ]]; then - echo "Saving ADMIN_INTERFACE value" - sed -ie "s/^ADMIN_INTERFACE=.*/ADMIN_INTERFACE=${ADMIN_INTERFACE}/g" \ - ${BOOTSTRAP_NODE_CONFIG} -fi - -echo "Applying admin interface '$ADMIN_INTERFACE'" -export ADMIN_INTERFACE - -echo "Bringing down ALL network interfaces except '${ADMIN_INTERFACE}'" -ifdown_ethernet_interfaces -systemctl restart network - -echo "Applying default Fuel settings..." -set -x -fuelmenu --save-only --iface=$ADMIN_INTERFACE -set +x -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 -e "\nEntering Fuel Setup..." - fuelmenu - ;; - esac - fi -fi - -if [ ! -f "${ASTUTE_YAML}" ]; then - echo ${fuelmenu_fail_message} - fail -fi - -# Enable sshd -systemctl enable sshd -systemctl start sshd - -# Enable iptables -systemctl enable iptables.service -systemctl start iptables.service - - -if [ "$wait_for_external_config" == "yes" ]; then - wait_timeout=3000 - pidfile=/var/lock/wait_for_external_config - echo -n "Waiting for external configuration (or press ESC to skip)... -$wait_timeout" - countdown $wait_timeout & countdown_pid=$! - exec -a wait_for_external_config sleep $wait_timeout & wait_pid=$! - echo $wait_pid > $pidfile - while ps -p $countdown_pid &> /dev/null && ps -p $wait_pid &>/dev/null; do - read -s -n 1 -t 2 key - case "$key" in - $'\e') echo -e "\b\b\b\b abort on user input" - break - ;; - *) ;; - esac - done - { kill $countdown_pid $wait_pid & wait $!; } - rm -f $pidfile -fi - - -#Reread /etc/sysconfig/network to inform puppet of changes -. /etc/sysconfig/network -hostname "$HOSTNAME" - -# XXX: ssh keys which should be included into the bootstrap image are -# generated during containers deployment. However cobbler checkfs for -# a kernel and initramfs when creating a profile, which poses chicken -# and egg problem. Fortunately cobbler is pretty happy with empty files -# so it's easy to break the loop. -make_ubuntu_bootstrap_stub () { - local bootstrap_dir='/var/www/nailgun/bootstraps/active_bootstrap' - local bootstrap_stub_dir='/var/www/nailgun/bootstraps/bootstrap_stub' - mkdir -p ${bootstrap_stub_dir} - for item in vmlinuz initrd.img; do - touch "${bootstrap_stub_dir}/$item" - done - ln -s ${bootstrap_stub_dir} ${bootstrap_dir} || true -} - -get_bootstrap_flavor () { - python <<-EOF - from yaml import safe_load - with open("$ASTUTE_YAML", 'r') as f: - conf = safe_load(f).get('BOOTSTRAP', {}) - print(conf.get('flavor', 'centos').lower()) - EOF -} - -get_bootstrap_skip () { - python <<-EOF - from yaml import safe_load - with open("$ASTUTE_YAML", 'r') as f: - conf = safe_load(f).get('BOOTSTRAP', {}) - print(conf.get('skip_default_img_build', False)) - EOF -} - -set_ui_bootstrap_error () { - # This notify can't be closed or removed by user. - # For remove notify - send empty string. - local message=$1 - python <<-EOF - from fuel_bootstrap.utils import notifier - notifier.notify_webui('${message}') - EOF -} - -# Actually build the bootstrap image -build_ubuntu_bootstrap () { - local ret=1 - echo ${bs_progress_message} >&2 - set_ui_bootstrap_error "${bs_progress_message}" >&2 - if fuel-bootstrap -v --debug build --activate >>"$bs_build_log" 2>&1; then - ret=0 - fuel notify --topic "done" --send "${bs_done_message}" - else - ret=1 - set_ui_bootstrap_error "${bs_error_message}" >&2 - fi - # perform hard-return from func - # this part will update input $1 variable - local __resultvar=$1 - eval $__resultvar="'${ret}'" - return $ret -} - -# Create empty files to make cobbler happy -# (even if we don't use Ubuntu based bootstrap) -make_ubuntu_bootstrap_stub - -service docker start - -old_sysctl_vm_value=$(sysctl -n vm.min_free_kbytes) -if [ ${old_sysctl_vm_value} -lt 65535 ]; then - echo "Set vm.min_free_kbytes..." - sysctl -w vm.min_free_kbytes=65535 -fi - -if [ -f /root/.build_images ]; then - #Fail on all errors - set -e - trap fail EXIT - - echo "Loading Fuel base image for Docker..." - docker load -i /var/www/nailgun/docker/images/fuel-images.tar - - echo "Building Fuel Docker images..." - WORKDIR=$(mktemp -d /tmp/docker-buildXXX) - SOURCE=/var/www/nailgun/docker - REPO_CONT_ID=$(docker -D run -d -p 80 -v /var/www/nailgun:/var/www/nailgun fuel/centos sh -c 'mkdir -p /var/www/html/repo/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/repo/os/x86_64;ln -s /var/www/nailgun/mos-centos/x86_64 /var/www/html/mos-repo;/usr/sbin/apachectl -DFOREGROUND') - RANDOM_PORT=$(docker port $REPO_CONT_ID 80 | cut -d':' -f2) - - for imagesource in /var/www/nailgun/docker/sources/*; do - if ! [ -f "$imagesource/Dockerfile" ]; then - echo "Skipping ${imagesource}..." - continue - fi - image=$(basename "$imagesource") - cp -R "$imagesource" $WORKDIR/$image - mkdir -p $WORKDIR/$image/etc - cp -R /etc/puppet /etc/fuel $WORKDIR/$image/etc - sed -e "s/_PORT_/${RANDOM_PORT}/" -i $WORKDIR/$image/Dockerfile - sed -r -e 's/^"?PRODUCTION"?:.*/PRODUCTION: "docker-build"/' -i $WORKDIR/$image/etc/fuel/astute.yaml - # FIXME(kozhukalov): Once this patch https://review.openstack.org/#/c/219581/ is merged - # remove this line. fuel-library is to use PRODUCTION value from astute.yaml instead of - # the same value from version.yaml. It is a part of version.yaml deprecation plan. - sed -e 's/production:.*/production: "docker-build"/' -i $WORKDIR/$image/etc/fuel/version.yaml - docker build -t fuel/${image}_${FUEL_RELEASE} $WORKDIR/$image - done - docker rm -f $REPO_CONT_ID - rm -rf "$WORKDIR" - - #Remove trap for normal deployment - trap - EXIT - set +e -else - echo "Loading docker images. (This may take a while)" - docker load -i /var/www/nailgun/docker/images/fuel-images.tar -fi - -if [ ${old_sysctl_vm_value} -lt 65535 ]; then - echo "Restore sysctl vm.min_free_kbytes value..." - sysctl -w vm.min_free_kbytes=${old_sysctl_vm_value} -fi - -# apply puppet -puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp -if [ $? -ge 4 ];then - fail -fi - -# Sync time -systemctl stop ntpd -systemctl start ntpdate || echo "Failed to synchronize time with 'ntpdate'" -systemctl start ntpd - -rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote - -dockerctl check || fail -bash /etc/rc.local - -if [ "`get_bootstrap_flavor`" = "ubuntu" ]; then - if [ "`get_bootstrap_skip`" = "False" ]; then - build_ubuntu_bootstrap bs_status || true - else - fuel notify --topic "warning" --send "${bs_skip_message}" - bs_status=2 - fi -else - fuel notify --topic "warning" --send "${bs_centos_message}" - bs_status=3 -fi - -# Enable updates repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-updates.repo << EOF -[mos${FUEL_RELEASE}-updates] -name=mos${FUEL_RELEASE}-updates -baseurl=http://mirror.fuel-infra.org/mos-repos/centos/mos${FUEL_RELEASE}-centos\$releasever-fuel/updates/x86_64/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -# Enable security repository -cat > /etc/yum.repos.d/mos${FUEL_RELEASE}-security.repo << EOF -[mos${FUEL_RELEASE}-security] -name=mos${FUEL_RELEASE}-security -baseurl=http://mirror.fuel-infra.org/mos-repos/centos/mos${FUEL_RELEASE}-centos\$releasever-fuel/security/x86_64/ -gpgcheck=0 -skip_if_unavailable=1 -EOF - -#Check if repo is accessible -echo "Checking for access to updates repository..." -repourl=$(yum repolist all -v | awk '{if ($1 ~ "baseurl" && $3 ~ "updates") print $3}' | head -1) -if urlaccesscheck check "$repourl" ; then - UPDATE_ISSUES=0 -else - UPDATE_ISSUES=1 -fi - -if [ $UPDATE_ISSUES -eq 1 ]; then - message=${update_warn_message} - level="warning" -else - message=${update_done_message} - level="done" -fi -echo -echo "*************************************************" -echo -e "${message}" -echo "*************************************************" -fuel notify --topic "${level}" --send $(echo "${message}" | tr '\r\n' ' ') 2>&1 - -# Perform bootstrap messaging to stdout -case ${bs_status} in - 1) - echo -e "${bs_error_message}" - echo "*************************************************" - ;; - 2) - echo -e "${bs_skip_message}" - echo "*************************************************" - ;; - 3) - echo -e "${bs_centos_message}" - echo "*************************************************" - ;; -esac - -echo "Fuel node deployment complete!" -# Sleep for agetty autologon -sleep 3 diff --git a/build/f_isoroot/f_isolinux/Makefile b/build/f_isoroot/f_isolinux/Makefile index b683ea38c..f3e09b234 100644 --- a/build/f_isoroot/f_isolinux/Makefile +++ b/build/f_isoroot/f_isolinux/Makefile @@ -11,16 +11,19 @@ TOP := $(shell pwd) .PHONY: all -all: +all: isolinux.cfg.iso @mkdir -p release/isolinux - grep -q OpenStack_Fuel isolinux.cfg - sed "s/OpenStack_Fuel/$(PRODNO)_$(REVSTATE)/g" isolinux.cfg > isolinux.cfg.patched - @cp isolinux.cfg.patched release/isolinux/isolinux.cfg - @cp isolinux.cfg.orig release/isolinux/ + grep -q OpenStack_Fuel isolinux.cfg.iso + sed "s/OpenStack_Fuel/$(PRODNO)_$(REVSTATE)/g" isolinux.cfg.iso > isolinux.cfg + @cp isolinux.cfg release/isolinux/isolinux.cfg + @cp isolinux.cfg.iso release/isolinux/isolinux.cfg.orig + +isolinux.cfg.iso: + 7z -so x $(ISOCACHE) isolinux/isolinux.cfg > isolinux.cfg.iso .PHONY: clean clean: - @rm -rf release isolinux.cfg.patched + @rm -rf release isolinux.cfg.iso isolinux.cfg .PHONY: release release: all diff --git a/build/f_isoroot/f_isolinux/isolinux.cfg b/build/f_isoroot/f_isolinux/isolinux.cfg deleted file mode 100644 index 3e100134d..000000000 --- a/build/f_isoroot/f_isolinux/isolinux.cfg +++ /dev/null @@ -1,32 +0,0 @@ -default vesamenu.c32 -#prompt 1 -timeout 300 - -display boot.msg - -menu background splash.jpg -menu title Welcome to Fuel Installer (version: 8.0) -menu color border 0 #ffffffff #00000000 -menu color sel 7 #ffffffff #ff000000 -menu color title 0 #ffffffff #00000000 -menu color tabmsg 0 #ffffffff #00000000 -menu color unsel 0 #ffffffff #00000000 -menu color hotsel 0 #ff000000 #ffffffff -menu color hotkey 7 #ffffffff #ff000000 -menu color scrollbar 0 #ffffffff #00000000 - -label nailgun - menu label ^1. Fuel Install (Static IP) - menu default - kernel vmlinuz - append initrd=initrd.img net.ifnames=0 biosdevname=0 ks=hd:sr0:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: dns1=10.20.0.1 selinux=0 showmenu=yes - -label nailgunifname - menu label ^2. Fuel Advanced Install (Static IP) - kernel vmlinuz - append initrd=initrd.img ks=hd:sr0:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: dns1=10.20.0.1 selinux=0 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes - -label usbboot - menu label ^3. USB Fuel Install (Static IP) - kernel vmlinuz - append initrd=initrd.img net.ifnames=0 biosdevname=0 repo=hd:LABEL=OpenStack_Fuel:/ ks=hd:LABEL=OpenStack_Fuel:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: dns1=10.20.0.1 showmenu=yes diff --git a/build/f_isoroot/f_isolinux/isolinux.cfg.orig b/build/f_isoroot/f_isolinux/isolinux.cfg.orig deleted file mode 100644 index c92ddd891..000000000 --- a/build/f_isoroot/f_isolinux/isolinux.cfg.orig +++ /dev/null @@ -1,32 +0,0 @@ -default vesamenu.c32 -#prompt 1 -timeout 300 - -display boot.msg - -menu background splash.jpg -menu title Welcome to Fuel Installer (version: 8.0) -menu color border 0 #ffffffff #00000000 -menu color sel 7 #ffffffff #ff000000 -menu color title 0 #ffffffff #00000000 -menu color tabmsg 0 #ffffffff #00000000 -menu color unsel 0 #ffffffff #00000000 -menu color hotsel 0 #ff000000 #ffffffff -menu color hotkey 7 #ffffffff #ff000000 -menu color scrollbar 0 #ffffffff #00000000 - -label nailgun - menu label ^1. Fuel Install (Static IP) - menu default - kernel vmlinuz - append initrd=initrd.img net.ifnames=0 biosdevname=0 ks=hd:sr0:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: dns1=10.20.0.1 selinux=0 - -label nailgunifname - menu label ^2. Fuel Advanced Install (Static IP) - kernel vmlinuz - append initrd=initrd.img ks=hd:sr0:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: dns1=10.20.0.1 selinux=0 ifname=adminif:XX:XX:XX:XX:XX:XX - -label usbboot - menu label ^3. USB Fuel Install (Static IP) - kernel vmlinuz - append initrd=initrd.img net.ifnames=0 biosdevname=0 repo=hd:LABEL=OpenStack_Fuel:/ ks=hd:LABEL=OpenStack_Fuel:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: dns1=10.20.0.1 showmenu=yes diff --git a/build/f_isoroot/f_kscfg/Makefile b/build/f_isoroot/f_kscfg/Makefile index 2a82a1803..cfd433f8d 100644 --- a/build/f_isoroot/f_kscfg/Makefile +++ b/build/f_isoroot/f_kscfg/Makefile @@ -11,16 +11,20 @@ TOP := $(shell pwd) .PHONY: all -all: +all: ks.cfg.iso @mkdir -p release - grep -q OpenStack_Fuel ks.cfg - sed "s/OpenStack_Fuel/$(PRODNO)_$(REVSTATE)/g" ks.cfg > ks.cfg.patched - @cp ks.cfg.patched release/ks.cfg - @cp ks.cfg.orig release + grep -q OpenStack_Fuel ks.cfg.iso + sed "s/OpenStack_Fuel/$(PRODNO)_$(REVSTATE)/g" ks.cfg.iso > ks.cfg + /usr/bin/patch -p0 < ks.cfg.patch + @cp ks.cfg.iso release/ks.cfg.orig + @cp ks.cfg release/ks.cfg + +ks.cfg.iso: + 7z -so x $(ISOCACHE) ks.cfg > ks.cfg.iso .PHONY: clean clean: - @rm -rf release ks.cfg.patched + @rm -rf release ks.cfg.iso ks.cfg .PHONY: release release: all diff --git a/build/f_isoroot/f_kscfg/ks.cfg b/build/f_isoroot/f_kscfg/ks.cfg deleted file mode 100644 index c93babed7..000000000 --- a/build/f_isoroot/f_kscfg/ks.cfg +++ /dev/null @@ -1,658 +0,0 @@ -install -text -#%include /tmp/source.ks -cdrom -reboot --eject -lang en_US.UTF-8 -keyboard us -rootpw r00tme -timezone --utc Etc/UTC -firewall --disabled -selinux --disabled -# ignore unsupported hardware warning -unsupported_hardware -# SKIP CONFIGURING X -skipx -repo --name="mos-centos" --baseurl=file:///run/install/repo/mos-centos/ --cost=100 - -# NEVER ever place zerombr here, it breaks automated installation -%include /tmp/bootloader.ks -%include /tmp/partition.ks -%include /tmp/post_partition.ks - - - - - -%packages --nobase -@Core -fuel -fuel-library -fuel-dockerctl -authconfig -bind-utils -bridge-utils -cronie -crontabs -curl -dhcp -docker -fuel-bootstrap-cli -fuel-bootstrap-image -# NOTE(kozhukalov): We don't need target centos images in 8.0 -# fuel-target-centos-images7.1.1503 -fuelmenu -fuel-docker-images -fuel-mirror -fuel-openstack-metadata -gdisk -lrzip -lsof -man -mlocate -nmap-ncat -ntp -ntpdate -openssh-clients -policycoreutils -python-pypcap -rsync -puppet -rubygem-netaddr -rubygem-openstack -selinux-policy-targeted -strace -sysstat -system-config-firewall-base -tcpdump -telnet -vim -virt-what -wget -yum -yum-plugin-priorities -%end - - - - - -# PREINSTALL SECTION -# HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE -# INSTALLATION PROCESS ITSELF -%pre -#!/bin/sh - -# hard drives -drives="" -removable_drives="" -for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do - if !(blkid | grep -q "${drv}.*Fuel"); then - if (grep -q 0 /sys/block/${drv}/removable); then - drives="${drives} ${drv}" - else - removable_drives="${removable_drives} ${drv}" - fi - fi -done -default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` - -installdrive=${installdrive:-undefined} -forceformat=${forceformat:-no} -for I in $(cat /proc/cmdline); do - case "$I" in - *=*) - if ! [[ "${I}" =~ "." ]]; then eval "$I"; fi - ;; - esac -done - -set ${drives} ${removable_drives} -numdrives=`echo $#` - -tgtdrive="${installdrive}" - -function confirm_format { - check_drive="$1" - local confirm_format="no" - - if [[ "$forceformat" == "yes" ]] ; then - return 0 - fi - - if parted -s /dev/$check_drive print &>/dev/null ; then - echo - echo "$check_drive drive contains partition table:" - parted -s /dev/$check_drive print - echo - read -p "Are you sure you want to erase ALL data on disk $check_drive? (y/N)" confirm_format - if [[ "$confirm_format" == "y" ]] || [[ "$confirm_format" == "Y" ]] || [[ "$forceformat" == "yes" ]]; then - return 0 - else - return 1 - fi - else - return 0 - fi -} - -format_confirmed="no" - -if [ $numdrives -lt 1 ]; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - clear - echo - echo '********************************************************************' - echo '* E R R O R *' - echo '* *' - echo '* There is no suitable media available for installation. *' - echo '* Please attach a drive and try again. *' - echo '* *' - echo '********************************************************************' - echo - read -p "Press Enter to shut down the system: " _ - poweroff -fi - -if [ ${numdrives} -gt 1 ] || [ `echo ${drives} | wc -w` -eq 0 ] ; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - while [ "${tgtdrive}" = "undefined" ]; do - clear - echo - echo '********************************************************************************' - echo '* W A R N I N G *' - echo '* *' - echo '* Which of the detected hard drives do you want to be used as *' - echo '* the installation target? *' - echo '* *' - echo '********************************************************************************' - echo - echo "Possible choices" - echo "Persistent drives: ${drives}" - echo "Removable drives: ${removable_drives}" - echo - if [ `echo ${drives} | wc -w` -eq 1 ] ; then - read -t 30 -p "Choose hard drive: " tgtdrive || tgtdrive=$default_drive - else - read -p "Choose hard drive: " tgtdrive - fi - match="no" - for drive in ${drives[@]} ${removable_drives[@]}; do - if [[ "$drive" == "$tgtdrive" ]] && match="yes" ; then - if confirm_format $tgtdrive ; then - format_confirmed="yes" - break - else - tgtdrive="undefined" - read -p "You may select another disk. Press Enter to continue." _ - fi - fi - done - if [[ "$match" == "no" ]]; then - tgtdrive="undefined" - read -p "Invalid choice. Press Enter to continue." _ - fi - done - clear - chvt 1 -else - tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"` -fi - -if [ "$format_confirmed" != "yes" ] ; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - if ! confirm_format $tgtdrive ; then - clear - echo - echo '********************************************************************' - echo '* E R R O R *' - echo '* *' - echo '* Disk $tgtdrive contains active partition(s). *' - echo '* Installation cannot continue without confirmation. *' - echo '* *' - echo '********************************************************************' - echo - read -p "Press Enter to restart: " _ - reboot - fi - chvt 1 -fi - -# verify tgtdrive is at least 45GB -tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 )) -if [ $tgtdrivesize -lt 46080 ]; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - clear - echo - echo '********************************************************************' - echo '* E R R O R *' - echo '* *' - echo '* Your disk is under 45GB in size. Installation cannot continue. *' - echo '* Restart installation with a larger disk. *' - echo '* *' - echo '********************************************************************' - echo - read -p "Press Enter to restart: " _ - reboot -fi - -# paths in /dev have "/" instead of "!" for cciss devices -tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//') - -# source -if test -e /dev/disk/by-label/OpenStack_Fuel; then - echo "harddrive --partition=LABEL=OpenStack_Fuel --dir=/" > /tmp/source.ks -elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then - echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks -else - echo "cdrom" > /tmp/source.ks -fi - -vgdisplay -c | cut -d':' -f1 | xargs vgremove -ff -dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10 -sleep 3 -hdparm -z /dev/${tgtdrive} -parted -s /dev/${tgtdrive} mklabel gpt -parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0% 24 -parted -s /dev/${tgtdrive} set 1 bios_grub on -parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224 -parted -s /dev/${tgtdrive} set 2 boot on -parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 224 424 -sleep 3 -hdparm -z /dev/${tgtdrive} - -# partition - -# This adds support for the p seperator required for cciss devices -if echo ${tgtdrive} | grep -q -e cciss ; then - bootdev=${tgtdrive}p -else - bootdev=${tgtdrive} -fi - -cat << EOF > /tmp/partition.ks -part /boot --onpart=/dev/${bootdev}3 -part /boot/efi --onpart=/dev/${bootdev}2 -part pv.001 --ondisk=${tgtdrive} --size=25000 --grow -part pv.002 --ondisk=${tgtdrive} --size=20000 -volgroup os pv.001 -volgroup docker pv.002 -logvol swap --vgname=os --recommended --name=swap -logvol / --vgname=os --size=10000 --name=root --fstype=ext4 -logvol /var --vgname=os --grow --percent 40 --name=var --fstype=ext4 -logvol /var/log --vgname=os --grow --percent 60 --name=varlog --fstype=ext4 -EOF - - - -# bootloader -echo "bootloader --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks - -# Anaconda can not install grub 0.97 on disks which are >4T. -# The reason is that grub does not support such large geometries -# and it simply thinks that the cylinder number has negative value. -# Here we just set geometry manually so that grub thinks that disk -# size is equal to 1G. -# 130 cylinders * (16065 * 512 = 8225280 bytes) = 1G -echo "%post --nochroot --log=/mnt/sysimage/root/anaconda-post-partition.log" > /tmp/post_partition.ks -echo "echo \"device (hd0) /dev/${tgtdrive}\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo \"geometry (hd0) 130 255 63\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks -echo "%end" >> /tmp/post_partition.ks -%end - - - - - -# POSTINSTALL SECTIONS -# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER -# INSTALLATION ITSELF COMPLETED - - -# Parse /proc/cmdline and save for next steps -%post --log=/root/anaconda-parse-cmdline.log -#!/bin/bash -set -x - -# Parse cmdline to alter keys which contains dot in their names -# Such keys can't be used as variables in bash, -# so every dot is replaced with double underscore. -# Double underscore needed to avoid possible naming collisions. -for item in $(cat /proc/cmdline); do - if [[ "${item}" =~ '=' ]]; then - key="${item%%=*}" - value="${item#*=}" - else - key="${item}" - value='yes' - fi - key="${key//\./__}" - value="${value:-'yes'}" - echo "${key}=${value}" >> /root/anaconda.cmdline.vars -done - -source /root/anaconda.cmdline.vars - -if [[ ! -z $ifname ]]; then - echo "adminif=$(udevadm info --query=property -p /sys/class/net/${ifname%%:*} | \ - awk -F\= '$1 == "ID_NET_NAME_ONBOARD" {s=$2; exit}; $1 == "ID_NET_NAME_SLOT" {s=$2; exit}; $1 == "ID_NET_NAME_PATH" {s=$2; next}; END {print s}')" >> /root/anaconda.cmdline.vars -fi - -# Add self entry to /etc/hosts -ipaddr=$(echo $ip | cut -d: -f1) -hostname=$(echo $ip | cut -d: -f5) -# Use default hostname if missing from parameters -[ -z "$hostname" ] && hostname="fuel.domain.tld" -short=$(echo $hostname | cut -d. -f1) -echo -e "${ipaddr} ${hostname} ${short}" >> /etc/hosts -%end - - - - - -# Mount installation media in chroot -%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log -#!/bin/bash -set -x - -source "/mnt/sysimage/root/anaconda.cmdline.vars" - -SOURCE="/mnt/sysimage/tmp/source" - -mkdir -p "${SOURCE}" - -case "${repo}" in - nfs:*) - nfs_url="${repo#nfs:}" - mount -t nfs "${nfs_url}" "${SOURCE}" - ;; - *) - if [ -d "/mnt/source" ]; then - mount -o bind "/mnt/source" "${SOURCE}" - fi - ;; -esac - - -# If not mounted, try to bind /run/install/repo since -# anaconda shoud mount installation repo to that folder. -if ! mountpoint -q "${SOURCE}"; then - if [ -d '/run/install/repo' ] && mountpoint -q '/run/install/repo'; then - mount -o bind '/run/install/repo' "${SOURCE}" - fi -fi - - -# If still not mounted, try to mount from LABEL / UUID. -# It was moved from next phase here to keep all mounting stuff -# in one place. All other scripts should use SOURCE variable -# for access to dist files. - -iso_volume_id=OpenStack_Fuel -iso_disk_uuid=will_be_substituted_with_actual_uuid -FS="/mnt/sysimage/tmp/fs" - -if ! mountpoint -q "${SOURCE}"; then - if [ -e "/dev/disk/by-label/${iso_volume_id}" ]; then - mount "/dev/disk/by-label/${iso_volume_id}" "${SOURCE}" - elif [ -e "/dev/disk/by-uuid/${iso_disk_uuid}" ]; then - mkdir -p "${FS}" - mount "/dev/disk/by-uuid/${iso_disk_uuid}" "${FS}" - mount -o loop "${FS}/nailgun.iso" "${SOURCE}" - fi -fi - -# Sleep to capture full log -sleep 1 -%end - - - - - -%post --log=/root/anaconda-post-configure-repos.log -#!/bin/bash -set -x - -SOURCE=/tmp/source - -# this file is provided by fuel-openstack-metadata package -OPENSTACK_VERSION=`cat /etc/fuel_openstack_version` - -# ---------------------- -# UNPACKING REPOSITORIES -# ---------------------- - -wwwdir="/var/www/nailgun" -repodir="${wwwdir}/${OPENSTACK_VERSION}" - -# Copying Centos files -mkdir -p ${repodir}/centos/x86_64 -mkdir -p ${repodir}/mos-centos/x86_64 -cp -r ${SOURCE}/images ${repodir}/centos/x86_64 -cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64 -cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64 -cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64 -cp -r ${SOURCE}/mos-centos/repodata ${repodir}/mos-centos/x86_64 -cp -r ${SOURCE}/mos-centos/Packages ${repodir}/mos-centos/x86_64 -cp -r ${SOURCE}/extra-repos ${repodir}/ -cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64 - -# Copying Ubuntu files -mkdir -p ${repodir}/ubuntu/x86_64/images -cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64 -cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64 - -# We do not ship debian-installer kernel and initrd on ISO. -# But we still need to be able to create ubuntu cobbler distro -# which requires kernel and initrd to be available. So, we -# just touch these files to work around cobbler's limitation. -touch ${repodir}/ubuntu/x86_64/images/linux -touch ${repodir}/ubuntu/x86_64/images/initrd.gz - -# make links for backward compatibility -ln -s ${repodir}/centos ${wwwdir}/centos -ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu -#Make a symlink for mos-centos in /var/www/nailgun in iso/ks.template -ln -s ${repodir}/mos-centos ${wwwdir}/mos-centos -ln -s ${repodir}/extra-repos ${wwwdir}/extra-repos - -mkdir -p ${wwwdir}/targetimages - -cp ${SOURCE}/send2syslog.py /bin/send2syslog.py -mkdir -p /var/lib/hiera -touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml - -# Prepare local repository specification -rm /etc/yum.repos.d/CentOS*.repo -cp ${SOURCE}/extra-repos/extra.repo /etc/yum.repos.d/ -cat > /etc/yum.repos.d/nailgun.repo << EOF -[nailgun] -name=Nailgun Local Repo -baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64 -gpgcheck=0 -[mos] -name=MOS Local Repo -baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/mos-centos/x86_64 -gpgcheck=0 -EOF -%end - - - - - -%post --log=/root/anaconda-post-configure-sysconfig.log -#!/bin/bash -set -x - -source "/root/anaconda.cmdline.vars" -SOURCE=/tmp/source - -# Set correct docker volume group -echo "VG=docker" >> /etc/sysconfig/docker-storage-setup - -# Disable create iptables rules by docker -echo "DOCKER_NETWORK_OPTIONS=--iptables=false" > /etc/sysconfig/docker-network - -# Disable subscription-manager plugins -sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || : -sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf || : - -# Disable GSSAPI in ssh server config -sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -# Enable MOTD banner in sshd -sed -i -e "s/^\s*PrintMotd no/PrintMotd yes/g" /etc/ssh/sshd_config - -# Add note regarding local repos creation to MOTD -cat >> /etc/motd << EOF - -All environments use online repositories by default. -Use the following commands to create local repositories -on master node and change default repository settings: - -* CentOS: fuel-mirror (see --help for options) -* Ubuntu: fuel-mirror (see --help for options) - -Please refer to the following guide for more information: -https://docs.mirantis.com/openstack/fuel/fuel-7.0/reference-architecture.html#fuel-rep-mirror - -EOF - -# Install bootstrap_admin_node.sh and enabling it -install -m 0777 -D ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh -echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node - -# Copying version.yaml file. It contains COMMIT_SHA of last commit. -RELEASE=$(awk '/release/{gsub(/"/, "");print $2}' ${SOURCE}/version.yaml) -mkdir -p /etc/nailgun /etc/fuel/${RELEASE} /etc/fuel/release_versions -cp ${SOURCE}/version.yaml /etc/nailgun/version.yaml -cp ${SOURCE}/version.yaml /etc/fuel/${RELEASE}/version.yaml -ln -s /etc/fuel/${RELEASE}/version.yaml /etc/fuel/version.yaml -cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_version`.yaml - -# Generete Fuel UUID -uuidgen > /etc/fuel/fuel-uuid - -# Prepare bootstrap_admin_node config -cat > /etc/fuel/bootstrap_admin_node.conf << EOF -#Set to yes to run Fuel Setup -#Set to no to accept default settings -ADMIN_INTERFACE=${adminif} -showmenu=${showmenu:-no} -wait_for_external_config=${wait_for_external_config:-no} -EOF - -# Prepare custom /etc/issue logon banner and script for changing IP in it -# We can have several interface naming schemes applied and several interface -# UI will listen on -ipstr="" -NL=$'\n' -for ip in `ip -o -4 a | grep -e "e[nt][hopsx].*" | awk '{print \$4 }' | cut -d/ -f1`; do - ipstr="${ipstr}https://${ip}:8443${NL}" -done -cat > /etc/issue <<EOF -######################################### -# Welcome to the Fuel server # -######################################### -Server is running on \m platform - -Fuel UI is available on: -$ipstr -Default administrator login: root -Default administrator password: r00tme - -Default Fuel UI login: admin -Default Fuel UI password: admin - -Please change root password on first login. - -EOF - -######### OPNFV addition BEGIN ############ -# Copy data into /opt/opnfv -# TODO: This ought to be a package instead! -mkdir -p /opt/opnfv -cp -r ${SOURCE}/opnfv /opt -cp ${SOURCE}/gitinfo.txt / -######### OPNFV addition END ############ - -# Unmounting source -umount -f ${SOURCE} -rm -rf ${SOURCE} - -umount -f ${FS} || true -rm -rf ${FS} - -echo "tos orphan 7" >> /etc/ntp.conf - -# Disabling splash -sed -i --follow-symlinks -e '/^\slinux16/ s/rhgb/debug/' /boot/grub2/grub.cfg - -# Copying default bash settings to the root directory -cp -f /etc/skel/.bash* /root/ - -# Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors -(virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf - -# Blacklist intel_rapl module for VirtualBox so it does not create kernel errors -(virt-what | fgrep -q "virtualbox") && echo "blacklist intel_rapl" > /etc/modprobe.d/blacklist-intel-rapl.conf - -# Disable sshd until after Fuel Setup if not running on VirtualBox -# TODO(mattymo): Remove VBox exception after LP#1487047 is fixed -(virt-what | fgrep -q "virtualbox") || systemctl disable sshd - -%end - - - - - -%post --log=/root/anaconda-post-configure-autologon.log -#!/bin/bash -set -x - -# Enable once root autologin for initial setup -mkdir -p /etc/systemd/system/getty@tty1.service.d/ -cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << 'EOF' -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root --noclear %I 115200 linux -EOF - -# Exec bootstrap_admin_node.sh if autologin enabled -cat >> /root/.bashrc << 'EOF' -if [[ "$(tty)" == "/dev/tty1" && -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]]; then - rm -Rf "/etc/systemd/system/getty@tty1.service.d" - /bin/systemctl daemon-reload - if [ -x /usr/local/sbin/bootstrap_admin_node.sh ]; then - exec /usr/local/sbin/bootstrap_admin_node.sh - fi -fi -EOF -%end - - -%post --nochroot --log=/mnt/sysimage/root/anaconda-post-interface-settings.log -#!/bin/bash -set -x - -source "/mnt/sysimage/root/anaconda.cmdline.vars" - -if [[ ! -z $adminif ]]; then - rm -f /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} - sed "s/${ifname%%:*}/${adminif}/g" \ - /etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} > \ - /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${adminif} -fi -%end diff --git a/build/f_isoroot/f_kscfg/ks.cfg.orig b/build/f_isoroot/f_kscfg/ks.cfg.orig deleted file mode 100755 index f8a43daa0..000000000 --- a/build/f_isoroot/f_kscfg/ks.cfg.orig +++ /dev/null @@ -1,650 +0,0 @@ -install -text -#%include /tmp/source.ks -cdrom -reboot --eject -lang en_US.UTF-8 -keyboard us -rootpw r00tme -timezone --utc Etc/UTC -firewall --disabled -selinux --disabled -# ignore unsupported hardware warning -unsupported_hardware -# SKIP CONFIGURING X -skipx -repo --name="mos-centos" --baseurl=file:///run/install/repo/mos-centos/ --cost=100 - -# NEVER ever place zerombr here, it breaks automated installation -%include /tmp/bootloader.ks -%include /tmp/partition.ks -%include /tmp/post_partition.ks - - - - - -%packages --nobase -@Core -fuel -fuel-library -fuel-dockerctl -authconfig -bind-utils -bridge-utils -cronie -crontabs -curl -dhcp -docker -fuel-bootstrap-cli -fuel-bootstrap-image -# NOTE(kozhukalov): We don't need target centos images in 8.0 -# fuel-target-centos-images7.1.1503 -fuelmenu -fuel-docker-images -fuel-mirror -fuel-openstack-metadata -gdisk -lrzip -lsof -man -mlocate -nmap-ncat -ntp -ntpdate -openssh-clients -policycoreutils -python-pypcap -rsync -puppet -rubygem-netaddr -rubygem-openstack -selinux-policy-targeted -strace -sysstat -system-config-firewall-base -tcpdump -telnet -vim -virt-what -wget -yum -yum-plugin-priorities -%end - - - - - -# PREINSTALL SECTION -# HERE ARE COMMANDS THAT WILL BE LAUNCHED BEFORE -# INSTALLATION PROCESS ITSELF -%pre -#!/bin/sh - -# hard drives -drives="" -removable_drives="" -for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do - if !(blkid | grep -q "${drv}.*Fuel"); then - if (grep -q 0 /sys/block/${drv}/removable); then - drives="${drives} ${drv}" - else - removable_drives="${removable_drives} ${drv}" - fi - fi -done -default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` - -installdrive=${installdrive:-undefined} -forceformat=${forceformat:-no} -for I in $(cat /proc/cmdline); do - case "$I" in - *=*) - if ! [[ "${I}" =~ "." ]]; then eval "$I"; fi - ;; - esac -done - -set ${drives} ${removable_drives} -numdrives=`echo $#` - -tgtdrive="${installdrive}" - -function confirm_format { - check_drive="$1" - local confirm_format="no" - - if [[ "$forceformat" == "yes" ]] ; then - return 0 - fi - - if parted -s /dev/$check_drive print &>/dev/null ; then - echo - echo "$check_drive drive contains partition table:" - parted -s /dev/$check_drive print - echo - read -p "Are you sure you want to erase ALL data on disk $check_drive? (y/N)" confirm_format - if [[ "$confirm_format" == "y" ]] || [[ "$confirm_format" == "Y" ]] || [[ "$forceformat" == "yes" ]]; then - return 0 - else - return 1 - fi - else - return 0 - fi -} - -format_confirmed="no" - -if [ $numdrives -lt 1 ]; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - clear - echo - echo '********************************************************************' - echo '* E R R O R *' - echo '* *' - echo '* There is no suitable media available for installation. *' - echo '* Please attach a drive and try again. *' - echo '* *' - echo '********************************************************************' - echo - read -p "Press Enter to shut down the system: " _ - poweroff -fi - -if [ ${numdrives} -gt 1 ] || [ `echo ${drives} | wc -w` -eq 0 ] ; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - while [ "${tgtdrive}" = "undefined" ]; do - clear - echo - echo '********************************************************************************' - echo '* W A R N I N G *' - echo '* *' - echo '* Which of the detected hard drives do you want to be used as *' - echo '* the installation target? *' - echo '* *' - echo '********************************************************************************' - echo - echo "Possible choices" - echo "Persistent drives: ${drives}" - echo "Removable drives: ${removable_drives}" - echo - if [ `echo ${drives} | wc -w` -eq 1 ] ; then - read -t 30 -p "Choose hard drive: " tgtdrive || tgtdrive=$default_drive - else - read -p "Choose hard drive: " tgtdrive - fi - match="no" - for drive in ${drives[@]} ${removable_drives[@]}; do - if [[ "$drive" == "$tgtdrive" ]] && match="yes" ; then - if confirm_format $tgtdrive ; then - format_confirmed="yes" - break - else - tgtdrive="undefined" - read -p "You may select another disk. Press Enter to continue." _ - fi - fi - done - if [[ "$match" == "no" ]]; then - tgtdrive="undefined" - read -p "Invalid choice. Press Enter to continue." _ - fi - done - clear - chvt 1 -else - tgtdrive=`echo ${drives} | sed -e "s/^\s*//" -e "s/\s*$//"` -fi - -if [ "$format_confirmed" != "yes" ] ; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - if ! confirm_format $tgtdrive ; then - clear - echo - echo '********************************************************************' - echo '* E R R O R *' - echo '* *' - echo '* Disk $tgtdrive contains active partition(s). *' - echo '* Installation cannot continue without confirmation. *' - echo '* *' - echo '********************************************************************' - echo - read -p "Press Enter to restart: " _ - reboot - fi - chvt 1 -fi - -# verify tgtdrive is at least 45GB -tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 )) -if [ $tgtdrivesize -lt 46080 ]; then - exec < /dev/tty3 > /dev/tty3 2>&1 - chvt 3 - clear - echo - echo '********************************************************************' - echo '* E R R O R *' - echo '* *' - echo '* Your disk is under 45GB in size. Installation cannot continue. *' - echo '* Restart installation with a larger disk. *' - echo '* *' - echo '********************************************************************' - echo - read -p "Press Enter to restart: " _ - reboot -fi - -# paths in /dev have "/" instead of "!" for cciss devices -tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//') - -# source -if test -e /dev/disk/by-label/OpenStack_Fuel; then - echo "harddrive --partition=LABEL=OpenStack_Fuel --dir=/" > /tmp/source.ks -elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then - echo "harddrive --partition=UUID=will_be_substituted_with_actual_uuid --dir=/" > /tmp/source.ks -else - echo "cdrom" > /tmp/source.ks -fi - -vgdisplay -c | cut -d':' -f1 | xargs vgremove -ff -dd if=/dev/zero of=/dev/${tgtdrive} bs=10M count=10 -sleep 3 -hdparm -z /dev/${tgtdrive} -parted -s /dev/${tgtdrive} mklabel gpt -parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 0% 24 -parted -s /dev/${tgtdrive} set 1 bios_grub on -parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary fat16 24 224 -parted -s /dev/${tgtdrive} set 2 boot on -parted -a none -s /dev/${tgtdrive} unit MiB mkpart primary 224 424 -sleep 3 -hdparm -z /dev/${tgtdrive} - -# partition - -# This adds support for the p seperator required for cciss devices -if echo ${tgtdrive} | grep -q -e cciss ; then - bootdev=${tgtdrive}p -else - bootdev=${tgtdrive} -fi - -cat << EOF > /tmp/partition.ks -part /boot --onpart=/dev/${bootdev}3 -part /boot/efi --onpart=/dev/${bootdev}2 -part pv.001 --ondisk=${tgtdrive} --size=25000 --grow -part pv.002 --ondisk=${tgtdrive} --size=20000 -volgroup os pv.001 -volgroup docker pv.002 -logvol swap --vgname=os --recommended --name=swap -logvol / --vgname=os --size=10000 --name=root --fstype=ext4 -logvol /var --vgname=os --grow --percent 40 --name=var --fstype=ext4 -logvol /var/log --vgname=os --grow --percent 60 --name=varlog --fstype=ext4 -EOF - - - -# bootloader -echo "bootloader --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks - -# Anaconda can not install grub 0.97 on disks which are >4T. -# The reason is that grub does not support such large geometries -# and it simply thinks that the cylinder number has negative value. -# Here we just set geometry manually so that grub thinks that disk -# size is equal to 1G. -# 130 cylinders * (16065 * 512 = 8225280 bytes) = 1G -echo "%post --nochroot --log=/mnt/sysimage/root/anaconda-post-partition.log" > /tmp/post_partition.ks -echo "echo \"device (hd0) /dev/${tgtdrive}\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo \"geometry (hd0) 130 255 63\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo \"root (hd0,2)\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo \"install /grub/stage1 (hd0) /grub/stage2 p /grub/grub.conf\" >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "echo quit >> /tmp/grub.script" >> /tmp/post_partition.ks -echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch" >> /tmp/post_partition.ks -echo "%end" >> /tmp/post_partition.ks -%end - - - - - -# POSTINSTALL SECTIONS -# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER -# INSTALLATION ITSELF COMPLETED - - -# Parse /proc/cmdline and save for next steps -%post --log=/root/anaconda-parse-cmdline.log -#!/bin/bash -set -x - -# Parse cmdline to alter keys which contains dot in their names -# Such keys can't be used as variables in bash, -# so every dot is replaced with double underscore. -# Double underscore needed to avoid possible naming collisions. -for item in $(cat /proc/cmdline); do - if [[ "${item}" =~ '=' ]]; then - key="${item%%=*}" - value="${item#*=}" - else - key="${item}" - value='yes' - fi - key="${key//\./__}" - value="${value:-'yes'}" - echo "${key}=${value}" >> /root/anaconda.cmdline.vars -done - -source /root/anaconda.cmdline.vars - -if [[ ! -z $ifname ]]; then - echo "adminif=$(udevadm info --query=property -p /sys/class/net/${ifname%%:*} | \ - awk -F\= '$1 == "ID_NET_NAME_ONBOARD" {s=$2; exit}; $1 == "ID_NET_NAME_SLOT" {s=$2; exit}; $1 == "ID_NET_NAME_PATH" {s=$2; next}; END {print s}')" >> /root/anaconda.cmdline.vars -fi - -# Add self entry to /etc/hosts -ipaddr=$(echo $ip | cut -d: -f1) -hostname=$(echo $ip | cut -d: -f5) -# Use default hostname if missing from parameters -[ -z "$hostname" ] && hostname="fuel.domain.tld" -short=$(echo $hostname | cut -d. -f1) -echo -e "${ipaddr} ${hostname} ${short}" >> /etc/hosts -%end - - - - - -# Mount installation media in chroot -%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log -#!/bin/bash -set -x - -source "/mnt/sysimage/root/anaconda.cmdline.vars" - -SOURCE="/mnt/sysimage/tmp/source" - -mkdir -p "${SOURCE}" - -case "${repo}" in - nfs:*) - nfs_url="${repo#nfs:}" - mount -t nfs "${nfs_url}" "${SOURCE}" - ;; - *) - if [ -d "/mnt/source" ]; then - mount -o bind "/mnt/source" "${SOURCE}" - fi - ;; -esac - - -# If not mounted, try to bind /run/install/repo since -# anaconda shoud mount installation repo to that folder. -if ! mountpoint -q "${SOURCE}"; then - if [ -d '/run/install/repo' ] && mountpoint -q '/run/install/repo'; then - mount -o bind '/run/install/repo' "${SOURCE}" - fi -fi - - -# If still not mounted, try to mount from LABEL / UUID. -# It was moved from next phase here to keep all mounting stuff -# in one place. All other scripts should use SOURCE variable -# for access to dist files. - -iso_volume_id=OpenStack_Fuel -iso_disk_uuid=will_be_substituted_with_actual_uuid -FS="/mnt/sysimage/tmp/fs" - -if ! mountpoint -q "${SOURCE}"; then - if [ -e "/dev/disk/by-label/${iso_volume_id}" ]; then - mount "/dev/disk/by-label/${iso_volume_id}" "${SOURCE}" - elif [ -e "/dev/disk/by-uuid/${iso_disk_uuid}" ]; then - mkdir -p "${FS}" - mount "/dev/disk/by-uuid/${iso_disk_uuid}" "${FS}" - mount -o loop "${FS}/nailgun.iso" "${SOURCE}" - fi -fi - -# Sleep to capture full log -sleep 1 -%end - - - - - -%post --log=/root/anaconda-post-configure-repos.log -#!/bin/bash -set -x - -SOURCE=/tmp/source - -# this file is provided by fuel-openstack-metadata package -OPENSTACK_VERSION=`cat /etc/fuel_openstack_version` - -# ---------------------- -# UNPACKING REPOSITORIES -# ---------------------- - -wwwdir="/var/www/nailgun" -repodir="${wwwdir}/${OPENSTACK_VERSION}" - -# Copying Centos files -mkdir -p ${repodir}/centos/x86_64 -mkdir -p ${repodir}/mos-centos/x86_64 -cp -r ${SOURCE}/images ${repodir}/centos/x86_64 -cp -r ${SOURCE}/isolinux ${repodir}/centos/x86_64 -cp -r ${SOURCE}/repodata ${repodir}/centos/x86_64 -cp -r ${SOURCE}/Packages ${repodir}/centos/x86_64 -cp -r ${SOURCE}/mos-centos/repodata ${repodir}/mos-centos/x86_64 -cp -r ${SOURCE}/mos-centos/Packages ${repodir}/mos-centos/x86_64 -cp -r ${SOURCE}/extra-repos ${repodir}/ -cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64 - -# Copying Ubuntu files -mkdir -p ${repodir}/ubuntu/x86_64/images -cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64 -cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64 - -# We do not ship debian-installer kernel and initrd on ISO. -# But we still need to be able to create ubuntu cobbler distro -# which requires kernel and initrd to be available. So, we -# just touch these files to work around cobbler's limitation. -touch ${repodir}/ubuntu/x86_64/images/linux -touch ${repodir}/ubuntu/x86_64/images/initrd.gz - -# make links for backward compatibility -ln -s ${repodir}/centos ${wwwdir}/centos -ln -s ${repodir}/ubuntu ${wwwdir}/ubuntu -#Make a symlink for mos-centos in /var/www/nailgun in iso/ks.template -ln -s ${repodir}/mos-centos ${wwwdir}/mos-centos -ln -s ${repodir}/extra-repos ${wwwdir}/extra-repos - -mkdir -p ${wwwdir}/targetimages - -cp ${SOURCE}/send2syslog.py /bin/send2syslog.py -mkdir -p /var/lib/hiera -touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml - -# Prepare local repository specification -rm /etc/yum.repos.d/CentOS*.repo -cp ${SOURCE}/extra-repos/extra.repo /etc/yum.repos.d/ -cat > /etc/yum.repos.d/nailgun.repo << EOF -[nailgun] -name=Nailgun Local Repo -baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/centos/x86_64 -gpgcheck=0 -[mos] -name=MOS Local Repo -baseurl=file:/var/www/nailgun/${OPENSTACK_VERSION}/mos-centos/x86_64 -gpgcheck=0 -EOF -%end - - - - - -%post --log=/root/anaconda-post-configure-sysconfig.log -#!/bin/bash -set -x - -source "/root/anaconda.cmdline.vars" -SOURCE=/tmp/source - -# Set correct docker volume group -echo "VG=docker" >> /etc/sysconfig/docker-storage-setup - -# Disable create iptables rules by docker -echo "DOCKER_NETWORK_OPTIONS=--iptables=false" > /etc/sysconfig/docker-network - -# Disable subscription-manager plugins -sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/product-id.conf || : -sed -i 's/^enabled.*/enabled=0/' /etc/yum/pluginconf.d/subscription-manager.conf || : - -# Disable GSSAPI in ssh server config -sed -i -e "/^\s*GSSAPICleanupCredentials yes/d" -e "/^\s*GSSAPIAuthentication yes/d" /etc/ssh/sshd_config - -# Enable MOTD banner in sshd -sed -i -e "s/^\s*PrintMotd no/PrintMotd yes/g" /etc/ssh/sshd_config - -# Add note regarding local repos creation to MOTD -cat >> /etc/motd << EOF - -All environments use online repositories by default. -Use the following commands to create local repositories -on master node and change default repository settings: - -* CentOS: fuel-mirror (see --help for options) -* Ubuntu: fuel-mirror (see --help for options) - -Please refer to the following guide for more information: -https://docs.mirantis.com/openstack/fuel/fuel-7.0/reference-architecture.html#fuel-rep-mirror - -EOF - -# Install bootstrap_admin_node.sh and enabling it -install -m 0777 -D ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh -echo "ENABLED=1" > /etc/sysconfig/bootstrap_admin_node - -# Copying version.yaml file. It contains COMMIT_SHA of last commit. -RELEASE=$(awk '/release/{gsub(/"/, "");print $2}' ${SOURCE}/version.yaml) -mkdir -p /etc/nailgun /etc/fuel/${RELEASE} /etc/fuel/release_versions -cp ${SOURCE}/version.yaml /etc/nailgun/version.yaml -cp ${SOURCE}/version.yaml /etc/fuel/${RELEASE}/version.yaml -ln -s /etc/fuel/${RELEASE}/version.yaml /etc/fuel/version.yaml -cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_version`.yaml - -# Generete Fuel UUID -uuidgen > /etc/fuel/fuel-uuid - -# Prepare bootstrap_admin_node config -cat > /etc/fuel/bootstrap_admin_node.conf << EOF -#Set to yes to run Fuel Setup -#Set to no to accept default settings -ADMIN_INTERFACE=${adminif} -showmenu=${showmenu:-no} -wait_for_external_config=${wait_for_external_config:-no} -EOF - -# Prepare custom /etc/issue logon banner and script for changing IP in it -# We can have several interface naming schemes applied and several interface -# UI will listen on -ipstr="" -NL=$'\n' -for ip in `ip -o -4 a | grep -e "e[nt][hopsx].*" | awk '{print \$4 }' | cut -d/ -f1`; do - ipstr="${ipstr}https://${ip}:8443${NL}" -done -cat > /etc/issue <<EOF -######################################### -# Welcome to the Fuel server # -######################################### -Server is running on \m platform - -Fuel UI is available on: -$ipstr -Default administrator login: root -Default administrator password: r00tme - -Default Fuel UI login: admin -Default Fuel UI password: admin - -Please change root password on first login. - -EOF - -# Unmounting source -umount -f ${SOURCE} -rm -rf ${SOURCE} - -umount -f ${FS} || true -rm -rf ${FS} - -echo "tos orphan 7" >> /etc/ntp.conf - -# Disabling splash -sed -i --follow-symlinks -e '/^\slinux16/ s/rhgb/debug/' /boot/grub2/grub.cfg - -# Copying default bash settings to the root directory -cp -f /etc/skel/.bash* /root/ - -# Blacklist i2c_piix4 module for VirtualBox so it does not create kernel errors -(virt-what | fgrep -q "virtualbox") && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf - -# Blacklist intel_rapl module for VirtualBox so it does not create kernel errors -(virt-what | fgrep -q "virtualbox") && echo "blacklist intel_rapl" > /etc/modprobe.d/blacklist-intel-rapl.conf - -# Disable sshd until after Fuel Setup if not running on VirtualBox -# TODO(mattymo): Remove VBox exception after LP#1487047 is fixed -(virt-what | fgrep -q "virtualbox") || systemctl disable sshd - -%end - - - - - -%post --log=/root/anaconda-post-configure-autologon.log -#!/bin/bash -set -x - -# Enable once root autologin for initial setup -mkdir -p /etc/systemd/system/getty@tty1.service.d/ -cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << 'EOF' -[Service] -ExecStart= -ExecStart=-/sbin/agetty --autologin root --noclear %I 115200 linux -EOF - -# Exec bootstrap_admin_node.sh if autologin enabled -cat >> /root/.bashrc << 'EOF' -if [[ "$(tty)" == "/dev/tty1" && -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]]; then - rm -Rf "/etc/systemd/system/getty@tty1.service.d" - /bin/systemctl daemon-reload - if [ -x /usr/local/sbin/bootstrap_admin_node.sh ]; then - exec /usr/local/sbin/bootstrap_admin_node.sh - fi -fi -EOF -%end - - -%post --nochroot --log=/mnt/sysimage/root/anaconda-post-interface-settings.log -#!/bin/bash -set -x - -source "/mnt/sysimage/root/anaconda.cmdline.vars" - -if [[ ! -z $adminif ]]; then - rm -f /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} - sed "s/${ifname%%:*}/${adminif}/g" \ - /etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} > \ - /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${adminif} -fi -%end
\ No newline at end of file diff --git a/build/f_isoroot/f_kscfg/ks.cfg.patch b/build/f_isoroot/f_kscfg/ks.cfg.patch new file mode 100644 index 000000000..a6840e479 --- /dev/null +++ b/build/f_isoroot/f_kscfg/ks.cfg.patch @@ -0,0 +1,31 @@ +*** /dev/null 2016-04-26 10:10:11.481587709 +0200 +--- ks.cfg 2016-04-26 10:10:11.481587709 +0200 +*************** +*** 579,584 **** +--- 579,592 ---- + + EOF + ++ ######### OPNFV addition BEGIN ############ ++ # Copy data into /opt/opnfv ++ # TODO: This ought to be a package instead! ++ mkdir -p /opt/opnfv ++ cp -r ${SOURCE}/opnfv /opt ++ cp ${SOURCE}/gitinfo.txt / ++ ######### OPNFV addition END ############ ++ + # Unmounting source + umount -f ${SOURCE} + rm -rf ${SOURCE} +*************** +*** 647,650 **** + /etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} > \ + /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${adminif} + fi +! %end +\ No newline at end of file +--- 655,658 ---- + /etc/sysconfig/network-scripts/ifcfg-${ifname%%:*} > \ + /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-${adminif} + fi +! %end diff --git a/build/fuel-main_5.patch b/build/fuel-main_5.patch deleted file mode 100644 index ec75626d0..000000000 --- a/build/fuel-main_5.patch +++ /dev/null @@ -1,19 +0,0 @@ -*** prepare-build-env.sh.orig Tue Sep 8 10:29:08 2015 ---- prepare-build-env.sh Tue Sep 8 10:30:21 2015 -*************** -*** 43,49 **** - GEMPKG="ruby ruby-dev" - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2 - echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list -! sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm - ;; - - precise) ---- 43,49 ---- - GEMPKG="ruby ruby-dev" - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2 - echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list -! sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm dosfstools xorriso - ;; - - precise) diff --git a/build/fuel-main_cpio.patch b/build/fuel-main_cpio.patch deleted file mode 100644 index 37bc10f39..000000000 --- a/build/fuel-main_cpio.patch +++ /dev/null @@ -1,36 +0,0 @@ -*** bootstrap/module.mk.orig 2016-04-22 15:30:34.872016256 +0200 ---- bootstrap/module.mk 2016-04-22 15:31:32.241993497 +0200 -*************** -*** 1,3 **** ---- 1,6 ---- -+ CPIOARGS = $(shell cpio --extract-over-symlinks -o </dev/null \ -+ >/dev/null 2>&1 && echo "--extract-over-symlinks") -+ - .PHONY: bootstrap clean clean-bootstrap - - bootstrap: $(ARTS_DIR)/$(BOOTSTRAP_ART_NAME) -*************** -*** 231,241 **** - - # Installing kernel modules - find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_PATTERN)' | xargs rpm2cpio | \ -! ( cd $(INITRAMROOT); sudo cpio -idm './lib/modules/*' './boot/vmlinuz*' ) - find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_FIRMWARE_PATTERN)' | xargs rpm2cpio | \ -! ( cd $(INITRAMROOT); sudo cpio -idm './lib/firmware/*' ) - find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name 'libmlx4*' | xargs rpm2cpio | \ -! ( cd $(INITRAMROOT); sudo cpio -idm './etc/*' './usr/lib64/*' ) - for version in `ls -1 $(INITRAMROOT)/lib/modules`; do \ - sudo depmod -b $(INITRAMROOT) $$version; \ - done ---- 234,244 ---- - - # Installing kernel modules - find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_PATTERN)' | xargs rpm2cpio | \ -! ( cd $(INITRAMROOT); sudo cpio $(CPIOARGS) -idm './lib/modules/*' './boot/vmlinuz*' ) - find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name '$(KERNEL_FIRMWARE_PATTERN)' | xargs rpm2cpio | \ -! ( cd $(INITRAMROOT); sudo cpio $(CPIOARGS) -idm './lib/firmware/*' ) - find $(LOCAL_MIRROR_CENTOS_OS_BASEURL) -name 'libmlx4*' | xargs rpm2cpio | \ -! ( cd $(INITRAMROOT); sudo cpio $(CPIOARGS) -idm './etc/*' './usr/lib64/*' ) - for version in `ls -1 $(INITRAMROOT)/lib/modules`; do \ - sudo depmod -b $(INITRAMROOT) $$version; \ - done diff --git a/build/fuel_build_loop b/build/fuel_build_loop index 7e26b98b8..4a0dda6f4 100755 --- a/build/fuel_build_loop +++ b/build/fuel_build_loop @@ -12,7 +12,7 @@ echo "MIRROR_MOS_UBUNTU_ROOT=${MIRROR_MOS_UBUNTU_ROOT}" echo "MIRROR_FUEL=${MIRROR_FUEL}" -maxcount=10 +maxcount=3 cnt=0 rc=1 while [ $cnt -lt $maxcount ] && [ $rc -ne 0 ] diff --git a/build/isolinux.cfg.patch b/build/isolinux.cfg.patch new file mode 100644 index 000000000..ebd991bd7 --- /dev/null +++ b/build/isolinux.cfg.patch @@ -0,0 +1,24 @@ +*** isolinux.cfg.orig Tue May 10 10:13:21 2016 +--- isolinux.cfg Tue May 10 10:15:12 2016 +*************** +*** 19,27 **** + menu label ^1. Fuel Install (Static IP) + menu default + kernel vmlinuz +! append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 + + label nailgunifname + menu label ^2. Fuel Advanced Install (Static IP) + kernel vmlinuz +! append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX +--- 19,27 ---- + menu label ^1. Fuel Install (Static IP) + menu default + kernel vmlinuz +! append initrd=initrd.img net.ifnames=0 biosdevname=0 inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:eth0:off::: nameserver=10.20.0.1 showmenu=yes + + label nailgunifname + menu label ^2. Fuel Advanced Install (Static IP) + kernel vmlinuz +! append initrd=initrd.img inst.repo=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ inst.ks=cdrom:LABEL=will_be_substituted_with_ISO_VOLUME_ID:/ks.cfg ip=10.20.0.2::10.20.0.1:255.255.255.0:fuel.domain.tld:adminif:off::: nameserver=10.20.0.1 ifname=adminif:XX:XX:XX:XX:XX:XX showmenu=yes + diff --git a/build/fuel-main_7.patch b/build/repo-mirror-cz.patch index aa8eaf9ad..aa8eaf9ad 100644 --- a/build/fuel-main_7.patch +++ b/build/repo-mirror-cz.patch |