diff options
author | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-10-03 16:54:43 +0200 |
---|---|---|
committer | Jonas Bjurel <jonas.bjurel@ericsson.com> | 2015-10-03 16:54:43 +0200 |
commit | 11dbe27afb96c5b54b9f4f0a1c8b21194f59dc7b (patch) | |
tree | 1ee6814c36c7af010cff9d67a1cf1643b233a378 /fuel/build/f_isoroot | |
parent | 0d4a1f4143d71fc616f456a3708d5c8c2a24ec3f (diff) |
Moving tag arno.2015.1.0 from genesis to fuel/stable/arnoarno.2015.1.0
Change-Id: I8bb3e28a814e04ad15e8a4b24b40bd7685600f46
Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'fuel/build/f_isoroot')
-rw-r--r-- | fuel/build/f_isoroot/Makefile | 2 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh | 107 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh.orig | 108 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_bootstrap/post-scripts/01_fix_iommubug.sh | 9 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh | 15 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh | 19 | ||||
-rwxr-xr-x[-rw-r--r--] | fuel/build/f_isoroot/f_kscfg/ks.cfg | 122 | ||||
-rw-r--r-- | fuel/build/f_isoroot/f_kscfg/ks.cfg.orig | 120 | ||||
-rw-r--r-- | fuel/build/f_isoroot/f_odlpluginbuild/Makefile | 38 | ||||
-rw-r--r-- | fuel/build/f_isoroot/f_predeployment/Makefile | 28 | ||||
-rw-r--r-- | fuel/build/f_isoroot/f_predeployment/README | 18 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_predeployment/pre-deploy.sh | 401 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_predeployment/sysinfo.sh | 12 | ||||
-rwxr-xr-x | fuel/build/f_isoroot/f_predeployment/transform_yaml.py | 68 | ||||
-rw-r--r-- | fuel/build/f_isoroot/f_repobuild/Makefile | 56 |
15 files changed, 689 insertions, 434 deletions
diff --git a/fuel/build/f_isoroot/Makefile b/fuel/build/f_isoroot/Makefile index a9b12d927..bde8e6442 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_kscfg f_bootstrap f_repobuild f_odlpluginbuild +SUBDIRS = f_predeployment 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 8bdf5667c..348ce3cb4 100755 --- a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh +++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh @@ -1,5 +1,4 @@ #!/bin/bash -FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ') function countdown() { local i @@ -48,6 +47,9 @@ 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 @@ -55,51 +57,30 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then esac fi fi - - #Reread /etc/sysconfig/network to inform puppet of changes . /etc/sysconfig/network hostname "$HOSTNAME" -service docker start - -if [ -f /root/.build_images ]; then - #Fail on all errors - set -e - trap fail EXIT +### docker stuff +images_dir="/var/www/nailgun/docker/images" - echo "Loading Fuel base image for Docker..." - docker load -i /var/www/nailgun/docker/images/fuel-images.tar +# extract docker images +mkdir -p $images_dir $sources_dir +rm -f $images_dir/*tar +pushd $images_dir &>/dev/null - 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" +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 - #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 +# load docker images +for image in $images_dir/*tar ; do + echo "Loading docker image ${image}..." + docker load -i "$image" + # clean up extracted image + rm -f "$image" +done # apply puppet puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp @@ -121,52 +102,4 @@ 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 8d21c1e72..7b6e6bd71 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,5 +1,4 @@ #!/bin/bash -FUEL_RELEASE=$(grep release: /etc/fuel/version.yaml | cut -d: -f2 | tr -d '" ') function countdown() { local i @@ -38,6 +37,9 @@ 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 @@ -45,51 +47,30 @@ if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then esac fi fi - - #Reread /etc/sysconfig/network to inform puppet of changes . /etc/sysconfig/network hostname "$HOSTNAME" -service docker start - -if [ -f /root/.build_images ]; then - #Fail on all errors - set -e - trap fail EXIT +### docker stuff +images_dir="/var/www/nailgun/docker/images" - echo "Loading Fuel base image for Docker..." - docker load -i /var/www/nailgun/docker/images/fuel-images.tar +# extract docker images +mkdir -p $images_dir $sources_dir +rm -f $images_dir/*tar +pushd $images_dir &>/dev/null - 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" +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 - #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 +# load docker images +for image in $images_dir/*tar ; do + echo "Loading docker image ${image}..." + docker load -i "$image" + # clean up extracted image + rm -f "$image" +done # apply puppet puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp @@ -100,53 +81,4 @@ 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_bootstrap/post-scripts/01_fix_iommubug.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/01_fix_iommubug.sh new file mode 100755 index 000000000..79aa31a4a --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/01_fix_iommubug.sh @@ -0,0 +1,9 @@ +#/bin/sh +echo "Setting intel_iommu=off in bootstrap profile - a fix for the Dell systems" +echo "Old settings" +dockerctl shell cobbler cobbler profile report --name bootstrap +echo "Modifying" +dockerctl shell cobbler cobbler profile edit --name bootstrap --kopts "intel_iommu=off" --in-place +echo "New settings" +dockerctl shell cobbler cobbler profile report --name bootstrap + diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh new file mode 100755 index 000000000..bf7591bdc --- /dev/null +++ b/fuel/build/f_isoroot/f_bootstrap/post-scripts/02_fix_console_speed.sh @@ -0,0 +1,15 @@ +#/bin/sh +echo "Changing console speed to 115200 (std is 9600) on bootstrap" +echo "Old settings" +dockerctl shell cobbler cobbler profile report --name bootstrap +echo "Modifying" +dockerctl shell cobbler cobbler profile edit --name bootstrap --kopts "console=tty0 console=ttyS0,115200" --in-place +echo "New settings" +dockerctl shell cobbler cobbler profile report --name bootstrap +echo "Setting console speed to 115200 on ubuntu_1204_x86_64 (std is no serial console)" +echo "Old settings" +dockerctl shell cobbler cobbler profile report --name ubuntu_1204_x86_64 +echo "Modifying" +dockerctl shell cobbler cobbler profile edit --name ubuntu_1204_x86_64 --kopts "console=tty0 console=ttyS0,115200" --in-place +echo "New settings" +dockerctl shell cobbler cobbler profile report --name ubuntu_1204_x86_64 diff --git a/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh b/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh deleted file mode 100755 index 427a55add..000000000 --- a/fuel/build/f_isoroot/f_bootstrap/post-scripts/03_install_repo.sh +++ /dev/null @@ -1,19 +0,0 @@ -#/bin/sh -echo "Installing pre-build repo" -if [ ! -d /opt/opnfv/nailgun ]; then - echo "Error - found no repo!" - exit 1 -fi - -mkdir -p /var/www/nailgun -mv /opt/opnfv/nailgun/* /var/www/nailgun -if [ $? -ne 0 ]; then - echo "Error moving repos to their correct location!" - exit 1 -fi -rmdir /opt/opnfv/nailgun -if [ $? -ne 0 ]; then - echo "Error removing /opt/opnfv/nailgun directory!" - exit 1 -fi -echo "Done installing pre-build repo" diff --git a/fuel/build/f_isoroot/f_kscfg/ks.cfg b/fuel/build/f_isoroot/f_kscfg/ks.cfg index 12cd1abab..508f04436 100644..100755 --- a/fuel/build/f_isoroot/f_kscfg/ks.cfg +++ b/fuel/build/f_isoroot/f_kscfg/ks.cfg @@ -26,12 +26,10 @@ skipx 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 + if (grep -q 0 /sys/block/${drv}/removable); then + drives="${drives} ${drv}" + else + removable_drives="${removable_drives} ${drv}" fi done default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` @@ -154,9 +152,9 @@ if [ "$format_confirmed" != "yes" ] ; then chvt 1 fi -# verify tgtdrive is at least 41GB +# verify tgtdrive is at least 30GB tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 )) -if [ $tgtdrivesize -lt 41984 ]; then +if [ $tgtdrivesize -lt 30720 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 clear @@ -164,7 +162,7 @@ if [ $tgtdrivesize -lt 41984 ]; then echo '********************************************************************' echo '* E R R O R *' echo '* *' - echo '* Your disk is under 41GB in size. Installation cannot continue. *' + echo '* Your disk is under 30GB in size. Installation cannot continue. *' echo '* Restart installation with a larger disk. *' echo '* *' echo '********************************************************************' @@ -177,9 +175,7 @@ fi tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//') # source -if test -e /dev/disk/by-label/"OpenStack_Fuel"; then - echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks -elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then +if 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 @@ -208,18 +204,16 @@ else fi echo > /tmp/partition.ks echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks -echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks -echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks +echo "partition pv.001 --ondisk=${tgtdrive} --size=30000 --grow" >> /tmp/partition.ks echo "volgroup os pv.001" >> /tmp/partition.ks echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks -echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks -echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks -echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks +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 # bootloader -echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks +echo "bootloader --location=mbr --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 @@ -239,9 +233,6 @@ 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 @@ -250,12 +241,7 @@ curl daemonize dhcp docker-io -fuel-bootstrap-image -fuel-createmirror -fuel-target-centos-images -fuel-package-updates fuelmenu -fuel-docker-images gdisk lrzip lsof @@ -263,10 +249,8 @@ man mlocate nmap-ncat ntp -ntpdate openssh-clients policycoreutils -python-daemon rsync ruby21-puppet ruby21-rubygem-netaddr @@ -282,7 +266,6 @@ vim-enhanced virt-what wget yum -yum-plugin-priorities %include /tmp/post_partition.ks @@ -302,8 +285,6 @@ 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 @@ -361,7 +342,6 @@ 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 @@ -376,7 +356,6 @@ 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 @@ -387,9 +366,7 @@ echo mkdir -p ${SOURCE} mkdir -p ${FS} -if test -e /dev/disk/by-label/"OpenStack_Fuel"; then - mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE} -elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then +if 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 @@ -413,47 +390,61 @@ 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 - -# 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 +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 # 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 @@ -470,24 +461,6 @@ 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 @@ -573,7 +546,10 @@ rm -rf ${SOURCE} umount -f ${FS} || true rm -rf ${FS} -echo "tos orphan 7" >> /etc/ntp.conf +# 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 # 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. @@ -595,4 +571,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
\ No newline at end of file +%end diff --git a/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig b/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig index cf8cf80d1..bddf99c87 100644 --- a/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig +++ b/fuel/build/f_isoroot/f_kscfg/ks.cfg.orig @@ -26,12 +26,10 @@ skipx 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 + if (grep -q 0 /sys/block/${drv}/removable); then + drives="${drives} ${drv}" + else + removable_drives="${removable_drives} ${drv}" fi done default_drive=`echo ${drives} ${removable_drives} | awk '{print $1}'` @@ -154,9 +152,9 @@ if [ "$format_confirmed" != "yes" ] ; then chvt 1 fi -# verify tgtdrive is at least 41GB +# verify tgtdrive is at least 30GB tgtdrivesize=$(( $(cat "/sys/class/block/${tgtdrive}/size") / 2 / 1024 )) -if [ $tgtdrivesize -lt 41984 ]; then +if [ $tgtdrivesize -lt 30720 ]; then exec < /dev/tty3 > /dev/tty3 2>&1 chvt 3 clear @@ -164,7 +162,7 @@ if [ $tgtdrivesize -lt 41984 ]; then echo '********************************************************************' echo '* E R R O R *' echo '* *' - echo '* Your disk is under 41GB in size. Installation cannot continue. *' + echo '* Your disk is under 30GB in size. Installation cannot continue. *' echo '* Restart installation with a larger disk. *' echo '* *' echo '********************************************************************' @@ -177,9 +175,7 @@ fi tgtdrive=$(echo $tgtdrive | sed -e 's/!/\//') # source -if test -e /dev/disk/by-label/"OpenStack_Fuel"; then - echo "harddrive --partition=LABEL="OpenStack_Fuel" --dir=/" > /tmp/source.ks -elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then +if 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 @@ -208,18 +204,16 @@ else fi echo > /tmp/partition.ks echo "partition /boot --onpart=/dev/${bootdev}3" >> /tmp/partition.ks -echo "partition /boot/efi --onpart=/dev/${bootdev}2" >> /tmp/partition.ks -echo "partition pv.001 --ondisk=${tgtdrive} --size=41000 --grow" >> /tmp/partition.ks +echo "partition pv.001 --ondisk=${tgtdrive} --size=30000 --grow" >> /tmp/partition.ks echo "volgroup os pv.001" >> /tmp/partition.ks echo "logvol swap --vgname=os --recommended --name=swap" >> /tmp/partition.ks echo "logvol / --vgname=os --size=10000 --name=root --fstype=ext4" >> /tmp/partition.ks -echo "logvol /var --vgname=os --size=10000 --percent 30 --grow --name=var --fstype=ext4" >> /tmp/partition.ks -echo "logvol /var/lib/docker --vgname=os --size=17000 --percent 20 --grow --name=varlibdocker --fstype=ext4" >> /tmp/partition.ks -echo "logvol /var/log --vgname=os --size=4096 --percent 50 --grow --name=varlog --fstype=ext4" >> /tmp/partition.ks +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 # bootloader -echo "bootloader --location=partition --driveorder=${tgtdrive} --append=' biosdevname=0 crashkernel=none'" > /tmp/bootloader.ks +echo "bootloader --location=mbr --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 @@ -239,9 +233,6 @@ 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 @@ -250,12 +241,7 @@ curl daemonize dhcp docker-io -fuel-bootstrap-image -fuel-createmirror -fuel-target-centos-images -fuel-package-updates fuelmenu -fuel-docker-images gdisk lrzip lsof @@ -263,10 +249,8 @@ man mlocate nmap-ncat ntp -ntpdate openssh-clients policycoreutils -python-daemon rsync ruby21-puppet ruby21-rubygem-netaddr @@ -282,7 +266,6 @@ vim-enhanced virt-what wget yum -yum-plugin-priorities %include /tmp/post_partition.ks @@ -302,8 +285,6 @@ 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 @@ -361,7 +342,6 @@ 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 @@ -376,7 +356,6 @@ 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 @@ -387,9 +366,7 @@ echo mkdir -p ${SOURCE} mkdir -p ${FS} -if test -e /dev/disk/by-label/"OpenStack_Fuel"; then - mount /dev/disk/by-label/"OpenStack_Fuel" ${SOURCE} -elif test -e /dev/disk/by-uuid/will_be_substituted_with_actual_uuid; then +if 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 @@ -413,47 +390,61 @@ 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 - -# 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 +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 # 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 @@ -470,24 +461,6 @@ 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 @@ -567,7 +540,10 @@ rm -rf ${SOURCE} umount -f ${FS} || true rm -rf ${FS} -echo "tos orphan 7" >> /etc/ntp.conf +# 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 # 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_odlpluginbuild/Makefile b/fuel/build/f_isoroot/f_odlpluginbuild/Makefile deleted file mode 100644 index ce9cd73e1..000000000 --- a/fuel/build/f_isoroot/f_odlpluginbuild/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# mskalski@mirantis.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) -DOCKNAME = fuelrepo -DOCKVERSION = 1.0 -ODL_BRANCH="juno/lithium-sr1" -ODL_REPO="https://github.com/stackforge/fuel-plugin-opendaylight.git" - -.PHONY: all -all: .odlbuild - -.PHONY: clean -clean: - # Deliberately not cleaning nailgun directory to speed up multiple builds - @rm -f ../release/opnfv/opendaylight*.rpm - -.PHONY: release -release:.odlbuild - @rm -f ../release/opnfv/opendaylight*.rpm - @mkdir -p ../release/opnfv - @cp opendaylight*.rpm ../release/opnfv/ - -.odlbuild: - rm -rf fuel-plugin-opendaylight - sudo apt-get -y install build-essential ruby-dev rubygems-integration python-pip git rpm createrepo dpkg-dev - sudo gem install fpm - sudo pip install fuel-plugin-builder - git clone -b ${ODL_BRANCH} ${ODL_REPO} - INCLUDE_DEPENDENCIES=true fpb --debug --build fuel-plugin-opendaylight/ - mv fuel-plugin-opendaylight/opendaylight*.rpm . - rm -rf fuel-plugin-opendaylight diff --git a/fuel/build/f_isoroot/f_predeployment/Makefile b/fuel/build/f_isoroot/f_predeployment/Makefile new file mode 100644 index 000000000..a5252df96 --- /dev/null +++ b/fuel/build/f_isoroot/f_predeployment/Makefile @@ -0,0 +1,28 @@ +############################################################################## +# 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 new file mode 100644 index 000000000..3eef9f216 --- /dev/null +++ b/fuel/build/f_isoroot/f_predeployment/README @@ -0,0 +1,18 @@ +############################################################################## +# 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 new file mode 100755 index 000000000..c5c6c42c0 --- /dev/null +++ b/fuel/build/f_isoroot/f_predeployment/pre-deploy.sh @@ -0,0 +1,401 @@ +#!/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 new file mode 100755 index 000000000..e99cac039 --- /dev/null +++ b/fuel/build/f_isoroot/f_predeployment/sysinfo.sh @@ -0,0 +1,12 @@ +#!/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 new file mode 100755 index 000000000..14eec4cc6 --- /dev/null +++ b/fuel/build/f_isoroot/f_predeployment/transform_yaml.py @@ -0,0 +1,68 @@ +#!/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() diff --git a/fuel/build/f_isoroot/f_repobuild/Makefile b/fuel/build/f_isoroot/f_repobuild/Makefile deleted file mode 100644 index 6bfbd35c1..000000000 --- a/fuel/build/f_isoroot/f_repobuild/Makefile +++ /dev/null @@ -1,56 +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 -############################################################################## - -SHELL := /bin/bash -TOP := $(shell pwd) -DOCKNAME = fuelrepo -DOCKVERSION = 1.0 - -# try to choose close ubuntu mirror which support rsync protocol -# https://bugs.launchpad.net/fuel/+bug/1459252 -MIRROR_URLS := $(shell curl -s http://mirrors.ubuntu.com/mirrors.txt) -MIRROR_HOSTS := $(shell for url in ${MIRROR_URLS}; do echo $$url | cut -d'/' -f3; done) -RSYNC_HOST := $(shell for host in ${MIRROR_HOSTS}; do rsync -4 --contimeout 5 --no-motd --list-only "$${host}::ubuntu/." &> /dev/null && echo $$host && break; done) - -.PHONY: all -all: .nailgun - -.nailgun: - sudo apt-get update - sudo apt-get upgrade -y - sudo apt-get install -y rsync python python-yaml dpkg-dev openssl - rm -rf tmpiso tmpdir - mkdir tmpiso - fuseiso ${ISOCACHE} tmpiso - cp tmpiso/ubuntu/pool/main/f/fuel-createmirror/fuel-createmirror_6.1*.deb . - fusermount -u tmpiso - rm -rf tmpiso - sudo dpkg -i fuel-createmirror_6.1*.deb - sudo sed -i 's/DOCKER_MODE=true/DOCKER_MODE=false/' /etc/fuel-createmirror/common.cfg - sudo sed -i 's/DEBUG="no"/DEBUG="yes"/' /etc/fuel-createmirror/ubuntu.cfg - sudo sed -i 's/MIRROR_UBUNTU_HOST="archive.ubuntu.com"/MIRROR_UBUNTU_HOST="${RSYNC_HOST}"/' /etc/fuel-createmirror/common.cfg - rm -Rf nailgun - sudo mkdir -p /var/www - sudo su - -c /opt/fuel-createmirror-6.1/fuel-createmirror - sudo chmod -R 755 /var/www/nailgun - cp -Rp /var/www/nailgun . - touch .nailgun - -.PHONY: clean -clean: - # Deliberately not cleaning nailgun directory to speed up multiple builds - @rm -rf ../release/opnfv/nailgun fuel-createmirror_6.1*.deb - -.PHONY: release -release:.nailgun - @rm -Rf ../release/opnfv/nailgun - @mkdir -p ../release/opnfv - @cp -Rp nailgun ../release/opnfv/nailgun - |