summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorStefan K. Berg <stefan.k.berg@ericsson.com>2016-01-17 19:18:58 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-01-17 19:18:59 +0000
commit58ab9100f56b4252578c9c13cb8060d87285f1ba (patch)
tree8294e825620f38d7be12875b0bb3e7db0aa7683e /build
parent76aa5bd1daf9568ab91f7586b0627062ffb26fb0 (diff)
parent8e599759ede512a773eccef59eb2824940307564 (diff)
Merge "Fuel 8 uplift"
Diffstat (limited to 'build')
-rw-r--r--build/Makefile9
-rwxr-xr-xbuild/cache.sh13
-rw-r--r--build/config.mk2
-rw-r--r--build/docker/Dockerfile2
-rwxr-xr-xbuild/docker/runcontext2
-rw-r--r--build/docker/ubuntu-builder/enable_dockerx220
-rw-r--r--build/f_isoroot/Makefile8
-rwxr-xr-xbuild/f_isoroot/f_bootstrap/bootstrap_admin_node.sh339
-rwxr-xr-xbuild/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig339
-rw-r--r--build/f_isoroot/f_kscfg/ks.cfg456
-rw-r--r--build/f_isoroot/f_kscfg/ks.cfg.orig457
-rw-r--r--build/fuel-main_6.patch30
-rw-r--r--build/fuel-main_7.patch19
-rw-r--r--build/fuel-main_docker_version.patch15
14 files changed, 1090 insertions, 621 deletions
diff --git a/build/Makefile b/build/Makefile
index d58f3ad76..4f2ca6520 100644
--- a/build/Makefile
+++ b/build/Makefile
@@ -18,7 +18,7 @@ SHELL = /bin/bash
# BEGIN of variables to customize
#
#Input args
-export ISOSRC = file:$(shell pwd)/fuel-7.0.iso
+export ISOSRC = file:$(shell pwd)/fuel-8.0.iso
export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC))
export PRODNO = "OPNFV_BGS"
export REVSTATE = "P0000"
@@ -81,12 +81,10 @@ $(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)
- # Setup cgroups for docker-in-docker
- sudo /root/enable_dockerx2
# Patch for adding dosfstools, as Fuel 6.1 is running mkfs.vfat
cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_5.patch
- # Patch for changing the second layer Docker --bip address
- cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_6.patch
+ # Patch for using the Czech Fuel mirror
+ # cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_7.patch
# Remove Docker optimizations, otherwise multistrap will fail during
# Fuel build.
sudo rm -f /etc/apt/apt.conf.d/docker*
@@ -185,6 +183,7 @@ debug:
cd /tmp/fuel-main && make repos
$(REPOINFO) -r /tmp/fuel-main > .cachedata
sha1sum fuel-main*.patch >> .cachedata
+ $(CACHETOOL) getbiweek >> .cachedata
cat .cachedata | $(CACHETOOL) getid > .cacheid
# Not removing fuel-main as it is re-used in build
diff --git a/build/cache.sh b/build/cache.sh
index 07361d28a..52d28fa33 100755
--- a/build/cache.sh
+++ b/build/cache.sh
@@ -34,6 +34,13 @@ errorexit () {
exit 1
}
+# Generate a unique number every two weeks - a service routine that
+# can be used when generating the SHA1 to make sure that the cache is
+# rebuilt bi-weekly even if no pruning of the cache is taking place.
+getbiweek () {
+ echo "$(date +'%G')$[$(date +'%V')/2]"
+}
+
# Get a SHA1 based on what's piped into the cache command
getid() {
debugmsg "Generating sha1sum"
@@ -133,6 +140,12 @@ getcommitid() {
}
case $1 in
+ getbiweek)
+ if [ $# -ne 1 ]; then
+ errorexit "No arguments can be given to getbiweek!"
+ fi
+ getbiweek
+ ;;
getcommitid)
if [ $# -ne 3 ]; then
errorexit "Arg 1 needs to be URI and arg 2 tag/branch/commit"
diff --git a/build/config.mk b/build/config.mk
index fad4c765c..6b2f6a30e 100644
--- a/build/config.mk
+++ b/build/config.mk
@@ -9,7 +9,7 @@
##############################################################################
FUEL_MAIN_REPO := https://github.com/openstack/fuel-main
-FUEL_MAIN_TAG = stable/7.0
+FUEL_MAIN_TAG = stable/8.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 f3d122db9..9d1881c05 100644
--- a/build/docker/Dockerfile
+++ b/build/docker/Dockerfile
@@ -31,7 +31,5 @@ RUN chmod 4755 /bin/fusermount
ADD ./setcontext /root/setcontext
RUN chmod +x /root/setcontext
-ADD ./enable_dockerx2 /root/enable_dockerx2
-RUN chmod +x /root/enable_dockerx2
VOLUME /var/lib/docker
diff --git a/build/docker/runcontext b/build/docker/runcontext
index b442deeed..4ddd754f9 100755
--- a/build/docker/runcontext
+++ b/build/docker/runcontext
@@ -111,7 +111,7 @@ if [ -n "$CACHEBASE" ]; then
fi
fi
-RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE -e BUILD_FUEL_PLUGINS -u $USER_ID:$GROUP_ID -w $PWD -v $GITROOT:$GITROOT $CACHEMOUNT"
+RUN_CONTEXT_OPT="--cidfile $CID_FILE --privileged=true --rm -e HOME=$HOME -e CACHEDEBUG -e CACHETRANSPORT -e CACHEMAXAGE -e CACHEBASE -e BUILD_FUEL_PLUGINS -u $USER_ID:$GROUP_ID -w $PWD -v $GITROOT:$GITROOT -v /sys/fs/cgroup:/sys/fs/cgroup:ro $CACHEMOUNT"
# Passing "debug" puts up an interactive bash shell
if [ "$1" == "debug" ]; then
diff --git a/build/docker/ubuntu-builder/enable_dockerx2 b/build/docker/ubuntu-builder/enable_dockerx2
deleted file mode 100644
index 1511c70ea..000000000
--- a/build/docker/ubuntu-builder/enable_dockerx2
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-#
-# Needed to expose underlying cgroups to container
-echo "running x2" > /x2
-mount -n -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
-mount -t securityfs none /sys/kernel/security
-
-for mnt in $(cut -d: -f2 /proc/1/cgroup); do
- mkdir /sys/fs/cgroup/$mnt
- mount -n -t cgroup -o $mnt cgroup /sys/fs/cgroup/$mnt
-done
diff --git a/build/f_isoroot/Makefile b/build/f_isoroot/Makefile
index 8f84b6a73..0f7f14fa0 100644
--- a/build/f_isoroot/Makefile
+++ b/build/f_isoroot/Makefile
@@ -13,11 +13,15 @@ PLUGINS = f_odlpluginbuild f_qemupluginbuild f_ovs-nsh-dpdk-pluginbuild f_onosfw
# 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.
ifdef BUILD_FUEL_PLUGINS
-SUBDIRS = f_kscfg f_bootstrap f_repobuild $(BUILD_FUEL_PLUGINS)
+#SUBDIRS = f_kscfg f_bootstrap f_repobuild $(BUILD_FUEL_PLUGINS)
+SUBDIRS = f_kscfg f_bootstrap $(BUILD_FUEL_PLUGINS)
$(warning Overriding plugin build selection to $(BUILD_FUEL_PLUGINS))
else
-SUBDIRS = f_kscfg f_bootstrap f_repobuild $(PLUGINS)
+#SUBDIRS = f_kscfg f_bootstrap f_repobuild $(PLUGINS)
+SUBDIRS = f_kscfg f_bootstrap $(PLUGINS)
endif
SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
diff --git a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
index 065d0cb7d..d057d0aee 100755
--- a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
+++ b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
@@ -1,5 +1,53 @@
#!/bin/bash
+mkdir -p /var/log/puppet
+exec > >(tee -i /var/log/puppet/bootstrap_admin_node.log)
+exec 2>&1
+
FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
+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"
function countdown() {
local i
@@ -14,16 +62,139 @@ 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
-export ADMIN_INTERFACE=eth0
+# 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
-showmenu="no"
-if [ -f /etc/fuel/bootstrap_admin_node.conf ]; then
- . /etc/fuel/bootstrap_admin_node.conf
- echo "Applying admin interface '$ADMIN_INTERFACE'"
+# 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
@@ -61,6 +232,15 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
fi
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
@@ -93,11 +273,13 @@ hostname "$HOSTNAME"
# 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/bootstrap/ubuntu'
- mkdir -p $bootstrap_dir
- for item in linux initramfs.img; do
- touch "$bootstrap_dir/$item"
- done
+ 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 () {
@@ -105,47 +287,60 @@ get_bootstrap_flavor () {
python <<-EOF
from fuelmenu.fuelmenu import Settings
conf = Settings().read("$ASTUTE_YAML").get('BOOTSTRAP', {})
- print(conf.get('flavor', 'centos'))
+ print(conf.get('flavor', 'centos').lower())
+ EOF
+}
+
+get_bootstrap_skip () {
+ local ASTUTE_YAML='/etc/fuel/astute.yaml'
+ python <<-EOF
+ from fuelmenu.fuelmenu import Settings
+ conf = Settings().read("$ASTUTE_YAML").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
- local max_attempts=3
- local config='/etc/fuel-bootstrap-image.conf'
- local log='/var/log/fuel-bootstrap-image-build.log'
- if ! grep -qE '^BOOTSTRAP_SSH_KEYS' "$config"; then
- # FIXME: config file generated by fuelmenu has no trailing newline
- echo >> "$config"
- cat >> "$config" <<-EOF
- BOOTSTRAP_SSH_KEYS=/root/.ssh/id_rsa.pub
- EOF
- fi
- for n in `seq 1 $max_attempts`; do
- echo "Bulding bootstrap image, attempt $n" >&2
- if fuel-bootstrap-image >>"$log" 2>&1; then
- ret=0
- fuel-bootstrap-image-set "ubuntu"
- break
- fi
- done
- if [ $ret -ne 0 ]; then
- warning="WARNING: failed to build the bootstrap image, see $log for details.
-Perhaps your Internet connection is broken. Please fix the problem and run
-\`fuel-bootstrap-image-set ubuntu\`"
- fuel notify --topic warning --send "$warning"
- fi
- return $ret
+ 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
@@ -157,7 +352,7 @@ if [ -f /root/.build_images ]; then
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 /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/usr/sbin/apachectl -DFOREGROUND')
+ 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
@@ -170,6 +365,10 @@ if [ -f /root/.build_images ]; then
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
@@ -184,19 +383,37 @@ else
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
- build_ubuntu_bootstrap || true
+ 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
### OPNFV addition BEGIN
@@ -213,7 +430,7 @@ shopt -u nullglob
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}-centos6-fuel/updates/x86_64/
+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
@@ -222,14 +439,14 @@ EOF
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}-centos6-fuel/security/x86_64/
+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=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1)
+repourl=$(yum repolist all -v | awk '{if ($1 ~ "baseurl" && $3 ~ "updates") print $3}' | head -1)
if urlaccesscheck check "$repourl" ; then
UPDATE_ISSUES=0
else
@@ -237,30 +454,34 @@ else
fi
if [ $UPDATE_ISSUES -eq 1 ]; then
- 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"
+ message=${update_warn_message}
level="warning"
else
- 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"
+ message=${update_done_message}
level="done"
fi
echo
echo "*************************************************"
echo -e "${message}"
echo "*************************************************"
-echo "Sending notification to Fuel UI..."
-fuel notify --topic "${level}" --send "${message}"
+fuel notify --topic "${level}" --send $(echo "${message}" | tr '\r\n' ' ') 2>&1
-# TODO(kozhukalov) If building of bootstrap image fails
-# and if this image was supposed to be a default bootstrap image
-# we need to warn a user about this and give her
-# advice how to treat this.
+# 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
index 1bc349314..e1c3c7365 100755
--- a/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
+++ b/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
@@ -1,5 +1,53 @@
#!/bin/bash
+mkdir -p /var/log/puppet
+exec > >(tee -i /var/log/puppet/bootstrap_admin_node.log)
+exec 2>&1
+
FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
+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"
function countdown() {
local i
@@ -14,16 +62,139 @@ 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
-export ADMIN_INTERFACE=eth0
+# 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
-showmenu="no"
-if [ -f /etc/fuel/bootstrap_admin_node.conf ]; then
- . /etc/fuel/bootstrap_admin_node.conf
- echo "Applying admin interface '$ADMIN_INTERFACE'"
+# 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
@@ -51,6 +222,15 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
fi
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
@@ -83,11 +263,13 @@ hostname "$HOSTNAME"
# 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/bootstrap/ubuntu'
- mkdir -p $bootstrap_dir
- for item in linux initramfs.img; do
- touch "$bootstrap_dir/$item"
- done
+ 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 () {
@@ -95,47 +277,60 @@ get_bootstrap_flavor () {
python <<-EOF
from fuelmenu.fuelmenu import Settings
conf = Settings().read("$ASTUTE_YAML").get('BOOTSTRAP', {})
- print(conf.get('flavor', 'centos'))
+ print(conf.get('flavor', 'centos').lower())
+ EOF
+}
+
+get_bootstrap_skip () {
+ local ASTUTE_YAML='/etc/fuel/astute.yaml'
+ python <<-EOF
+ from fuelmenu.fuelmenu import Settings
+ conf = Settings().read("$ASTUTE_YAML").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
- local max_attempts=3
- local config='/etc/fuel-bootstrap-image.conf'
- local log='/var/log/fuel-bootstrap-image-build.log'
- if ! grep -qE '^BOOTSTRAP_SSH_KEYS' "$config"; then
- # FIXME: config file generated by fuelmenu has no trailing newline
- echo >> "$config"
- cat >> "$config" <<-EOF
- BOOTSTRAP_SSH_KEYS=/root/.ssh/id_rsa.pub
- EOF
- fi
- for n in `seq 1 $max_attempts`; do
- echo "Bulding bootstrap image, attempt $n" >&2
- if fuel-bootstrap-image >>"$log" 2>&1; then
- ret=0
- fuel-bootstrap-image-set "ubuntu"
- break
- fi
- done
- if [ $ret -ne 0 ]; then
- warning="WARNING: failed to build the bootstrap image, see $log for details.
-Perhaps your Internet connection is broken. Please fix the problem and run
-\`fuel-bootstrap-image-set ubuntu\`"
- fuel notify --topic warning --send "$warning"
- fi
- return $ret
+ 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
@@ -147,7 +342,7 @@ if [ -f /root/.build_images ]; then
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 /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/usr/sbin/apachectl -DFOREGROUND')
+ 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
@@ -160,6 +355,10 @@ if [ -f /root/.build_images ]; then
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
@@ -174,26 +373,44 @@ else
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
- build_ubuntu_bootstrap || true
+ 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}-centos6-fuel/updates/x86_64/
+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
@@ -202,14 +419,14 @@ EOF
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}-centos6-fuel/security/x86_64/
+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=$(grep baseurl /etc/yum.repos.d/*updates* 2>/dev/null | cut -d'=' -f2- | head -1)
+repourl=$(yum repolist all -v | awk '{if ($1 ~ "baseurl" && $3 ~ "updates") print $3}' | head -1)
if urlaccesscheck check "$repourl" ; then
UPDATE_ISSUES=0
else
@@ -217,30 +434,34 @@ else
fi
if [ $UPDATE_ISSUES -eq 1 ]; then
- 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"
+ message=${update_warn_message}
level="warning"
else
- 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"
+ message=${update_done_message}
level="done"
fi
echo
echo "*************************************************"
echo -e "${message}"
echo "*************************************************"
-echo "Sending notification to Fuel UI..."
-fuel notify --topic "${level}" --send "${message}"
+fuel notify --topic "${level}" --send $(echo "${message}" | tr '\r\n' ' ') 2>&1
-# TODO(kozhukalov) If building of bootstrap image fails
-# and if this image was supposed to be a default bootstrap image
-# we need to warn a user about this and give her
-# advice how to treat this.
+# 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_kscfg/ks.cfg b/build/f_isoroot/f_kscfg/ks.cfg
index 8c20971f8..c09a09be9 100644
--- a/build/f_isoroot/f_kscfg/ks.cfg
+++ b/build/f_isoroot/f_kscfg/ks.cfg
@@ -1,6 +1,7 @@
install
text
-%include /tmp/source.ks
+#%include /tmp/source.ks
+cdrom
reboot --eject
lang en_US.UTF-8
keyboard us
@@ -12,9 +13,69 @@ selinux --disabled
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
@@ -38,7 +99,13 @@ default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'`
installdrive="undefined"
forceformat="no"
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+for I in $(cat /proc/cmdline); do
+ case "$I" in
+ *=*)
+ if ! [[ "${I}" =~ "." ]]; then eval "$I"; fi
+ ;;
+ esac
+done
set ${drives} ${removable_drives}
numdrives=`echo $#`
@@ -177,20 +244,20 @@ fi
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
+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
-vgremove -ff os
+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 -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
@@ -206,20 +273,24 @@ if echo ${tgtdrive} | grep -q -e cciss ; then
else
bootdev=${tgtdrive}
fi
-echo > /tmp/partition.ks
-echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
-echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks
-echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks
-echo "volgroup os pv.001" >> /tmp/partition.ks
-echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks
-echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks
+
+cat << EOF > /tmp/partition.ks
+part /boot --onpart=/dev/${bootdev}3
+part /boot/efi --onpart=/dev/${bootdev}2
+part pv.001 --ondisk=${tgtdrive} --size=1 --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 --size=10000 --name=var --fstype=ext4
+logvol /var/log --vgname=os --size=4000 --grow --name=varlog --fstype=ext4
+EOF
+
# bootloader
-echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+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
@@ -234,80 +305,61 @@ 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
-%packages --nobase --excludedocs
-@Core
-fuel
-fuel-library >= 7.0
-fuel-dockerctl
-authconfig
-bind-utils
-cronie
-crontabs
-curl
-daemonize
-dhcp
-docker-io
-fuel-bootstrap-image
-fuel-bootstrap-image-builder
-fuel-createmirror
-fuel-target-centos-images6.6
-fuel-package-updates
-fuelmenu
-fuel-docker-images
-gdisk
-lrzip
-lsof
-man
-mlocate
-nmap-ncat
-ntp
-ntpdate
-openssh-clients
-policycoreutils
-python-daemon
-rsync
-ruby21-puppet
-ruby21-rubygem-netaddr
-ruby21-rubygem-openstack
-selinux-policy-targeted
-strace
-subscription-manager
-sysstat
-system-config-firewall-base
-tcpdump
-telnet
-vim-enhanced
-virt-what
-wget
-yum
-yum-plugin-priorities
-%include /tmp/post_partition.ks
-# POSTINSTALL SECTION
+
+
+# POSTINSTALL SECTIONS
# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER
# INSTALLATION ITSELF COMPLETED
-%post
-echo -e "modprobe nf_conntrack_ipv4\nmodprobe nf_conntrack_ipv6\nmodprobe nf_conntrack_tftp\nmodprobe nf_nat_tftp" >> /etc/rc.modules
-chmod +x /etc/rc.modules
-echo -e "net.nf_conntrack_max=1048576" >> /etc/sysctl.conf
-mkdir -p /var/log/coredump
-echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" >> /etc/sysctl.conf
-chmod 777 /var/log/coredump
-echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.conf
+
+
+# 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
+
+%end
+
+
+
+
# Mount installation media in chroot
%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
-#!/bin/sh
-
+#!/bin/bash
set -x
-SOURCE="/mnt/sysimage/tmp/source"
+source "/mnt/sysimage/root/anaconda.cmdline.vars"
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+SOURCE="/mnt/sysimage/tmp/source"
mkdir -p "${SOURCE}"
@@ -322,81 +374,32 @@ case "${repo}" in
fi
;;
esac
+%end
-%post --log=/root/anaconda-post-after-chroot.log
-#!/bin/bash
-set -x
-function save_cfg {
- scrFile="/etc/sysconfig/network-scripts/ifcfg-$admin_interface"
- search="domain $domain\nsearch $domain"
- sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network
- grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts
- echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
-
- echo DEVICE=$admin_interface > $scrFile
- echo ONBOOT=yes >> $scrFile
- echo NM_CONTROLLED=no >> $scrFile
- echo HWADDR=$hwaddr >> $scrFile
- echo USERCTL=no >> $scrFile
- echo PEERDNS=no >> $scrFile
- if [ $ip ]; then
- echo BOOTPROTO=static >> $scrFile
- echo IPADDR=$ip >> $scrFile
- echo NETMASK=$netmask >> $scrFile
- else
- echo BOOTPROTO=dhcp >> $scrFile
- fi
- scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface"
- #Ignore gateway and set up DHCP if it is used, otherwise apply it
- if [ $dhcp_interface ] && [ "$dhcp_interface" != "$admin_interface" ]; then
- echo "DEVICE=$dhcp_interface" > $scrDHCPFile
- echo "BOOTPROTO=dhcp" >> $scrDHCPFile
- echo "ONBOOT=yes" >> $scrDHCPFile
- echo "USERCTL=no" >> $scrDHCPFile
- else
- echo GATEWAY=$gw >> /etc/sysconfig/network
- fi
- [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
-}
-# Default FQDN
-hostname="nailgun.mirantis.com"
-
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
-hostname=$hostname
-domain=${hostname#*.}
-ip=$ip
-netmask=$netmask
-gw=$gw
-admin_interface=${admin_interface:-"eth0"}
-hwaddr=`ifconfig $admin_interface | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
-dhcp_interface=$dhcp_interface
-build_images=$build_images
-wait_for_external_config=$wait_for_external_config
-save_cfg
+
+%post --log=/root/anaconda-post-configure-repos.log
+#!/bin/bash
+set -x
# Mounting installation source
SOURCE=/tmp/source
FS=/tmp/fs
-echo
mkdir -p ${SOURCE}
mkdir -p ${FS}
-if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
- mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE}
+if test -e /dev/disk/by-label/OpenStack_Fuel; then
+ mount /dev/disk/by-label/OpenStack_Fuel ${SOURCE}
elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS}
mount -o loop ${FS}/nailgun.iso ${SOURCE}
fi
-OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version`
+# this file is provided by fuel-openstack-metadata package
+OPENSTACK_VERSION=`cat /etc/fuel_openstack_version`
# ----------------------
# UNPACKING REPOSITORIES
@@ -407,10 +410,14 @@ 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
@@ -428,29 +435,11 @@ 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
-# --------------------------
-# UNPACKING PUPPET MANIFESTS
-# --------------------------
-
-# create folders
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
-#rm -rf /etc/puppet/modules/
-
-# TODO(ikalnitsky): investigate why we need this
-#cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/
-
-# place modules and manifests
-#tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules
-#cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp
-cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/
-
-# make links for backward compatibility
-#pushd /etc/puppet
-#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
-#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
-#popd
+mkdir -p ${wwwdir}/targetimages
cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
@@ -458,12 +447,35 @@ 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 || :
@@ -482,19 +494,16 @@ 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-package-updates (see --help for options)
-* Ubuntu: fuel-createmirror (see --help for options)
+* 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
-# Copying bootstrap_admin_node.sh, chmod it and
-# adding /etc/init/bootstrap_admin_node.conf
-cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
-chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
-cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
+# 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.
@@ -508,32 +517,31 @@ cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_v
# Generete Fuel UUID
uuidgen > /etc/fuel/fuel-uuid
-# Run fuel menu
-[ -z "$showmenu" ] && showmenu="no"
-
-# Pause during bootstrap_admin_node to wait for external config
-[ -z "$wait_for_external_config" ] && wait_for_external_config="no"
-
-
# 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=${admin_interface}
-showmenu=${showmenu}
-wait_for_external_config=${wait_for_external_config}
+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
-cat > /etc/issue << EOF
+# 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:
-https://:8443
-
+$ipstr
Default administrator login: root
Default administrator password: r00tme
@@ -544,31 +552,6 @@ Please change root password on first login.
EOF
-
-cat >> '/etc/rc.local' << EOF
-first=yes
-for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do
-if [ "\$first" = "yes" ]; then
- ipstr="Fuel UI is available on: https://\$ip:8443"
- first=no
-else
- ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "https://\$ip:8443")
-fi
-done
-tmpissue=\$(mktemp)
-while read -r line; do
- if [[ "\$line" =~ "Fuel UI is available on" ]]; then
- echo -e "\$ipstr" >> \$tmpissue
- elif [[ "\$line" =~ :8443$ ]]; then
- :
- else
- echo -e "\$line" >> \$tmpissue
- fi
-done < /etc/issue
-mv "\$tmpissue" /etc/issue
-
-EOF
-
######### OPNFV addition BEGIN ############
# Copy data into /opt/opnfv
# TODO: This ought to be a package instead!
@@ -586,24 +569,63 @@ rm -rf ${FS}
echo "tos orphan 7" >> /etc/ntp.conf
-# Do not show error message on ntpdate failure. Customers should not be confused
-# if admin node does not have access to the internet time servers.
-sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failure/\1success/'
-
# Disabling splash
-sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf
-sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf
-
-# Disabling console clearing
-sed -i 's/getty/getty --noclear/' /etc/init/tty.conf
-
-# Disabling starting first console from start-ttys service
-sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init
+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) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+(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.orig b/build/f_isoroot/f_kscfg/ks.cfg.orig
index 148ef9908..a752dacac 100644
--- a/build/f_isoroot/f_kscfg/ks.cfg.orig
+++ b/build/f_isoroot/f_kscfg/ks.cfg.orig
@@ -1,6 +1,7 @@
install
text
-%include /tmp/source.ks
+#%include /tmp/source.ks
+cdrom
reboot --eject
lang en_US.UTF-8
keyboard us
@@ -12,9 +13,69 @@ selinux --disabled
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
@@ -38,7 +99,13 @@ default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'`
installdrive="undefined"
forceformat="no"
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+for I in $(cat /proc/cmdline); do
+ case "$I" in
+ *=*)
+ if ! [[ "${I}" =~ "." ]]; then eval "$I"; fi
+ ;;
+ esac
+done
set ${drives} ${removable_drives}
numdrives=`echo $#`
@@ -177,20 +244,20 @@ fi
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
+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
-vgremove -ff os
+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 -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
@@ -206,20 +273,24 @@ if echo ${tgtdrive} | grep -q -e cciss ; then
else
bootdev=${tgtdrive}
fi
-echo > /tmp/partition.ks
-echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
-echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks
-echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks
-echo "volgroup os pv.001" >> /tmp/partition.ks
-echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks
-echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks
+
+cat << EOF > /tmp/partition.ks
+part /boot --onpart=/dev/${bootdev}3
+part /boot/efi --onpart=/dev/${bootdev}2
+part pv.001 --ondisk=${tgtdrive} --size=1 --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 --size=10000 --name=var --fstype=ext4
+logvol /var/log --vgname=os --size=4000 --grow --name=varlog --fstype=ext4
+EOF
+
# bootloader
-echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+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
@@ -234,80 +305,61 @@ 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
-%packages --nobase --excludedocs
-@Core
-fuel
-fuel-library >= 7.0
-fuel-dockerctl
-authconfig
-bind-utils
-cronie
-crontabs
-curl
-daemonize
-dhcp
-docker-io
-fuel-bootstrap-image
-fuel-bootstrap-image-builder
-fuel-createmirror
-fuel-target-centos-images6.6
-fuel-package-updates
-fuelmenu
-fuel-docker-images
-gdisk
-lrzip
-lsof
-man
-mlocate
-nmap-ncat
-ntp
-ntpdate
-openssh-clients
-policycoreutils
-python-daemon
-rsync
-ruby21-puppet
-ruby21-rubygem-netaddr
-ruby21-rubygem-openstack
-selinux-policy-targeted
-strace
-subscription-manager
-sysstat
-system-config-firewall-base
-tcpdump
-telnet
-vim-enhanced
-virt-what
-wget
-yum
-yum-plugin-priorities
-%include /tmp/post_partition.ks
-# POSTINSTALL SECTION
+
+
+# POSTINSTALL SECTIONS
# HERE ARE COMMANDS THAT WILL BE LAUNCHED JUST AFTER
# INSTALLATION ITSELF COMPLETED
-%post
-echo -e "modprobe nf_conntrack_ipv4\nmodprobe nf_conntrack_ipv6\nmodprobe nf_conntrack_tftp\nmodprobe nf_nat_tftp" >> /etc/rc.modules
-chmod +x /etc/rc.modules
-echo -e "net.nf_conntrack_max=1048576" >> /etc/sysctl.conf
-mkdir -p /var/log/coredump
-echo -e "kernel.core_pattern=/var/log/coredump/core.%e.%p.%h.%t" >> /etc/sysctl.conf
-chmod 777 /var/log/coredump
-echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.conf
+
+
+# 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
+
+%end
+
+
+
+
# Mount installation media in chroot
%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
-#!/bin/sh
-
+#!/bin/bash
set -x
-SOURCE="/mnt/sysimage/tmp/source"
+source "/mnt/sysimage/root/anaconda.cmdline.vars"
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
+SOURCE="/mnt/sysimage/tmp/source"
mkdir -p "${SOURCE}"
@@ -322,81 +374,32 @@ case "${repo}" in
fi
;;
esac
+%end
-%post --log=/root/anaconda-post-after-chroot.log
-#!/bin/bash
-set -x
-function save_cfg {
- scrFile="/etc/sysconfig/network-scripts/ifcfg-$admin_interface"
- search="domain $domain\nsearch $domain"
- sed -i -e 's#^\(HOSTNAME=\).*$#\1'"$hostname"'#' /etc/sysconfig/network
- grep -q "^\s*$ip\s+$hostname" /etc/hosts || echo "$ip $hostname" >> /etc/hosts
- echo "${search}\nnameserver 127.0.0.1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/resolv.conf
- [ $dns1 ] && echo -e "${search}\nnameserver $dns1" > /etc/dnsmasq.upstream
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/resolv.conf
- [ $dns2 ] && echo "nameserver $dns2" >> /etc/dnsmasq.upstream
-
- echo DEVICE=$admin_interface > $scrFile
- echo ONBOOT=yes >> $scrFile
- echo NM_CONTROLLED=no >> $scrFile
- echo HWADDR=$hwaddr >> $scrFile
- echo USERCTL=no >> $scrFile
- echo PEERDNS=no >> $scrFile
- if [ $ip ]; then
- echo BOOTPROTO=static >> $scrFile
- echo IPADDR=$ip >> $scrFile
- echo NETMASK=$netmask >> $scrFile
- else
- echo BOOTPROTO=dhcp >> $scrFile
- fi
- scrDHCPFile="/etc/sysconfig/network-scripts/ifcfg-$dhcp_interface"
- #Ignore gateway and set up DHCP if it is used, otherwise apply it
- if [ $dhcp_interface ] && [ "$dhcp_interface" != "$admin_interface" ]; then
- echo "DEVICE=$dhcp_interface" > $scrDHCPFile
- echo "BOOTPROTO=dhcp" >> $scrDHCPFile
- echo "ONBOOT=yes" >> $scrDHCPFile
- echo "USERCTL=no" >> $scrDHCPFile
- else
- echo GATEWAY=$gw >> /etc/sysconfig/network
- fi
- [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
-}
-# Default FQDN
-hostname="nailgun.mirantis.com"
-
-for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
-hostname=$hostname
-domain=${hostname#*.}
-ip=$ip
-netmask=$netmask
-gw=$gw
-admin_interface=${admin_interface:-"eth0"}
-hwaddr=`ifconfig $admin_interface | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
-dhcp_interface=$dhcp_interface
-build_images=$build_images
-wait_for_external_config=$wait_for_external_config
-save_cfg
+
+%post --log=/root/anaconda-post-configure-repos.log
+#!/bin/bash
+set -x
# Mounting installation source
SOURCE=/tmp/source
FS=/tmp/fs
-echo
mkdir -p ${SOURCE}
mkdir -p ${FS}
-if test -e /dev/disk/by-label/"OpenStack_Fuel"; then
- mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE}
+if test -e /dev/disk/by-label/OpenStack_Fuel; then
+ mount /dev/disk/by-label/OpenStack_Fuel ${SOURCE}
elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
mount /dev/disk/by-uuid/will_be_substituted_with_actual_uuid ${FS}
mount -o loop ${FS}/nailgun.iso ${SOURCE}
fi
-OPENSTACK_VERSION=`cat ${SOURCE}/openstack_version`
+# this file is provided by fuel-openstack-metadata package
+OPENSTACK_VERSION=`cat /etc/fuel_openstack_version`
# ----------------------
# UNPACKING REPOSITORIES
@@ -407,10 +410,14 @@ 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
@@ -428,29 +435,11 @@ 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
-# --------------------------
-# UNPACKING PUPPET MANIFESTS
-# --------------------------
-
-# create folders
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
-#mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
-#rm -rf /etc/puppet/modules/
-
-# TODO(ikalnitsky): investigate why we need this
-#cp ${SOURCE}/puppet-slave.tgz ${wwwdir}/
-
-# place modules and manifests
-#tar zxf ${SOURCE}/puppet-slave.tgz -C /etc/puppet/${OPENSTACK_VERSION}/modules
-#cp /etc/puppet/${OPENSTACK_VERSION}/modules/osnailyfacter/examples/site.pp /etc/puppet/${OPENSTACK_VERSION}/manifests/site.pp
-cp ${SOURCE}/centos-versions.yaml ${SOURCE}/ubuntu-versions.yaml /etc/puppet/${OPENSTACK_VERSION}/manifests/
-
-# make links for backward compatibility
-#pushd /etc/puppet
-#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
-#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
-#popd
+mkdir -p ${wwwdir}/targetimages
cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
@@ -458,12 +447,35 @@ 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 || :
@@ -482,19 +494,16 @@ 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-package-updates (see --help for options)
-* Ubuntu: fuel-createmirror (see --help for options)
+* 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
-# Copying bootstrap_admin_node.sh, chmod it and
-# adding /etc/init/bootstrap_admin_node.conf
-cp ${SOURCE}/bootstrap_admin_node.sh /usr/local/sbin/bootstrap_admin_node.sh
-chmod 0777 /usr/local/sbin/bootstrap_admin_node.sh
-cp ${SOURCE}/bootstrap_admin_node.conf /etc/init/bootstrap_admin_node.conf
+# 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.
@@ -508,32 +517,31 @@ cp ${SOURCE}/version.yaml /etc/fuel/release_versions/`cat ${SOURCE}/openstack_v
# Generete Fuel UUID
uuidgen > /etc/fuel/fuel-uuid
-# Run fuel menu
-[ -z "$showmenu" ] && showmenu="no"
-
-# Pause during bootstrap_admin_node to wait for external config
-[ -z "$wait_for_external_config" ] && wait_for_external_config="no"
-
-
# 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=${admin_interface}
-showmenu=${showmenu}
-wait_for_external_config=${wait_for_external_config}
+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
-cat > /etc/issue << EOF
+# 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:
-https://:8443
-
+$ipstr
Default administrator login: root
Default administrator password: r00tme
@@ -544,32 +552,6 @@ Please change root password on first login.
EOF
-
-cat >> '/etc/rc.local' << EOF
-first=yes
-for ip in \$(ip -o -4 addr | grep "eth." | awk '{print \$4 }' | cut -d/ -f1); do
-if [ "\$first" = "yes" ]; then
- ipstr="Fuel UI is available on: https://\$ip:8443"
- first=no
-else
- ipstr=\$(printf "%s\n%25s%s" "\$ipstr" " " "https://\$ip:8443")
-fi
-done
-tmpissue=\$(mktemp)
-while read -r line; do
- if [[ "\$line" =~ "Fuel UI is available on" ]]; then
- echo -e "\$ipstr" >> \$tmpissue
- elif [[ "\$line" =~ :8443$ ]]; then
- :
- else
- echo -e "\$line" >> \$tmpissue
- fi
-done < /etc/issue
-mv "\$tmpissue" /etc/issue
-
-EOF
-
-
# Unmounting source
umount -f ${SOURCE}
rm -rf ${SOURCE}
@@ -579,24 +561,63 @@ rm -rf ${FS}
echo "tos orphan 7" >> /etc/ntp.conf
-# Do not show error message on ntpdate failure. Customers should not be confused
-# if admin node does not have access to the internet time servers.
-sed -i /etc/rc.d/init.d/ntpdate -e 's/\([ $RETVAL -eq 0 ] && success || \)failure/\1success/'
-
# Disabling splash
-sed -i --follow-symlinks -e '/^\skernel/ s/rhgb//' /etc/grub.conf
-sed -i --follow-symlinks -e '/^\skernel/ s/quiet//' /etc/grub.conf
-
-# Disabling console clearing
-sed -i 's/getty/getty --noclear/' /etc/init/tty.conf
-
-# Disabling starting first console from start-ttys service
-sed -i --follow-symlinks -e 's/ACTIVE_CONSOLES=.*/ACTIVE_CONSOLES=\/dev\/tty\[2-6\]/' /etc/sysconfig/init
+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) = "virtualbox" ]] && echo "blacklist i2c_piix4" > /etc/modprobe.d/blacklist-i2c-piix4.conf
+(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/fuel-main_6.patch b/build/fuel-main_6.patch
deleted file mode 100644
index 2659e2d17..000000000
--- a/build/fuel-main_6.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-*** prepare-build-env.sh.orig Mon Oct 19 13:28:30 2015
---- prepare-build-env.sh Mon Oct 19 13:29:10 2015
-***************
-*** 87,92 ****
---- 87,93 ----
- echo "Docker is running."
- else
- echo "Process is not running, starting it..."
-+ sudo sh -c 'echo DOCKER_OPTS=\"--dns 8.8.8.8 --dns 8.8.4.4 --bip 172.45.0.1/24\" >> /etc/default/docker*'
- sudo service docker start
- fi
- else
-***************
-*** 102,108 ****
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
- # Install docker
- sudo apt-get update
-! sudo apt-get -y install lxc-docker-1.5.0
- fi
-
- # Install software
---- 103,110 ----
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
- # Install docker
- sudo apt-get update
-! sudo sh -c 'echo DOCKER_OPTS=\"--dns 8.8.8.8 --dns 8.8.4.4 --bip 172.45.0.1/24\" > /etc/default/docker'
-! sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.5.0
- fi
-
- # Install software
diff --git a/build/fuel-main_7.patch b/build/fuel-main_7.patch
new file mode 100644
index 000000000..aa8eaf9ad
--- /dev/null
+++ b/build/fuel-main_7.patch
@@ -0,0 +1,19 @@
+*** config.mk.orig Thu Jan 7 23:30:38 2016
+--- config.mk Thu Jan 7 23:32:36 2016
+***************
+*** 153,159 ****
+ # 'msk', 'srt', 'usa', 'hrk', 'cz'
+ # Setting any other value or removing of this variable will cause
+ # download of all the packages directly from internet
+! USE_MIRROR?=ext
+
+ ifeq ($(USE_MIRROR),ext)
+ MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)-fuel/os/x86_64/
+--- 153,159 ----
+ # 'msk', 'srt', 'usa', 'hrk', 'cz'
+ # Setting any other value or removing of this variable will cause
+ # download of all the packages directly from internet
+! USE_MIRROR?=cz
+
+ ifeq ($(USE_MIRROR),ext)
+ MIRROR_FUEL?=http://mirror.fuel-infra.org/mos-repos/centos/$(PRODUCT_NAME)$(PRODUCT_VERSION)-centos$(CENTOS_MAJOR)-fuel/os/x86_64/
diff --git a/build/fuel-main_docker_version.patch b/build/fuel-main_docker_version.patch
index 2976675bd..22b58249b 100644
--- a/build/fuel-main_docker_version.patch
+++ b/build/fuel-main_docker_version.patch
@@ -1,18 +1,19 @@
-*** prepare-build-env.sh.orig Fri Dec 18 15:04:43 2015
---- prepare-build-env.sh Fri Dec 18 15:05:01 2015
+*** prepare-build-env.sh.orig 2016-01-11 14:55:50.615286910 +0100
+--- prepare-build-env.sh 2016-01-11 14:59:44.775308422 +0100
***************
-*** 104,110 ****
+*** 102,108 ****
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# Install docker
sudo apt-get update
- sudo sh -c 'echo DOCKER_OPTS=\"--dns 8.8.8.8 --dns 8.8.4.4 --bip 172.45.0.1/24\" > /etc/default/docker'
-! sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.5.0
+! sudo apt-get -y install lxc-docker-1.5.0
fi
# Install software
---- 104,110 ----
+--- 102,109 ----
+ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# Install docker
sudo apt-get update
- sudo sh -c 'echo DOCKER_OPTS=\"--dns 8.8.8.8 --dns 8.8.4.4 --bip 172.45.0.1/24\" > /etc/default/docker'
+! sudo sh -c 'echo DOCKER_OPTS=\"--bip 172.45.0.1/24\" > /etc/default/docker'
! sudo apt-get -y -o Dpkg::Options::="--force-confold" install lxc-docker-1.7.1
fi