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/f_isoroot | |
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/f_isoroot')
-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 |
11 files changed, 58 insertions, 2363 deletions
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 |