summaryrefslogtreecommitdiffstats
path: root/fuel/build/f_isoroot
diff options
context:
space:
mode:
authorStefan K. Berg <stefan.k.berg@ericsson.com>2015-09-10 14:46:28 +0200
committerStefan K. Berg <stefan.k.berg@ericsson.com>2015-09-14 13:53:11 +0200
commit07f4e6531023cbf742e7d187c6a0ee0800b64e01 (patch)
treea03c4311c4b9ac58d4105b5c3ac4741901146e8a /fuel/build/f_isoroot
parent2c06022aa12ec8fc0ac3e50de36b900c92bf9817 (diff)
Refactoring build system to support Fuel 6.1
As Fuel 6.1 has changed both Debian package handling (fetching repositories from Internet) as well as Puppet packaging, the support for patching these has been disabled. The pre-deploy logic of Fuel has been removed together with a number of patches applied on top of a Fuel build, among them fixes for NTP, DNS and /etc/hosts injection. Instead, when changed default behavior is required, this will be introduced as Fuel plugins which more cleanly integrates into the Fuel system, and also decouples additional functionality from the ISO build stage. Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'fuel/build/f_isoroot')
-rw-r--r--fuel/build/f_isoroot/Makefile2
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh107
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig108
-rw-r--r--[-rwxr-xr-x]fuel/build/f_isoroot/f_kscfg/ks.cfg122
-rw-r--r--fuel/build/f_isoroot/f_kscfg/ks.cfg.orig120
-rw-r--r--fuel/build/f_isoroot/f_predeployment/Makefile28
-rw-r--r--fuel/build/f_isoroot/f_predeployment/README18
-rwxr-xr-xfuel/build/f_isoroot/f_predeployment/pre-deploy.sh401
-rwxr-xr-xfuel/build/f_isoroot/f_predeployment/sysinfo.sh12
-rwxr-xr-xfuel/build/f_isoroot/f_predeployment/transform_yaml.py68
10 files changed, 321 insertions, 665 deletions
diff --git a/fuel/build/f_isoroot/Makefile b/fuel/build/f_isoroot/Makefile
index bde8e64..8a7f48a 100644
--- a/fuel/build/f_isoroot/Makefile
+++ b/fuel/build/f_isoroot/Makefile
@@ -8,7 +8,7 @@
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
-SUBDIRS = f_predeployment f_kscfg f_bootstrap
+SUBDIRS = f_kscfg f_bootstrap
SUBCLEAN = $(addsuffix .clean,$(SUBDIRS))
.PHONY: all
diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
index 348ce3c..8bdf566 100755
--- a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
+++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
@@ -1,4 +1,5 @@
#!/bin/bash
+FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
function countdown() {
local i
@@ -47,9 +48,6 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
{ kill "$pid"; wait $!; } 2>/dev/null
case "$key" in
$'\e') echo "Skipping Fuel Setup.."
- echo -n "Applying default Fuel setings..."
- fuelmenu --save-only --iface=eth0
- echo "Done!"
;;
*) echo -e "\nEntering Fuel Setup..."
fuelmenu
@@ -57,30 +55,51 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
esac
fi
fi
+
+
#Reread /etc/sysconfig/network to inform puppet of changes
. /etc/sysconfig/network
hostname "$HOSTNAME"
-### docker stuff
-images_dir="/var/www/nailgun/docker/images"
+service docker start
-# extract docker images
-mkdir -p $images_dir $sources_dir
-rm -f $images_dir/*tar
-pushd $images_dir &>/dev/null
+if [ -f /root/.build_images ]; then
+ #Fail on all errors
+ set -e
+ trap fail EXIT
-echo "Extracting and loading docker images. (This may take a while)"
-lrzip -d -o fuel-images.tar fuel-images.tar.lrz && tar -xf fuel-images.tar && rm -f fuel-images.tar
-popd &>/dev/null
-service docker start
+ echo "Loading Fuel base image for Docker..."
+ docker load -i /var/www/nailgun/docker/images/fuel-images.tar
-# load docker images
-for image in $images_dir/*tar ; do
- echo "Loading docker image ${image}..."
- docker load -i "$image"
- # clean up extracted image
- rm -f "$image"
-done
+ 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')
+ 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 -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
# apply puppet
puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
@@ -102,4 +121,52 @@ done
shopt -u nullglob
### OPNFV addition END
+# 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/centos-6/mos${FUEL_RELEASE}/updates/
+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/centos-6/mos${FUEL_RELEASE}/security/
+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)
+if urlaccesscheck check "$repourl" ; then
+ UPDATE_ISSUES=0
+else
+ UPDATE_ISSUES=1
+fi
+
+if [ $UPDATE_ISSUES -eq 1 ]; then
+ warning="WARNING: There are issues connecting to Fuel update repository.\
+\nPlease fix your connection and update this node with \`yum update\`\
+\nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+else
+ warning="WARNING: There may be updates available for Fuel.\
+\nYou should update this node with \`yum update\`. If there are available\
+\n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+fi
+echo
+echo "*************************************************"
+echo -e "$warning"
+echo "*************************************************"
+echo "Sending notification to Fuel UI..."
+fuel notify --topic warning --send "$warning"
echo "Fuel node deployment complete!"
diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
index 7b6e6bd..8d21c1e 100755
--- a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
+++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig
@@ -1,4 +1,5 @@
#!/bin/bash
+FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ')
function countdown() {
local i
@@ -37,9 +38,6 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
{ kill "$pid"; wait $!; } 2>/dev/null
case "$key" in
$'\e') echo "Skipping Fuel Setup.."
- echo -n "Applying default Fuel setings..."
- fuelmenu --save-only --iface=eth0
- echo "Done!"
;;
*) echo -e "\nEntering Fuel Setup..."
fuelmenu
@@ -47,30 +45,51 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
esac
fi
fi
+
+
#Reread /etc/sysconfig/network to inform puppet of changes
. /etc/sysconfig/network
hostname "$HOSTNAME"
-### docker stuff
-images_dir="/var/www/nailgun/docker/images"
+service docker start
-# extract docker images
-mkdir -p $images_dir $sources_dir
-rm -f $images_dir/*tar
-pushd $images_dir &>/dev/null
+if [ -f /root/.build_images ]; then
+ #Fail on all errors
+ set -e
+ trap fail EXIT
-echo "Extracting and loading docker images. (This may take a while)"
-lrzip -d -o fuel-images.tar fuel-images.tar.lrz && tar -xf fuel-images.tar && rm -f fuel-images.tar
-popd &>/dev/null
-service docker start
+ 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 /var/www/html/os;ln -sf /var/www/nailgun/centos/x86_64 /var/www/html/os/x86_64;/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 -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"
-# load docker images
-for image in $images_dir/*tar ; do
- echo "Loading docker image ${image}..."
- docker load -i "$image"
- # clean up extracted image
- rm -f "$image"
-done
+ #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
# apply puppet
puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
@@ -81,4 +100,53 @@ rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote
dockerctl check || fail
bash /etc/rc.local
+
+# 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/centos-6/mos${FUEL_RELEASE}/updates/
+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/centos-6/mos${FUEL_RELEASE}/security/
+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)
+if urlaccesscheck check "$repourl" ; then
+ UPDATE_ISSUES=0
+else
+ UPDATE_ISSUES=1
+fi
+
+if [ $UPDATE_ISSUES -eq 1 ]; then
+ warning="WARNING: There are issues connecting to Fuel update repository.\
+\nPlease fix your connection and update this node with \`yum update\`\
+\nThen run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+else
+ warning="WARNING: There may be updates available for Fuel.\
+\nYou should update this node with \`yum update\`. If there are available\
+\n updates, run \`dockerctl destroy all; bootstrap_admin_node.sh;\`\
+\nto repeat bootstrap on Fuel Master with the latest updates.\
+\nFor more information, check out Fuel documentation at:\
+\nhttp://docs.mirantis.com/fuel"
+fi
+echo
+echo "*************************************************"
+echo -e "$warning"
+echo "*************************************************"
+echo "Sending notification to Fuel UI..."
+fuel notify --topic warning --send "$warning"
echo "Fuel node deployment complete!"
diff --git a/fuel/build/f_isoroot/f_kscfg/ks.cfg b/fuel/build/f_isoroot/f_kscfg/ks.cfg
index 508f044..12cd1ab 100755..100644
--- a/fuel/build/f_isoroot/f_kscfg/ks.cfg
+++ b/fuel/build/f_isoroot/f_kscfg/ks.cfg
@@ -26,10 +26,12 @@ skipx
drives=""
removable_drives=""
for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do
- if (grep -q 0 /sys/block/${drv}/removable); then
- drives="${drives} ${drv}"
- else
- removable_drives="${removable_drives} ${drv}"
+ 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}'`
@@ -152,9 +154,9 @@ if [ "$format_confirmed" != "yes" ] ; then
chvt 1
fi
-# verify tgtdrive is at least 30GB
+# verify tgtdrive is at least 41GB
tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 ))
-if [ $tgtdrivesize -lt 30720 ]; then
+if [ $tgtdrivesize -lt 41984 ]; then
exec < /dev/tty3 > /dev/tty3 2>&1
chvt 3
clear
@@ -162,7 +164,7 @@ if [ $tgtdrivesize -lt 30720 ]; then
echo '********************************************************************'
echo '* E R R O R *'
echo '* *'
- echo '* Your disk is under 30GB in size. Installation cannot continue. *'
+ echo '* Your disk is under 41GB in size. Installation cannot continue. *'
echo '* Restart installation with a larger disk. *'
echo '* *'
echo '********************************************************************'
@@ -175,7 +177,9 @@ fi
tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//')
# source
-if test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+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
@@ -204,16 +208,18 @@ else
fi
echo > /tmp/partition.ks
echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
-echo "partition pv.001 --ondisk=${tgtdrive} --size=30000 --grow" >> /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 60 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/log --vgname=os --size=4096 --percent 40 --grow --name=varlog --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
# bootloader
-echo "bootloader --location=mbr --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+echo "bootloader --location=partition --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
@@ -233,6 +239,9 @@ echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch
%packages --nobase --excludedocs
@Core
+fuel
+fuel-library
+fuel-dockerctl
authconfig
bind-utils
cronie
@@ -241,7 +250,12 @@ curl
daemonize
dhcp
docker-io
+fuel-bootstrap-image
+fuel-createmirror
+fuel-target-centos-images
+fuel-package-updates
fuelmenu
+fuel-docker-images
gdisk
lrzip
lsof
@@ -249,8 +263,10 @@ man
mlocate
nmap-ncat
ntp
+ntpdate
openssh-clients
policycoreutils
+python-daemon
rsync
ruby21-puppet
ruby21-rubygem-netaddr
@@ -266,6 +282,7 @@ vim-enhanced
virt-what
wget
yum
+yum-plugin-priorities
%include /tmp/post_partition.ks
@@ -285,6 +302,8 @@ echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.c
%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
#!/bin/sh
+set -x
+
SOURCE="/mnt/sysimage/tmp/source"
for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
@@ -342,6 +361,7 @@ function save_cfg {
else
echo GATEWAY=$gw >> /etc/sysconfig/network
fi
+ [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
}
# Default FQDN
@@ -356,6 +376,7 @@ gw=$gw
device="eth0"
hwaddr=`ifconfig $device | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
dhcp_interface=$dhcp_interface
+build_images=$build_images
save_cfg
# Mounting installation source
@@ -366,7 +387,9 @@ echo
mkdir -p ${SOURCE}
mkdir -p ${FS}
-if test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+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
@@ -390,61 +413,47 @@ cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64
# Copying Ubuntu files
mkdir -p ${repodir}/ubuntu/x86_64/images
-cp -r ${SOURCE}/ubuntu/conf ${repodir}/ubuntu/x86_64
-cp -r ${SOURCE}/ubuntu/db ${repodir}/ubuntu/x86_64
cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64
-cp -r ${SOURCE}/ubuntu/indices ${repodir}/ubuntu/x86_64
cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64
-cp -r ${SOURCE}/ubuntu/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux ${repodir}/ubuntu/x86_64/images
-cp -r ${SOURCE}/ubuntu/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz ${repodir}/ubuntu/x86_64/images
+
+# 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
-# Copying bootstrap image
-mkdir -p ${wwwdir}/bootstrap
-cp -r ${SOURCE}/bootstrap/initramfs.img ${wwwdir}/bootstrap
-cp -r ${SOURCE}/bootstrap/linux ${wwwdir}/bootstrap
-
-# Copying target images
-cp -r ${SOURCE}/targetimages ${wwwdir}
-
-mkdir -p /root/.ssh
-chmod 700 /root/.ssh
-cp ${SOURCE}/bootstrap/bootstrap.rsa /root/.ssh
-chmod 600 /root/.ssh/bootstrap.rsa
-
# --------------------------
# UNPACKING PUPPET MANIFESTS
# --------------------------
# create folders
-mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
-mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
-rm -rf /etc/puppet/modules/
+#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}/
+#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
+#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
+#pushd /etc/puppet
+#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
+#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
+#popd
cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
-# Deploy docker images and ctl tools if we built ISO with docker containers support
-[ -d "${SOURCE}/docker" ] && cp -r ${SOURCE}/docker ${wwwdir}/docker
-
# Prepare local repository specification
rm /etc/yum.repos.d/CentOS*.repo
cat > /etc/yum.repos.d/nailgun.repo << EOF
@@ -461,6 +470,24 @@ 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-package-updates (see --help for options)
+* Ubuntu: fuel-createmirror (see --help for options)
+
+Please refer to the following guide for more information:
+https://docs.mirantis.com/openstack/fuel/fuel-6.1/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
@@ -546,10 +573,7 @@ rm -rf ${SOURCE}
umount -f ${FS} || true
rm -rf ${FS}
-# Enabling/configuring NTPD and ntpdate services
-echo "server 127.127.1.0" >> /etc/ntp.conf
-echo "fudge 127.127.1.0 stratum 10" >> /etc/ntp.conf
-echo "tos orphan 7" >> /etc/ntp.conf
+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.
@@ -571,4 +595,4 @@ 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
-%end
+%end \ No newline at end of file
diff --git a/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig b/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig
index bddf99c..cf8cf80 100644
--- a/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig
+++ b/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig
@@ -26,10 +26,12 @@ skipx
drives=""
removable_drives=""
for drv in `ls -1 /sys/block | grep "sd\|hd\|vd\|cciss"`; do
- if (grep -q 0 /sys/block/${drv}/removable); then
- drives="${drives} ${drv}"
- else
- removable_drives="${removable_drives} ${drv}"
+ 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}'`
@@ -152,9 +154,9 @@ if [ "$format_confirmed" != "yes" ] ; then
chvt 1
fi
-# verify tgtdrive is at least 30GB
+# verify tgtdrive is at least 41GB
tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 ))
-if [ $tgtdrivesize -lt 30720 ]; then
+if [ $tgtdrivesize -lt 41984 ]; then
exec < /dev/tty3 > /dev/tty3 2>&1
chvt 3
clear
@@ -162,7 +164,7 @@ if [ $tgtdrivesize -lt 30720 ]; then
echo '********************************************************************'
echo '* E R R O R *'
echo '* *'
- echo '* Your disk is under 30GB in size. Installation cannot continue. *'
+ echo '* Your disk is under 41GB in size. Installation cannot continue. *'
echo '* Restart installation with a larger disk. *'
echo '* *'
echo '********************************************************************'
@@ -175,7 +177,9 @@ fi
tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//')
# source
-if test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+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
@@ -204,16 +208,18 @@ else
fi
echo > /tmp/partition.ks
echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks
-echo "partition pv.001 --ondisk=${tgtdrive} --size=30000 --grow" >> /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 60 --grow --name=var --fstype=ext4" >> /tmp/partition.ks
-echo "logvol /var/log --vgname=os --size=4096 --percent 40 --grow --name=varlog --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
# bootloader
-echo "bootloader --location=mbr --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks
+echo "bootloader --location=partition --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
@@ -233,6 +239,9 @@ echo "cat /tmp/grub.script | chroot /mnt/sysimage /sbin/grub --no-floppy --batch
%packages --nobase --excludedocs
@Core
+fuel
+fuel-library
+fuel-dockerctl
authconfig
bind-utils
cronie
@@ -241,7 +250,12 @@ curl
daemonize
dhcp
docker-io
+fuel-bootstrap-image
+fuel-createmirror
+fuel-target-centos-images
+fuel-package-updates
fuelmenu
+fuel-docker-images
gdisk
lrzip
lsof
@@ -249,8 +263,10 @@ man
mlocate
nmap-ncat
ntp
+ntpdate
openssh-clients
policycoreutils
+python-daemon
rsync
ruby21-puppet
ruby21-rubygem-netaddr
@@ -266,6 +282,7 @@ vim-enhanced
virt-what
wget
yum
+yum-plugin-priorities
%include /tmp/post_partition.ks
@@ -285,6 +302,8 @@ echo -e "* soft core unlimited\n* hard core unlimited" >> /etc/security/limits.c
%post --nochroot --log=/mnt/sysimage/root/anaconda-post-before-chroot.log
#!/bin/sh
+set -x
+
SOURCE="/mnt/sysimage/tmp/source"
for I in `cat /proc/cmdline`; do case "$I" in *=*) eval $I;; esac ; done
@@ -342,6 +361,7 @@ function save_cfg {
else
echo GATEWAY=$gw >> /etc/sysconfig/network
fi
+ [ -n "$build_images" -a "$build_images" != "0" ] && echo -e "$build_images" > /root/.build_images
}
# Default FQDN
@@ -356,6 +376,7 @@ gw=$gw
device="eth0"
hwaddr=`ifconfig $device | grep -i hwaddr | sed -e 's#^.*hwaddr[[:space:]]*##I'`
dhcp_interface=$dhcp_interface
+build_images=$build_images
save_cfg
# Mounting installation source
@@ -366,7 +387,9 @@ echo
mkdir -p ${SOURCE}
mkdir -p ${FS}
-if test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then
+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
@@ -390,61 +413,47 @@ cp ${SOURCE}/.treeinfo ${repodir}/centos/x86_64
# Copying Ubuntu files
mkdir -p ${repodir}/ubuntu/x86_64/images
-cp -r ${SOURCE}/ubuntu/conf ${repodir}/ubuntu/x86_64
-cp -r ${SOURCE}/ubuntu/db ${repodir}/ubuntu/x86_64
cp -r ${SOURCE}/ubuntu/dists ${repodir}/ubuntu/x86_64
-cp -r ${SOURCE}/ubuntu/indices ${repodir}/ubuntu/x86_64
cp -r ${SOURCE}/ubuntu/pool ${repodir}/ubuntu/x86_64
-cp -r ${SOURCE}/ubuntu/installer-amd64/current/images/netboot/ubuntu-installer/amd64/linux ${repodir}/ubuntu/x86_64/images
-cp -r ${SOURCE}/ubuntu/installer-amd64/current/images/netboot/ubuntu-installer/amd64/initrd.gz ${repodir}/ubuntu/x86_64/images
+
+# 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
-# Copying bootstrap image
-mkdir -p ${wwwdir}/bootstrap
-cp -r ${SOURCE}/bootstrap/initramfs.img ${wwwdir}/bootstrap
-cp -r ${SOURCE}/bootstrap/linux ${wwwdir}/bootstrap
-
-# Copying target images
-cp -r ${SOURCE}/targetimages ${wwwdir}
-
-mkdir -p /root/.ssh
-chmod 700 /root/.ssh
-cp ${SOURCE}/bootstrap/bootstrap.rsa /root/.ssh
-chmod 600 /root/.ssh/bootstrap.rsa
-
# --------------------------
# UNPACKING PUPPET MANIFESTS
# --------------------------
# create folders
-mkdir -p /etc/puppet/${OPENSTACK_VERSION}/manifests/
-mkdir -p /etc/puppet/${OPENSTACK_VERSION}/modules/
-rm -rf /etc/puppet/modules/
+#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}/
+#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
+#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
+#pushd /etc/puppet
+#ln -s ${OPENSTACK_VERSION}/manifests/ /etc/puppet/manifests
+#ln -s ${OPENSTACK_VERSION}/modules/ /etc/puppet/modules
+#popd
cp ${SOURCE}/send2syslog.py /bin/send2syslog.py
mkdir -p /var/lib/hiera
touch /var/lib/hiera/common.yaml /etc/puppet/hiera.yaml
-# Deploy docker images and ctl tools if we built ISO with docker containers support
-[ -d "${SOURCE}/docker" ] && cp -r ${SOURCE}/docker ${wwwdir}/docker
-
# Prepare local repository specification
rm /etc/yum.repos.d/CentOS*.repo
cat > /etc/yum.repos.d/nailgun.repo << EOF
@@ -461,6 +470,24 @@ 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-package-updates (see --help for options)
+* Ubuntu: fuel-createmirror (see --help for options)
+
+Please refer to the following guide for more information:
+https://docs.mirantis.com/openstack/fuel/fuel-6.1/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
@@ -540,10 +567,7 @@ rm -rf ${SOURCE}
umount -f ${FS} || true
rm -rf ${FS}
-# Enabling/configuring NTPD and ntpdate services
-echo "server 127.127.1.0" >> /etc/ntp.conf
-echo "fudge 127.127.1.0 stratum 10" >> /etc/ntp.conf
-echo "tos orphan 7" >> /etc/ntp.conf
+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.
diff --git a/fuel/build/f_isoroot/f_predeployment/Makefile b/fuel/build/f_isoroot/f_predeployment/Makefile
deleted file mode 100644
index a5252df..0000000
--- a/fuel/build/f_isoroot/f_predeployment/Makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-TOP := $(shell pwd)
-
-.PHONY: all
-all:
- @mkdir -p release/opnfv
- @cp pre-deploy.sh release/opnfv
- @cp sysinfo.sh release/opnfv
- @cp transform_yaml.py release/opnfv
- @chmod 755 release/opnfv/*
-
-.PHONY: clean
-clean:
- @rm -rf release
-
-
-.PHONY: release
-release:clean all
- @cp -Rvp release/* ../release
diff --git a/fuel/build/f_isoroot/f_predeployment/README b/fuel/build/f_isoroot/f_predeployment/README
deleted file mode 100644
index 3eef9f2..0000000
--- a/fuel/build/f_isoroot/f_predeployment/README
+++ /dev/null
@@ -1,18 +0,0 @@
-##############################################################################
-# Copyright (c) 2015 Ericsson AB and others.
-# stefan.k.berg@ericsson.com
-# jonas.bjurel@ericsson.com
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Apache License, Version 2.0
-# which accompanies this distribution, and is available at
-# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
-
-This is the start of the interactive frontend that will add OPNFV configuration into
-the astute.yaml of the nodes. Currently just a test setup - prepare an installation
-up to the point of "deploy changes", but run "./pre-deploy.sh <envid> fragment.yaml"
-before actually hitting deploy, which will make sure to add the example fragment to
-the nodes.
-
-Note that the only part of the fragment.yaml that actually is acted on is the hosts
-part at this time.
diff --git a/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh b/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh
deleted file mode 100755
index c5c6c42..0000000
--- a/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh
+++ /dev/null
@@ -1,401 +0,0 @@
-#!/bin/bash -e
-##############################################################################
-# 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
-##############################################################################
-
-
-error_exit () {
- echo "$@" >&2
- exit 1
-}
-
-get_env() {
- local env_id=${1:-""}
-
- if [ -z $env_id ]; then
- local n_envs=$(fuel env --list | grep -v -E "^id|^--|^ *$" | wc -l)
- if [ $n_envs -ne 1 ]; then
- echo "Usage: $0 [<env-id>]" >&2
- error_exit "If only a single environment is present it can be left" \
- "out. Otherwise the environment must be selected"
- fi
- env_id=$(fuel env --list | grep -v -E "^id|^--" | awk '{print $1}')
- else
- if ! fuel --env $env_id environment 2>/dev/null grep -v -E "^id|^--" | \
- grep -q ^$env_id; then
- error_exit "No such environment ID: $env_id"
- fi
- fi
- echo $env_id
-}
-
-get_node_uid () {
- cat $1 | grep "^uid: " | sed "s/^uid: '//" | sed "s/'$//"
-}
-
-get_node_role () {
- cat $1 | grep "^role: " | sed "s/^role: //"
-}
-
-get_next_cic () {
- file=$1
-
- last=`cat $file | sed 's/.*://' | grep "cic-" | sed 's/cic\-.*sl//' | sort -n | tail -1`
- if [ -z "$last" ]; then
- next=1
- else
- next=$[$last + 2]
- fi
- echo $next
-}
-
-get_next_compute () {
- file=$1
-
- last=`cat $file | sed 's/.*://' | grep "cmp-" | sed 's/cmp\-.*sl//' | sort -n | tail -1`
- if [ -z "$last" ]; then
- next=7
- else
- next=$[$last + 2]
- fi
- echo $next
-}
-
-modify_hostnames () {
- env=$1
- file=$2
- for line in `cat $file`
- do
- old=`echo $line | sed 's/:.*//'`
- new=`echo $line | sed 's/.*://'`
- echo "Applying: $old -> $new"
-
- for dfile in deployment_$env/*.yaml
- do
- sed -i "s/$old/$new/g" $dfile
- done
-
- for pfile in provisioning_$env/*.yaml
- do
- sed -i "s/$old/$new/g" $pfile
- done
- done
-}
-
-setup_hostnames () {
- ENV=$1
- cd ${CONFIGDIR}
- touch hostnames.$ENV
-
- for dfile in deployment_$ENV/*.yaml
- do
- uid=`get_node_uid $dfile`
- hostname=`grep "^node-$uid:" hostnames.$ENV | sed 's/.*://'`
- if [ -z $hostname ]; then
-
- pfile=provisioning_$ENV/node-$uid.yaml
- role=`get_node_role $dfile`
-
- case $role in
- primary-controller)
- hostname="cic-pod0-sh0-sl`get_next_cic hostnames.$ENV`"
- ;;
- controller)
- hostname="cic-pod0-sh0-sl`get_next_cic hostnames.$ENV`"
- ;;
- compute)
- hostname="cmp-pod0-sh0-sl`get_next_compute hostnames.$ENV`"
- ;;
- *)
- echo "Unknown node type for UID $uid"
- exit 1
- ;;
- esac
-
- echo "node-$uid:$hostname" >> hostnames.$ENV
- else
- echo "Already got hostname $hostname for node-$uid"
-
- fi
- done
-
- rm -f hostnames.$ENV.old
- mv hostnames.$ENV hostnames.$ENV.old
- sort hostnames.$ENV.old | uniq > hostnames.$ENV
- modify_hostnames $ENV hostnames.$ENV
-}
-
-
-
-get_provisioning_info () {
- ENV=$1
- mkdir -p ${CONFIGDIR}
- cd ${CONFIGDIR}
- rm -Rf provisioning_$ENV
- echo "Getting provisioning info..."
- fuel --env $ENV provisioning --default
- if [ $? -ne 0 ]; then
- echo "Error: Could not get provisioning info for env $ENV">&2
- exit 1
- fi
-}
-
-get_deployment_info () {
- ENV=$1
- mkdir -p ${CONFIGDIR}
- cd ${CONFIGDIR}
- rm -Rf deployment_$ENV
- echo "Getting deployment info..."
- fuel --env $ENV deployment --default
- if [ $? -ne 0 ]; then
- echo "Error: Could not get deployment info for env $ENV">&2
- exit 1
- fi
-}
-
-transform_yaml () {
- ENV=$1
- cd ${CONFIGDIR}
- for dfile in deployment_$ENV/*.yaml
- do
- /opt/opnfv/transform_yaml.py $dfile
- done
-}
-
-commit_changes () {
- ENV=$1
- cd ${CONFIGDIR}
-
- fuel --env $ENV deployment --upload
- fuel --env $ENV provisioning --upload
-}
-
-add_yaml_fragment () {
- ENV=$1
- FRAGMENT=${CONFIGDIR}/fragment.yaml.$ENV
-
- cd ${CONFIGDIR}
- for dfile in deployment_$ENV/*.yaml
- do
- cnt=`grep "^opnfv:" $dfile | wc -l `
- if [ $cnt -eq 0 ]; then
- echo "Adding fragment to $dfile"
- cat $FRAGMENT >> $dfile
- else
- echo "Already have fragment in $dfile"
- fi
- done
-}
-
-
-ip_valid() {
- IP_ADDRESS="$1"
- # Check if the format looks right_
- echo "$IP_ADDRESS" | egrep -qE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' || return 1
- #check that each octect is less than or equal to 255:
- echo $IP_ADDRESS | awk -F'.' '$1 <=255 && $2 <= 255 && $3 <=255 && $4 <= 255 {print "Y" } ' | grep -q Y || return 1
- return 0
-}
-
-
-generate_ntp_entry() {
- FILE=$1
- read -p "NTP server:" NTP_SERVER
- if [ -z "$NTP_SERVER" ]; then
- return 1
- elif confirm_yes "Are you sure you want to add this entry (y/n): "; then
- echo "Confirmed"
- echo " server $NTP_SERVER" >> $FILE
- fi
-}
-
-generate_hostfile_entry() {
- FILE=$1
- read -p "Name:" HOST_NAME
- if [ -z "$HOST_NAME" ]; then
- return 1
- else
- read -p "FQDN:" HOST_FQDN
- read -p "IP: " HOST_IP
- while ! ip_valid "$HOST_IP"
- do
- echo "This is not a valid IP! Try again."
- read -p "IP: " HOST_IP
- done
- fi
- if confirm_yes "Are you sure you want to add this entry (y/n): "; then
- echo "Confirmed"
- echo " - name: $HOST_NAME" >> $FILE
- echo " address: $HOST_IP" >> $FILE
- echo " fqdn: $HOST_FQDN" >> $FILE
- else
- echo "Not confirmed"
- fi
- return 0
-}
-
-generate_dns_entry() {
- FILE=$1
- PROMPT=$2
- read -p "${PROMPT}:" DNS_IP
- if [ -z "$DNS_IP" ]; then
- return 1
- else
- while ! ip_valid "$DNS_IP"
- do
- echo "This is not a valid IP! Try again."
- read -p "${PROMPT}: " DNS_IP
- done
- fi
- if confirm_yes "Are you sure you want to add this entry (y/n): "; then
- echo "Confirmed"
- echo " - $DNS_IP" >> $FILE
- else
- echo "Not confirmed"
- fi
- return 0
-}
-
-confirm_yes() {
- prompt=$1
- while true
- do
- read -p "$prompt" YESNO
- case $YESNO in
- [Yy])
- return 0
- ;;
- [Nn])
- return 1
- ;;
- esac
- done
-}
-
-generate_yaml_fragment() {
- ENV=$1
- FRAGMENT=${CONFIGDIR}/fragment.yaml.$ENV
-
- if [ -f $FRAGMENT ]; then
- echo "Manual configuration already performed, reusing previous data from $FRAGMENT."
- echo "Press return to continue or ^C to stop."
- read ans
- return
- fi
-
- echo "opnfv:" > ${FRAGMENT}
-
- clear
- echo -e "\n\nPre-deployment configuration\n\n"
-
- echo -e "\n\nIPs for the DNS servers to go into /etc/resolv.conf. You will be"
- echo -e "prompted for one IP at the time. Press return on an empty line"
- echo -e "to complete your input. If no DNS server is specified, the IP of"
- echo -e "the Fuel master will be used instead.\n"
-
- DNSCICYAML=${CONFIGDIR}/cicdns.yaml.$ENV
- rm -f $DNSCICYAML
-
- echo -e "\n\n"
-
- while generate_dns_entry $DNSCICYAML "IP for CIC name servers"
- do
- :
- done
-
- if [ -f $DNSCICYAML ]; then
- echo " dns:" >> $FRAGMENT
- echo " controller:" >> $FRAGMENT
- cat $DNSCICYAML >> $FRAGMENT
- fi
-
-
- DNSCMPYAML=${CONFIGDIR}/cmpdns.yaml.$ENV
- rm -f $DNSCMPYAML
-
- echo -e "\n\n"
-
- while generate_dns_entry $DNSCMPYAML "IP for compute node name servers"
- do
- :
- done
-
-
- if [ -f $DNSCMPYAML ]; then
- if [ ! -f $DNSCICYAML ]; then
- echo " dns:" >> $FRAGMENT
- fi
- echo " compute:" >> $FRAGMENT
- cat $DNSCMPYAML >> $FRAGMENT
- fi
-
- echo -e "\n\nHosts file additions for controllers and compute nodes. You will be"
- echo -e "prompted for name, FQDN and IP for each entry. Press return when prompted"
- echo -e "for a name when you have completed your input.\n"
-
-
- HOSTYAML=${CONFIGDIR}/hosts.yaml.$ENV
- rm -f $HOSTYAML
- while generate_hostfile_entry $HOSTYAML
- do
- :
- done
-
- if [ -f $HOSTYAML ]; then
- echo " hosts:" >> $FRAGMENT
- cat $HOSTYAML >> $FRAGMENT
- fi
-
- echo -e "\n\nNTP upstream configuration for controllers.You will be"
- echo -e "prompted for a NTP server each entry. Press return when prompted"
- echo -e "for a NTP serverwhen you have completed your input.\n"
-
-
- NTPYAML=${CONFIGDIR}/ntp.yaml.$ENV
- rm -f $NTPYAML
- while generate_ntp_entry $NTPYAML
- do
- :
- done
-
- if [ -f $NTPYAML ]; then
- echo " ntp:" >> $FRAGMENT
- echo " controller: |" >> $FRAGMENT
- cat $NTPYAML >> $FRAGMENT
-
- echo " compute: |" >> $FRAGMENT
- for ctl in `find $CONFIGDIR/deployment_$ENV -name '*controller*.yaml'`
- do
- fqdn=`grep "^fqdn:" $ctl | sed 's/fqdn: *//'`
- echo " server $fqdn" >> $FRAGMENT
- done
- fi
-
- # If nothing added make sure we get an empty opnfv hash
- # instead of a NULL hash.
- if [ $(wc -l $FRAGMENT | awk '{print $1}') -le 1 ]; then
- echo "opnfv: {}" >$FRAGMENT
- fi
-}
-
-ENV=$(get_env "$@")
-
-CONFIGDIR="/var/lib/opnfv"
-mkdir -p $CONFIGDIR
-
-get_deployment_info $ENV
-# Uncomment the below to enable the control_bond example
-#transform_yaml $ENV
-get_provisioning_info $ENV
-generate_yaml_fragment $ENV
-# The feature to change hostnames from node-<n> to cmp- or cic- is disabled.
-# To turn it on, uncomment the following line.
-#setup_hostnames $ENV
-add_yaml_fragment $ENV
-commit_changes $ENV
diff --git a/fuel/build/f_isoroot/f_predeployment/sysinfo.sh b/fuel/build/f_isoroot/f_predeployment/sysinfo.sh
deleted file mode 100755
index e99cac0..0000000
--- a/fuel/build/f_isoroot/f_predeployment/sysinfo.sh
+++ /dev/null
@@ -1,12 +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
-##############################################################################
-
-dockerctl shell cobbler cobbler system list | grep -v default | xargs -n 1 host | sort | sed 's/\..* /\t/'
diff --git a/fuel/build/f_isoroot/f_predeployment/transform_yaml.py b/fuel/build/f_isoroot/f_predeployment/transform_yaml.py
deleted file mode 100755
index 14eec4c..0000000
--- a/fuel/build/f_isoroot/f_predeployment/transform_yaml.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/python
-##############################################################################
-# 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
-##############################################################################
-
-# Remove control and management network transformations from file.
-# Only to be used together with f_control_bond_example (enable in
-# pre-deploy.sh)
-
-import yaml
-import re
-import sys
-import os
-
-if len(sys.argv) != 2:
- sys.stderr.write("Usage: "+sys.argv[0]+" <filename>\n")
- sys.exit(1)
-
-filename = sys.argv[1]
-if not os.path.exists(filename):
- sys.stderr.write("ERROR: The file "+filename+" could not be opened\n")
- sys.exit(1)
-
-ignore_values = [ "eth0", "eth1", "br-mgmt", "br-fw-admin" ]
-
-infile = open(filename, 'r')
-doc = yaml.load(infile)
-infile.close()
-
-out={}
-
-for scheme in doc:
- if scheme == "network_scheme":
- mytransformation = {}
- for operation in doc[scheme]:
- if operation == "transformations":
- # We need the base bridges for l23network to be happy,
- # remove everything else.
- mytrans = [ { "action": "add-br", "name": "br-mgmt" },
- { "action": "add-br", "name": "br-fw-admin" } ]
- for trans in doc[scheme][operation]:
- delete = 0
- for ignore in ignore_values:
- matchObj = re.search(ignore,str(trans))
- if matchObj:
- delete = 1
- if delete == 0:
- mytrans.append(trans)
- else:
- pass
- #print "Deleted", trans
-
- mytransformation[operation] = mytrans
- else:
- mytransformation[operation] = doc[scheme][operation]
- out[scheme] = mytransformation
- else:
- out[scheme] = doc[scheme]
-
-outfile = open(filename, 'w')
-outfile.write(yaml.dump(out, default_flow_style=False))
-outfile.close()