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 | |
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')
89 files changed, 4363 insertions, 610 deletions
diff --git a/fuel/build/Makefile b/fuel/build/Makefile index ba4beaf39..5f631200b 100644 --- a/fuel/build/Makefile +++ b/fuel/build/Makefile @@ -15,7 +15,7 @@ SHELL = /bin/bash #Input args export UNIT_TEST = FALSE export INTERACTIVE = TRUE -export ISOSRC = file:$(shell pwd)/fuel-6.1.iso +export ISOSRC = file:$(shell pwd)/fuel-6.0.1.iso export ISOCACHE = $(shell pwd)/$(shell basename $(ISOSRC)) export PRODNO = "OPNFV_BGS" export REVSTATE = "P0000" @@ -37,6 +37,13 @@ export TOPDIR := $(shell pwd) #Build subclasses SUBDIRS := f_isoroot +SUBDIRS += f_opnfv_puppet +SUBDIRS += f_osnaily +SUBDIRS += f_l23network +SUBDIRS += f_resolvconf +SUBDIRS += f_ntp +SUBDIRS += f_odl_docker +#SUBDIRS += f_odl # f_example is only an example of how to generate a .deb package and # should not be enabled in official builds. @@ -56,6 +63,7 @@ all: @echo "Versions of cached build results built by" $(shell hostname) "at" $(shell date -u) > $(VERSION_FILE) @echo "cache.mk" $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") >> $(VERSION_FILE) @echo "config.mk" $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") >> $(VERSION_FILE) + $(MAKE) -C f_odl_docker -f Makefile all @make -C docker @docker/runcontext $(DOCKERIMG) $(MAKE) $(MAKEFLAGS) iso @@ -75,25 +83,16 @@ $(ISOCACHE): @echo "fuel" `git -C /tmp/fuel-main show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE) # Setup cgroups for docker-in-docker sudo /root/enable_dockerx2 - # Temporary patch to accomodate for new Ubuntu trusty devops keys not yet - # backported to fuel 6.0 or 6.1 - cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_3.patch - # Patch for adding dosfstools, as Fuel 6.1 is running mkfs.vfat - cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-main_5.patch + # Patch to fix race condition when doing "Docker-in-Docker" build + cd /tmp/fuel-main && patch -p1 < $(TOPDIR)/fuel-main_1.patch + # Patch to make the sandbox chroot in Fuel succeed with package + # installation in a Docker build + cd /tmp/fuel-main && patch -p1 < $(TOPDIR)/fuel-main_2.patch # Remove Docker optimizations, otherwise multistrap will fail during # Fuel build. sudo rm -f /etc/apt/apt.conf.d/docker* # cd /tmp/fuel-main && ./prepare-build-env.sh - cd /tmp/fuel-main && make repos - # Patch for speeding up image creation in virtual environments, - # https://review.openstack.org/#/c/197943/ - cd /tmp/fuel-main && patch -p0 < $(TOPDIR)/fuel-agent_1.patch - cd /tmp/fuel-main/build/repos/nailgun && git config --global user.email "build$opnfv.org" - cd /tmp/fuel-main/build/repos/nailgun && git config --global user.name "OPNFV build" - cd /tmp/fuel-main/build/repos/nailgun && git add -u . - cd /tmp/fuel-main/build/repos/nailgun && git commit -m "Added patch" - # cd /tmp/fuel-main && make iso mv /tmp/fuel-main/build/artifacts/fuel*.iso . @@ -117,6 +116,14 @@ $(SUBDIRS): patch-packages: ORIGISO=$(ISOCACHE) REVSTATE=$(REVSTATE) $(MAKE) -C $@ -f Makefile release +.PHONY: prepare +prepare: + #$(MAKE) -C opendaylight -f Makefile setup + +.PHONY: odl +odl: + #$(MAKE) -C opendaylight -f Makefile + .PHONY: build-clean $(SUBCLEAN) build-clean: $(SUBCLEAN) $(MAKE) -C patch-packages -f Makefile clean @@ -125,11 +132,13 @@ build-clean: $(SUBCLEAN) @rm -f $(NEWISO) .PHONY: clean $(SUBCLEAN) -clean: clean-cache $(SUBCLEAN) +clean: clean-cache prepare $(SUBCLEAN) $(MAKE) -C patch-packages -f Makefile clean + #$(MAKE) -C opendaylight -f Makefile clean @rm -f *.iso @rm -Rf release @rm -Rf newiso + @rm -f f_odl @rm -f $(NEWISO) @rm -f $(BUILD_BASE)/.versions @@ -139,12 +148,6 @@ $(SUBCLEAN): %.clean: # Todo: Make things smarter - we shouldn't need to clean everything # betwen make invocations. .PHONY: iso -iso: build-clean $(ISOCACHE) $(SUBDIRS) patch-packages +iso: prepare build-clean odl $(ISOCACHE) $(SUBDIRS) patch-packages install/install.sh iso $(ISOCACHE) $(NEWISO) $(PRODNO) $(REVSTATE) @printf "\n\nProduct ISO is $(NEWISO)\n\n" - -# Start a bash shell in docker for Makefile debugging -.PHONY: debug -debug: - @docker version >/dev/null 2>&1 || (echo 'No Docker installation available'; exit 1) - docker/runcontext $(DOCKERIMG) bash diff --git a/fuel/build/README b/fuel/build/README index a6e15694c..9692f3468 100644 --- a/fuel/build/README +++ b/fuel/build/README @@ -18,5 +18,6 @@ This purpose of this framework is to: - Apply patches to the baseline. - Etc. 3) Re factor/rebuild the .iso image for deployment (also builds in a container, for the same reason as mentioned above) +4) Through a pre-deployment script, setting config's not part of the pristine fuel build can be achieved For detailed instructions on how to add content, configuration, build and deply - please see: DOC/ diff --git a/fuel/build/cache.mk b/fuel/build/cache.mk index b88ac2fc4..cc98f6825 100644 --- a/fuel/build/cache.mk +++ b/fuel/build/cache.mk @@ -1,4 +1,4 @@ -############################################################################# +############################################################################## # Copyright (c) 2015 Ericsson AB and others. # stefan.k.berg@ericsson.com # jonas.bjurel@ericsson.com @@ -15,8 +15,10 @@ CACHECLEAN := $(addsuffix .clean,$(CACHEFILES) $(CACHEDIRS)) ############################################################################ # BEGIN of variables to customize # -#CACHEDIRS := foo/bar +#CACHEDIRS := opendaylight/f_odl/package +#CACHEFILES := opendaylight/.odl-build-history +#CACHEFILES += opendaylight/.odl-build.log CACHEFILES += .versions CACHEFILES += $(shell basename $(ISOSRC)) # @@ -52,20 +54,20 @@ $(CACHEFILES): @if [ ! -f $(BUILD_BASE)/$@ ]; then\ echo " " > $(BUILD_BASE)/$@;\ - ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\ + ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\ rm -f $(BUILD_BASE)/$@;\ else\ ln -s $(BUILD_BASE)/$@ $(CACHE_DIR)/$@;\ fi .PHONY: validate-cache -validate-cache: $(CACHEVALIDATE) - @if [ "$(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ")" != "$(shell cat $(VERSION_FILE) | grep config.mk | awk '{print $$NF}')" ]; then\ +validate-cache: prepare $(CACHEVALIDATE) + @if [[ $(shell md5sum $(BUILD_BASE)/config.mk | cut -f1 -d " ") != $(shell cat $(VERSION_FILE) | grep config.mk | awk '{print $$NF}') ]]; then\ echo "Cache does not match current config.mk definition, cache must be rebuilt";\ exit 1;\ fi; - @if [ "$(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ")" != "$(shell cat $(VERSION_FILE) | grep cache.mk | awk '{print $$NF}')" ]; then\ + @if [[ $(shell md5sum $(BUILD_BASE)/cache.mk | cut -f1 -d " ") != $(shell cat $(VERSION_FILE) | grep cache.mk | awk '{print $$NF}') ]]; then\ echo "Cache does not match current cache.mk definition, cache must be rebuilt";\ exit 1;\ fi; @@ -78,12 +80,14 @@ validate-cache: $(CACHEVALIDATE) then \ REMOTE_ID=$(shell git ls-remote $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG) | awk '{print $$(NF-1)}'); \ fi; \ - if [[ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep fuel | awk '{print $$NF}') ]]; \ + if [ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep fuel | awk '{print $$NF}') ]; \ then \ echo "Cache does not match upstream Fuel, cache must be rebuilt!"; \ exit 1; \ fi + #$(MAKE) -C opendaylight validate-cache + .PHONY: $(CACHEVALIDATE) $(CACHEVALIDATE): %.validate: @echo VALIDATE $(CACHEVALIDATE) diff --git a/fuel/build/config.mk b/fuel/build/config.mk index e9a5320f4..19f502d03 100644 --- a/fuel/build/config.mk +++ b/fuel/build/config.mk @@ -8,12 +8,19 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## +ODL_MAIN_REPO := https://git.opendaylight.org/gerrit/p/controller.git +ODL_MAIN_TAG := release/helium + FUEL_MAIN_REPO := https://github.com/stackforge/fuel-main -FUEL_MAIN_TAG = stable/6.1 +FUEL_MAIN_TAG = stable/6.0 DOCKER_REPO := http://get.docker.com/builds/Linux/x86_64 DOCKER_TAG := docker-latest +.PHONY: get-odl-repo +get-odl-repo: + @echo $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) + .PHONY: get-fuel-repo get-fuel-repo: @echo $(FUEL_MAIN_REPO) $(FUEL_MAIN_TAG) diff --git a/fuel/build/docker/ubuntu-builder/Dockerfile b/fuel/build/docker/ubuntu-builder/Dockerfile index 81cdc43fb..b4e1b4e24 100644 --- a/fuel/build/docker/ubuntu-builder/Dockerfile +++ b/fuel/build/docker/ubuntu-builder/Dockerfile @@ -14,7 +14,7 @@ RUN apt-get update RUN apt-get install -y software-properties-common python-software-properties \ make python-setuptools python-all dpkg-dev debhelper \ fuseiso git genisoimage bind9-host wget curl lintian tmux lxc iptables \ - ca-certificates sudo apt-utils lsb-release dosfstools + ca-certificates sudo apt-utils lsb-release RUN echo "ALL ALL=NOPASSWD: ALL" > /etc/sudoers.d/open-sudo RUN chmod 0440 /etc/sudoers.d/open-sudo @@ -24,5 +24,8 @@ ADD ./setcontext /root/setcontext RUN chmod +x /root/setcontext ADD ./enable_dockerx2 /root/enable_dockerx2 RUN chmod +x /root/enable_dockerx2 +ADD ./install.sh /root/install.sh +RUN chmod +x /root/install.sh +RUN /root/install.sh VOLUME /var/lib/docker diff --git a/fuel/build/docker/ubuntu-builder/install.sh b/fuel/build/docker/ubuntu-builder/install.sh new file mode 100755 index 000000000..df1af72f1 --- /dev/null +++ b/fuel/build/docker/ubuntu-builder/install.sh @@ -0,0 +1,25 @@ +#!/bin/bash +############################################################################## +# 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 +############################################################################## + +#Install Oracle Java 7 jdk +echo "Installing JAVA 7" +apt-get update +add-apt-repository ppa:webupd8team/java -y +apt-get update +echo debconf shared/accepted-oracle-license-v1-1 select true | debconf-set-selections +apt-get install oracle-java7-installer -y + +#Install Maven 3 +echo deb http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main >> /etc/apt/sources.list +echo deb-src http://ppa.launchpad.net/natecarlson/maven3/ubuntu precise main >> /etc/apt/sources.list +apt-get update || exit 1 +sudo apt-get install -y --force-yes maven3 || exit 1 +ln -s /usr/share/maven3/bin/mvn /usr/bin/mvn 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 - diff --git a/fuel/build/f_l23network/Makefile b/fuel/build/f_l23network/Makefile new file mode 100644 index 000000000..0949737bc --- /dev/null +++ b/fuel/build/f_l23network/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: + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_l23network/README b/fuel/build/f_l23network/README new file mode 100644 index 000000000..9aa4718a2 --- /dev/null +++ b/fuel/build/f_l23network/README @@ -0,0 +1,35 @@ +############################################################################## +# 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 +############################################################################## + +Addition to add entries to /etc/hosts through Astute. + +The astute.yaml file should contain entries as those below to have them picked up during deployment: + +opnfv: + hosts: + - name: test1 + address: 192.168.100.100 + fqdn: test1.opnfv.org + - name: test2 + address: 192.168.100.101 + fqdn: test2.opnfv.org + - name: test3 + address: 192.168.100.102 + fqdn: test3.opnfv.org + +The suggested method for adding this information is to prepare for deployment with the Fuel GUI or CLI, +but before actually deploying: + +1. Download the current deployment for all hosts: fuel --env 1 deployment --default +2. Iterate through the hosts in "deployment_1" and add hosts configuration in the above format to their + respective yaml file. +3. Upload the modifed deployment information: fuel --env 1 deployment --upload + +After deploying, the additions will be included in /etc/astute.yaml of each host. diff --git a/fuel/build/f_l23network/puppet/modules/l23network/lib/puppet/parser/functions/extras_to_hosts.rb b/fuel/build/f_l23network/puppet/modules/l23network/lib/puppet/parser/functions/extras_to_hosts.rb new file mode 100644 index 000000000..33bfad8fd --- /dev/null +++ b/fuel/build/f_l23network/puppet/modules/l23network/lib/puppet/parser/functions/extras_to_hosts.rb @@ -0,0 +1,21 @@ +# +# array_or_string_to_array.rb +# + +module Puppet::Parser::Functions + newfunction(:extras_to_hosts, :type => :rvalue, :doc => <<-EOS + convert extras array passed from Astute into + hash for puppet `host` create_resources call + EOS + ) do |args| + hosts=Hash.new + extras=args[0] + extras.each do |extras| + hosts[extras['name']]={:ip=>extras['address'],:host_aliases=>[extras['fqdn']]} + notice("Generating extras host entry #{extras['name']} #{extras['address']} #{extras['fqdn']}") + end + return hosts + end +end + +# vim: set ts=2 sw=2 et : diff --git a/fuel/build/f_l23network/puppet/modules/l23network/manifests/hosts_file.pp b/fuel/build/f_l23network/puppet/modules/l23network/manifests/hosts_file.pp new file mode 100644 index 000000000..05cff8d60 --- /dev/null +++ b/fuel/build/f_l23network/puppet/modules/l23network/manifests/hosts_file.pp @@ -0,0 +1,18 @@ +class l23network::hosts_file ( + $nodes, + $extras=[], + $hosts_file = "/etc/hosts" +) { + + # OPNFV addition: Add additional lines in /etc/hosts through Astute additions + + $host_resources = nodes_to_hosts($nodes) + $extras_host_resources = extras_to_hosts($extras) + Host { + ensure => present, + target => $hosts_file + } + + create_resources(host, $host_resources) + create_resources(host, $extras_host_resources) +} diff --git a/fuel/build/f_l23network/puppet/modules/l23network/manifests/hosts_file.pp.orig b/fuel/build/f_l23network/puppet/modules/l23network/manifests/hosts_file.pp.orig new file mode 100644 index 000000000..2295e3f9a --- /dev/null +++ b/fuel/build/f_l23network/puppet/modules/l23network/manifests/hosts_file.pp.orig @@ -0,0 +1,16 @@ +class l23network::hosts_file ( + $nodes, + $hosts_file = "/etc/hosts" +) { + + #Move original hosts file + + $host_resources = nodes_to_hosts($nodes) + + Host { + ensure => present, + target => $hosts_file + } + + create_resources(host, $host_resources) +} diff --git a/fuel/build/f_l23network/testing/README b/fuel/build/f_l23network/testing/README new file mode 100644 index 000000000..b68eddf22 --- /dev/null +++ b/fuel/build/f_l23network/testing/README @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## + +In order to test the functionality without performing a full deployment, run "puppet apply" on the fake_init.pp +which will call only the l23network::hosts_file class. diff --git a/fuel/build/f_l23network/testing/fake_init.pp b/fuel/build/f_l23network/testing/fake_init.pp new file mode 100644 index 000000000..bc6b163f9 --- /dev/null +++ b/fuel/build/f_l23network/testing/fake_init.pp @@ -0,0 +1,13 @@ +$fuel_settings = parseyaml($astute_settings_yaml) + +if $::fuel_settings['nodes'] { + $nodes_hash = $::fuel_settings['nodes'] + $extras_hash = $::fuel_settings['opnfv']['hosts'] + + class {'l23network::hosts_file': + nodes => $nodes_hash, + extras => $extras_hash + } + + include l23network::hosts_file +} diff --git a/fuel/build/f_ntp/Makefile b/fuel/build/f_ntp/Makefile new file mode 100644 index 000000000..0949737bc --- /dev/null +++ b/fuel/build/f_ntp/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: + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_ntp/README b/fuel/build/f_ntp/README new file mode 100644 index 000000000..2bade72d6 --- /dev/null +++ b/fuel/build/f_ntp/README @@ -0,0 +1,33 @@ +############################################################################## +# 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 +############################################################################## + +Addition to add ntp.conf separately for compute hosts and controller hosts through Astute. + +The astute.yaml file should contain entries as those below to have them picked up during deployment: + +opnfv: + ntp: + controller: | + line 1 + line 2 + compute: | + line 1 + line 2 + +The suggested method for adding this information is to prepare for deployment with the Fuel GUI or CLI, +but before actually deploying: + +1. Download the current deployment for all hosts: fuel --env 1 deployment --default +2. Iterate through the hosts in "deployment_1" and add hosts configuration in the above format to their + respective yaml file. +3. Upload the modifed deployment information: fuel --env 1 deployment --upload + +After deploying, the additions will be included in /etc/astute.yaml of each host. + diff --git a/fuel/build/f_ntp/puppet/modules/opnfv/manifests/ntp.pp b/fuel/build/f_ntp/puppet/modules/opnfv/manifests/ntp.pp new file mode 100644 index 000000000..c5dce1be0 --- /dev/null +++ b/fuel/build/f_ntp/puppet/modules/opnfv/manifests/ntp.pp @@ -0,0 +1,80 @@ +############################################################################## +# 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 +############################################################################## + +# Class: Ntp +# +# Add Ntp content passed through astute.yaml into ntp.conf depending on the role +# +# Suitable yaml content: +# <begin> +# opnfv: +# ntp: +# controller: | +# line 1 +# line 2 +# compute: | +# line 1 +# line 2 +# <end> +# +# +# + +class opnfv::ntp( + $file='/etc/ntp.conf' +) { + + case $::operatingsystem { + centos, redhat: { + $service_name = 'ntpd' + } + debian, ubuntu: { + $service_name = 'ntp' + } + } + + if $::fuel_settings['role'] { + if ($::fuel_settings['opnfv'] and + $::fuel_settings['opnfv']['ntp']) { + case $::fuel_settings['role'] { + /controller/: { + if $::fuel_settings['opnfv']['ntp']['controller'] { + $template = 'opnfv/ntp.conf.controller.erb' + $file_content = $::fuel_settings['opnfv']['ntp']['controller'] + } + } + /compute/: { + if $::fuel_settings['opnfv']['ntp']['compute'] { + $template = 'opnfv/ntp.conf.compute.erb' + $file_content = $::fuel_settings['opnfv']['ntp']['compute'] + } + } + } + } + } + + if $file_content { + package { 'ntp': + ensure => installed, + } + + file { $file: + content => template($template), + notify => Service['ntp'], + } + + service { 'ntp': + ensure => running, + name => $service_name, + enable => true, + require => [ Package['ntp'], File[$file]] + } + } +} diff --git a/fuel/build/f_ntp/puppet/modules/opnfv/templates/ntp.conf.compute.erb b/fuel/build/f_ntp/puppet/modules/opnfv/templates/ntp.conf.compute.erb new file mode 100644 index 000000000..37ecfd72d --- /dev/null +++ b/fuel/build/f_ntp/puppet/modules/opnfv/templates/ntp.conf.compute.erb @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## + +tinker panic 0 +driftfile /var/lib/ntp/ntp.drift +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery +restrict 127.0.0.1 +restrict ::1 +<%= @file_content %> diff --git a/fuel/build/f_ntp/puppet/modules/opnfv/templates/ntp.conf.controller.erb b/fuel/build/f_ntp/puppet/modules/opnfv/templates/ntp.conf.controller.erb new file mode 100644 index 000000000..37ecfd72d --- /dev/null +++ b/fuel/build/f_ntp/puppet/modules/opnfv/templates/ntp.conf.controller.erb @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## + +tinker panic 0 +driftfile /var/lib/ntp/ntp.drift +statistics loopstats peerstats clockstats +filegen loopstats file loopstats type day enable +filegen peerstats file peerstats type day enable +filegen clockstats file clockstats type day enable +restrict -4 default kod notrap nomodify nopeer noquery +restrict -6 default kod notrap nomodify nopeer noquery +restrict 127.0.0.1 +restrict ::1 +<%= @file_content %> diff --git a/fuel/build/f_ntp/testing/README b/fuel/build/f_ntp/testing/README new file mode 100644 index 000000000..6d80b0a94 --- /dev/null +++ b/fuel/build/f_ntp/testing/README @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## + +In order to test the functionality without performing a full deployment, run "puppet apply" on the +fake_init.pp which will call only the opnfv::ntp class. diff --git a/fuel/build/f_ntp/testing/fake_init.pp b/fuel/build/f_ntp/testing/fake_init.pp new file mode 100644 index 000000000..b9af21836 --- /dev/null +++ b/fuel/build/f_ntp/testing/fake_init.pp @@ -0,0 +1,13 @@ +############################################################################## +# 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 +############################################################################## + +$fuel_settings = parseyaml($astute_settings_yaml) + +include opnfv::ntp diff --git a/fuel/build/f_odl_docker/Makefile b/fuel/build/f_odl_docker/Makefile new file mode 100755 index 000000000..6135e71e5 --- /dev/null +++ b/fuel/build/f_odl_docker/Makefile @@ -0,0 +1,51 @@ +############################################################################## +# 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) +BUILDTAG := loving_daniel + +# Edit this to match the GENESIS / OPNFV in your environment +export OPNFV_PUPPET := $(BUILD_BASE)/../../common/puppet-opnfv +include ../config.mk + +.PHONY: all +all: + @mkdir -p puppet/modules/opnfv/odl_docker + @rm -rf tmp + @mkdir -p tmp + @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/dockerfile tmp/. + @docker build -t ${BUILDTAG} tmp/dockerfile/. + @docker save ${BUILDTAG} > puppet/modules/opnfv/odl_docker/odl_docker_image.tar + @wget ${DOCKER_REPO}/${DOCKER_TAG} -O puppet/modules/opnfv/odl_docker/docker-latest + @echo "OPFNV_PUPPET is: ${OPNFV_PUPPET}" + @cp -Rvp ${OPNFV_PUPPET}/manifests/templates/dockerfile/container_scripts puppet/modules/opnfv + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: build-clean +build-clean: + @rm -rf tmp + @rm -rf release + @rm -rf puppet/modules/opnfv/odl_docker/odl_docker_image.tar + @rm -rf puppet/modules/opnfv/odl_docker/docker-latest + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + # Fetch PP from OPNFV Common + @cp -Rvp ${OPNFV_PUPPET}/manifests/odl_docker.pp ${PUPPET_DEST} + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_odl_docker/dockerfile/Dockerfile b/fuel/build/f_odl_docker/dockerfile/Dockerfile new file mode 100755 index 000000000..e3c7ee5fe --- /dev/null +++ b/fuel/build/f_odl_docker/dockerfile/Dockerfile @@ -0,0 +1,72 @@ +#################################################################### +# +# Dockerfile to build a ODL (Karaf) Docker Container +# +# Copyright daniel.smith@ericsson.com +# License: Apache GPL +# +#################################################################### + + +#Set the base image - note: the current release of Karaf is using Jdk7 and alot of 12.04, so we will use it rather than 14.04 and backport a ton of stuff +FROM ubuntu:12.04 + +# Maintainer Info +MAINTAINER Daniel Smith + +#Run apt-get update one start just to check for updates when building +RUN echo "Updating APT" +RUN apt-get update +RUN echo "Adding wget" +RUN apt-get install -y wget +RUN apt-get install -y net-tools +RUN apt-get install -y openjdk-7-jre +RUN apt-get install -y openjdk-7-jdk +RUN apt-get install -y openssh-server +RUN apt-get install -y vim +RUN apt-get install -y expect +RUN apt-get install -y daemontools +RUN mkdir -p /opt/odl_source +RUN bash -c 'echo "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64" >> ~/.bashrc' + + +#Now lets got and fetch the ODL distribution +RUN echo "Fetching ODL" +RUN wget https://nexus.opendaylight.org/content/groups/public/org/opendaylight/integration/distribution-karaf/0.2.3-Helium-SR3/distribution-karaf-0.2.3-Helium-SR3.tar.gz -O /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz + +RUN echo "Untarring ODL inplace" +RUN mkdir -p /opt/odl +RUN tar zxvf /opt/odl_source/distribution-karaf-0.2.3-Helium-SR3.tar.gz -C /opt/odl + +RUN echo "Installing DLUX and other features into ODL" +COPY tmp/dockerfile/container_scripts/start_odl_docker.sh /etc/init.d/start_odl_docker.sh +COPY tmp/dockerfile/container_scripts/speak.sh /etc/init.d/speak.sh +RUN chmod 777 /etc/init.d/start_odl_docker.sh +RUN chmod 777 /etc/init.d/speak.sh + + +# Expose the ports +# PORTS FOR BASE SYSTEM AND DLUX +EXPOSE 8101 +EXPOSE 6633 +EXPOSE 1099 +EXPOSE 43506 +EXPOSE 8181 +EXPOSE 8185 +EXPOSE 9000 +EXPOSE 39378 +EXPOSE 33714 +EXPOSE 44444 +EXPOSE 6653 + +# PORTS FOR OVSDB AND ODL CONTROL +EXPOSE 12001 +EXPOSE 6640 +EXPOSE 8080 +EXPOSE 7800 +EXPOSE 55130 +EXPOSE 52150 +EXPOSE 36826 + +# set the ENTRYPOINT - An entry point allows us to run this container as an exectuable +CMD ["/etc/init.d/start_odl_docker.sh"] diff --git a/fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh b/fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh new file mode 100755 index 000000000..3e5d0b2bb --- /dev/null +++ b/fuel/build/f_odl_docker/dockerfile/container_scripts/check_feature.sh @@ -0,0 +1,8 @@ +#!/usr/bin/expect +spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client +expect "root>" +send "feature:list | grep -i odl-restconf\r" +send "\r\r\r" +expect "root>" +send "logout\r" + diff --git a/fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh b/fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh new file mode 100755 index 000000000..3ba07a844 --- /dev/null +++ b/fuel/build/f_odl_docker/dockerfile/container_scripts/speak.sh @@ -0,0 +1,17 @@ +#!/usr/bin/expect +# Ericsson Research Canada +# +# Author: Daniel Smith <daniel.smith@ericsson.com> +# +# Simple expect script to start up ODL client and load feature set for DLUX and OVSDB +# +# NOTE: THIS WILL BE REPLACED WITH A PROGRAMATIC METHOD SHORTLY +# DEPRECATED AFTER ARNO + +spawn /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/client +expect "root>" +send "feature:install odl-base-all odl-aaa-authn odl-restconf odl-nsf-all odl-adsal-northbound odl-mdsal-apidocs odl-ovsdb-openstack odl-ovsdb-northbound odl-dlux-core" +send "\r\r\r" +expect "root>" +send "logout\r" + diff --git a/fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh b/fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh new file mode 100755 index 000000000..1c72dda52 --- /dev/null +++ b/fuel/build/f_odl_docker/dockerfile/container_scripts/start_odl_docker.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Ericsson Research Canada +# +# Author: Daniel Smith <daniel.smith@ericsson.com> +# +# Start up script for calling karaf / ODL inside a docker container. +# +# This script will also call a couple expect scripts to load the feature set that we want + + +#ENV +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 + +#MAIN +echo "Starting up the da Sheilds..." +/opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/karaf server & +echo "Sleeping 5 bad hack" +sleep 10 +echo "should see stuff listening now" +netstat -na +echo " should see proess running for karaf" +ps -efa +echo " Starting the packages we want" +/etc/init.d/speak.sh +echo "Printout the status - if its right, you should see 8181 appear now" +netstat -na +ps -efa + + + +## This is a loop that keeps our container going currently, prinout the "status of karaf" to the docker logs every minute +## Cheap - but effective +while true; +do + echo "Checking status of ODL:" + /opt/odl/distribution-karaf-0.2.3-Helium-SR3/bin/status + sleep 60 +done diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp new file mode 100644 index 000000000..c286127a4 --- /dev/null +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/manifests/odl_docker.pp @@ -0,0 +1,77 @@ +class opnfv::odl_docker +{ + case $::fuel_settings['role'] { + /controller/: { + + file { '/opt': + ensure => 'directory', + } + + file { '/opt/opnfv': + ensure => 'directory', + owner => 'root', + group => 'root', + mode => 777, + } + + file { '/opt/opnfv/odl': + ensure => 'directory', + } + + file { '/opt/opnfv/odl/odl_docker_image.tar': + ensure => present, + source => '/etc/puppet/modules/opnfv/odl_docker/odl_docker_image.tar', + mode => 750, + } + + file { '/opt/opnfv/odl/docker-latest': + ensure => present, + source => '/etc/puppet/modules/opnfv/odl_docker/docker-latest', + mode => 750, + } + + file { '/opt/opnfv/odl/start_odl_conatiner.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/start_odl_container.sh', + mode => 750, + } + file { '/opt/opnfv/odl/stage_odl.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/stage_odl.sh', + mode => 750, + } + file { '/opt/opnfv/odl/config_net_odl.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/config_net_odl.sh', + mode => 750, + } + file { '/opt/opnfv/odl/change.sh': + ensure => present, + source => '/etc/puppet/modules/opnfv/scripts/change.sh', + mode => 750, + } + + + # fix failed to find the cgroup root issue + # https://github.com/docker/docker/issues/8791 + case $::operatingsystem { + 'ubuntu': { + package {'cgroup-lite': + ensure => present, + } + + service {'cgroup-lite': + ensure => running, + enable => true, + require => Package['cgroup-lite'], + } + } + 'centos': { + package {'docker-io': + ensure => latest, + } + } + } + } + } +} diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh new file mode 100644 index 000000000..f7f3d6e78 --- /dev/null +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/change.sh @@ -0,0 +1,219 @@ +#!/bin/bash +# script to remove bridges and reset networking for ODL + + +#VARS +MODE=0 +DNS=8.8.8.8 + +#ENV +source ~/openrc + +# GET IPS for that node +function get_ips { + BR_MGMT=`grep address /etc/network/ifcfg_backup/ifcfg-br-mgmt | awk -F" " '{print $2}'` + BR_STORAGE=`grep address /etc/network/ifcfg_backup/ifcfg-br-storage | awk -F" " '{print $2}'` + BR_FW_ADMIN=`grep address /etc/network/ifcfg_backup/ifcfg-br-fw-admin | awk -F" " '{print $2}'` + BR_EX=`grep address /etc/network/ifcfg_backup/ifcfg-br-ex | awk -F" " '{print $2}'` + DEF_NETMASK=255.255.255.0 + DEF_GW=172.30.9.1 +} + +function backup_ifcfg { + echo " backing up " + mkdir -p /etc/network/ifcfg_backup + mv /etc/network/interfaces.d/ifcfg-br-ex /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-fw-admin /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-mgmt /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-storage /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-br-prv /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-eth0 /etc/network/ifcfg_backup/. + mv /etc/network/interfaces.d/ifcfg-eth1 /etc/network/ifcfg_backup/. + rm -rf /etc/network/interfaces.d/ifcfg-eth1.300 + rm -rf /etc/network/interfaces.d/ifcfg-eth1.301 + rm -rf /etc/network/interfaces.d/ifcfg-eth1 + rm -rf /etc/network/interfaces.d/ifcfg-eth0 + +} + + +function create_ifcfg_br_mgmt { + echo "migrating br_mgmt" + echo "auto eth1.300" >> /etc/network/interfaces.d/ifcfg-eth1.300 + echo "iface eth1.300 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.300 + echo " address $BR_MGMT" >> /etc/network/interfaces.d/ifcfg-eth1.300 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.300 +} + +function create_ifcfg_br_storage { + echo "migration br_storage" + echo "auto eth1.301" >> /etc/network/interfaces.d/ifcfg-eth1.301 + echo "iface eth1.301 inet static" >> /etc/network/interfaces.d/ifcfg-eth1.301 + echo " address $BR_STORAGE" >> /etc/network/interfaces.d/ifcfg-eth1.301 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1.301 +} + +function create_ifcfg_br_fw_admin { + echo " migratinng br_fw_admin" + echo "auto eth1" >> /etc/network/interfaces.d/ifcfg-eth1 + echo "iface eth1 inet static" >> /etc/network/interfaces.d/ifcfg-eth1 + echo " address $BR_FW_ADMIN" >> /etc/network/interfaces.d/ifcfg-eth1 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth1 +} + +function create_ifcfg_eth0 { + echo "migratinng br-ex to eth0 - temporarily" + echo "auto eth0" >> /etc/network/interfaces.d/ifcfg-eth0 + echo "iface eth0 inet static" >> /etc/network/interfaces.d/ifcfg-eth0 + echo " address $BR_EX" >> /etc/network/interfaces.d/ifcfg-eth0 + echo " netmask $DEF_NETMASK" >> /etc/network/interfaces.d/ifcfg-eth0 + echo " gateway $DEF_GW" >> /etc/network/interfaces.d/ifcfg-eth0 +} + +function set_mode { + if [ -d "/var/lib/glance/images" ] + then + echo " controller " + MODE=0 + else + echo " compute " + MODE=1 + fi +} + + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function start_ovs { + echo "Starting OVS" + service openvswitch-switch start + ovs-vsctl show +} + + +function clean_ovs { + echo "cleaning OVS DB" + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + echo "restarting OVS - you should see Nothing there" + start_ovs +} + + + +function reboot_me { + reboot +} + +function allow_challenge { + sed -i -e 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config + service ssh restart +} + +function clean_neutron { + subnets=( `neutron subnet-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + networks=( `neutron net-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + ports=( `neutron port-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + routers=( `neutron router-list | awk -F" " '{print $2}' | grep -v id | sed '/^$/d'` ) + + #display all elements + echo "SUBNETS: ${subnets[@]} " + echo "NETWORKS: ${networks[@]} " + echo "PORTS: ${ports[@]} " + echo "ROUTERS: ${routers[@]} " + + + # get port and subnet for each router + for i in "${routers[@]}" + do + routerport=( `neutron router-port-list $i | awk -F" " '{print $2}' | grep -v id | sed '/^$/d' `) + routersnet=( `neutron router-port-list $i | awk -F" " '{print $8}' | grep -v fixed | sed '/^$/d' | sed 's/,$//' | sed -e 's/^"//' -e 's/"$//' `) + done + + echo "ROUTER PORTS: ${routerport[@]} " + echo "ROUTER SUBNET: ${routersnet[@]} " + + #remove router subnets + echo "router-interface-delete" + for i in "${routersnet[@]}" + do + neutron router-interface-delete ${routers[0]} $i + done + + #remove subnets + echo "subnet-delete" + for i in "${subnets[@]}" + do + neutron subnet-delete $i + done + + #remove nets + echo "net-delete" + for i in "${networks[@]}" + do + neutron net-delete $i + done + + #remove routers + echo "router-delete" + for i in "${routers[@]}" + do + neutron router-delete $i + done + + #remove ports + echo "port-delete" + for i in "${ports[@]}" + do + neutron port-delete $i + done + + #remove subnets + echo "subnet-delete second pass" + for i in "${subnets[@]}" + do + neutron subnet-delete $i + done + +} + +function set_dns { + sed -i -e 's/nameserver 10.20.0.2/nameserver $DNS/g' /etc/resolv.conf +} + + +#OUTPUT + +function check { + echo $BR_MGMT + echo $BR_STORAGE + echo $BR_FW_ADMIN + echo $BR_EX +} + +### MAIN + + +set_mode +backup_ifcfg +get_ips +create_ifcfg_br_mgmt +create_ifcfg_br_storage +create_ifcfg_br_fw_admin +if [ $MODE == "0" ] +then + create_ifcfg_eth0 +fi +allow_challenge +clean_ovs +check +reboot_me + + diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh new file mode 100755 index 000000000..145da806b --- /dev/null +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/config_net_odl.sh @@ -0,0 +1,192 @@ +#!/bin/bash +# +# Author: Daniel Smith (Ericsson) +# +# Script to update neutron configuration for OVSDB/ODL integratino +# +# Usage - Set / pass CONTROL_HOST to your needs +# +### SET THIS VALUE TO MATCH YOUR SYSTEM +CONTROL_HOST=192.168.0.2 +BR_EX_IP=172.30.9.70 + +# ENV +source ~/openrc +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUNCTIONS +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF + sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + sed -i -e 's/bridge_mappings=physnet2:br-prv/bridge_mappings=physnet1:br-ex/g' $ML2_CONF + echo "[ml2_odl]" >> $ML2_CONF + echo "password = admin" >> $ML2_CONF + echo "username = admin" >> $ML2_CONF + echo "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF +} + +function reset_neutrondb { + echo "Reseting DB" + mysql -e "drop database if exists neutron_ml2;" + mysql -e "create database neutron_ml2 character set utf8;" + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head +} + +function restart_neutron { + echo "Restarting Neutron Server" + service neutron-server restart + echo "Should see Neutron runing now" + service neutron-server status + echo "Shouldnt be any nets, but should work (return empty)" + neutron net-list +} + +function stop_neutron { + echo "Stopping Neutron / OVS components" + service neutron-plugin-openvswitch-agent stop + if [ $MODE == "0" ] + then + service neutron-server stop + fi +} + +function disable_agent { + echo "Disabling Neutron Plugin Agents from running" + service neutron-plugin-openvswitch-agent stop + echo 'manual' > /etc/init/neutron-plugin-openvswitch-agent.override +} + + + +function verify_ML2_working { + echo "checking that we can talk via ML2 properly" + curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 + if grep "network" /tmp/check_ml2 + then + echo "Success - ML2 to ODL is working" + else + echo "im sorry Jim, but its dead" + fi + +} + + +function set_mode { + if [ -d "/var/lib/glance/images" ] + then + echo "Controller Mode" + MODE=0 + else + echo "Compute Mode" + MODE=1 + fi +} + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function start_ovs { + echo "Starting OVS" + service openvswitch-vswitch start + ovs-vsctl show +} + + +function control_setup { + echo "Modifying Controller" + stop_neutron + stop_ovs + disable_agent + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. + mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + rm -rf /etc/openvswitch/.conf* + service openvswitch-switch start + ovs-vsctl add-br br-ex + ovs-vsctl add-port br-ex eth0 + ovs-vsctl set interface br-ex type=external + ifconfig br-ex 172.30.9.70/24 up + service neutron-server restart + + echo "setting up networks" + ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp + ip link add link eth1 name br-storage type vlan id 301 + ip link add link eth1 name br-prv type vlan id 1000 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp + + echo "Setting ODL Manager IP" + ovs-vsctl set-manager tcp:192.168.0.2:6640 + + echo "Verifying ODL ML2 plugin is working" + verify_ML2_working + + # BAD HACK - Should be parameterized - this is to catch up + route add default gw 172.30.9.1 + +} + +function clean_ovs { + echo "cleaning OVS DB" + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + cp -pr /etc/openvswitch/* /opt/opnfv/odl/ovs_back/. + rm -rf /etc/openvswitch/conf.db + echo "restarting OVS - you should see Nothing there" + start_ovs +} + +function compute_setup { + echo "Modifying Compute" + echo "Disabling neutron openvswitch plugin" + stop_neutron + disable_agent + ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 up arp + ip link add link eth1 name br-storage type vlan id 301 + ip link add link eth1 name br-prv type vlan id 1000 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 up arp + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-admin | awk -F" " '{print $2}'`/24 up arp + + echo "set manager, and route for ODL controller" + ovs-vsctl set-manager tcp:192.168.0.2:6640 + route add 172.17.0.1 gw 192.168.0.2 + verify_ML2_working +} + + +# MAIN +echo "Starting to make call" +update_ml2conf +echo "Check Mode" +set_mode + +if [ $MODE == "0" ]; +then + echo "Calling control setup" + control_setup +elif [ $MODE == "1" ]; +then + echo "Calling compute setup" + compute_setup + +else + echo "Something is bad - call for help" + exit +fi + + diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh new file mode 100755 index 000000000..fa14b47d4 --- /dev/null +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/stage_odl.sh @@ -0,0 +1,54 @@ +#!/bin/bash +# Author: Daniel Smith (Ericsson) +# Stages ODL Controlleer +# Inputs: odl_docker_image.tar +# Usage: ./stage_odl.sh + +# ENVS +source ~/.bashrc +source ~/openrc + +LOCALPATH=/opt/opnfv/odl +DOCKERBIN=docker-latest +ODLIMGNAME=odl_docker_image.tar +DNS=8.8.8.8 +HOST_IP=`ifconfig br-ex | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` + + + +# DEBUG ECHOS +echo $LOCALPATH +echo $DOCKERBIN +echo $ODLIMGNAME +echo $DNS +echo $HOST_IP + + +# Set DNS to someting external and default GW - ODL requires a connection to the internet +sed -i -e 's/nameserver 10.20.0.2/nameserver 8.8.8.8/g' /etc/resolv.conf +route delete default gw 10.20.0.2 +route add default gw 172.30.9.1 + +# Start Docker daemon and in background +echo "Starting Docker" +chmod +x $LOCALPATH/$DOCKERBIN +$LOCALPATH/$DOCKERBIN -d & +#courtesy sleep for virtual env +sleep 2 + +# Import the ODL Container +echo "Importing ODL Container" +$LOCALPATH/$DOCKERBIN load -i $LOCALPATH/$ODLIMGNAME + +# Start ODL, load DLUX and OVSDB modules +echo "Removing any old install found - file not found is ok here" +$LOCALPATH/$DOCKERBIN rm odl_docker +echo "Starting up ODL controller in Daemon mode - no shell possible" +$LOCALPATH/$DOCKERBIN run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel + +# Following, you should see the docker ps listed and a port opened +echo " you should reach ODL controller at http://HOST_IP:8181/dlux/index.html" +$LOCALPATH/$DOCKERBINNAME ps -a +netstat -lnt + + diff --git a/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh new file mode 100755 index 000000000..347ac7488 --- /dev/null +++ b/fuel/build/f_odl_docker/puppet/modules/opnfv/scripts/start_odl_container.sh @@ -0,0 +1,95 @@ +#!/bin/bash +# Ericsson Canada Inc. +# Authoer: Daniel Smith +# +# A helper script to install and setup the ODL docker conatiner on the controller +# +# +# Inputs: odl_docker_image.tar +# +# Usage: ./start_odl_docker.sh +echo "DEPRECATED - USE stage_odl.sh instead - this will be removed shortly once automated deployment is working - SR1" + + +# ENVS +source ~/.bashrc +source ~/openrc + +# VARS + +# Switch for Dev mode - uses apt-get on control to cheat and get docker installed locally rather than from puppet source + +DEV=1 + +# Switch for 1:1 port mapping of EXPOSED ports in Docker to the host, if set to 0, then random ports will be used - NOTE: this doesnt work for all web services X port on Host --> Y port in Container, +# especially for SSL/HTTPS cases. Be aware. + +MATCH_PORT=1 + +LOCALPATH=/opt/opnfv/odl +DOCKERBINNAME=docker-latest +DOCKERIMAGENAME=odl_docker_image.tar +DNS=8.8.8.8 +HOST_IP=`ifconfig br-fw-admin | grep -i "inet addr" | awk -F":" '{print $2}' | awk -F" " '{print $1}'` + + +# Set this to "1" if you want to have your docker container startup into a shell + + +ENABLE_SHELL=1 + + +echo " Fetching Docker " +if [ "$DEV" -eq "1" ]; +# If testing Locally (on a control node) you can set DEV=1 to enable apt-get based install on the control node (not desired target, but good for testing). +then + echo "Dev Mode - Fetching from Internet"; + echo " this wont work in production builds"; + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + mkdir -p $LOCALPATH + wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O $LOCALPATH/$DOCKERBINNAME + wget http://ftp.us.debian.org/debian/pool/main/d/docker.io/docker.io_1.3.3~dfsg1-2_amd64.deb + chmod 777 $LOCALPATH/$DOCKERBINNAME + echo "done "; +else + echo "Using Binaries delivered from Puppet" + echo "Starting Docker in Daemon mode" + chmod +x $LOCALPATH/$DOCKERBINNAME + $LOCALPATH/$DOCKERBINNAME -d & + + # wait until docker will be fully initialized + # before any further action against just started docker + sleep 5 +fi + + +# We need to perform some cleanup of the Openstack Environment +echo "TODO -- This should be automated in the Fuel deployment at some point" +echo "However, the timing should come after basic tests are running, since this " +echo " part will remove the subnet router association that is deployed automativally" +echo " via fuel. Refer to the ODL + Openstack Integration Page " + +# Import the ODL container into docker + +echo "Importing ODL container into docker" +$LOCALPATH/$DOCKERBINNAME load -i $LOCALPATH/$DOCKERIMAGENAME + +echo " starting up ODL - DLUX and Mapping Ports" +if [ "$MATCH_PORT" -eq "1" ] +then + echo "Starting up Docker..." + $LOCALPATH/$DOCKERBINNAME rm odl_docker +fi + +if [ "$ENABLE_SHELL" -eq "1" ]; +then + echo "Starting Container in Interactive Mode (/bin/bash will be provided, you will need to run ./start_odl_docker.sh inside the container yourself)" + $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -t loving_daniel /bin/bash +else + echo "Starting Conatiner in Daemon mode - no shell will be provided and docker attach will not provide shell)" + $LOCALPATH/$DOCKERBINNAME run --name odl_docker -p 8181:8181 -p 8185:8185 -p 9000:9000 -p 1099:1099 -p 8101:8101 -p 6633:6633 -p 43506:43506 -p 44444:44444 -p 6653:6653 -p 12001:12001 -p 6400:6400 -p 6640:6640 -p 8080:8080 -p 7800:7800 -p 55130:55130 -p 52150:52150 -p 36826:26826 -i -d -t loving_daniel + echo "should see the process listed here in docker ps -a" + $LOCALPATH/$DOCKERBINNAME ps -a; + echo "Match Port enabled, you can reach the DLUX login at: " + echo "http://$HOST_IP:8181/dlux.index.html" +fi diff --git a/fuel/build/f_odl_docker/scripts/config_net_odl.sh b/fuel/build/f_odl_docker/scripts/config_net_odl.sh new file mode 100644 index 000000000..d292acd93 --- /dev/null +++ b/fuel/build/f_odl_docker/scripts/config_net_odl.sh @@ -0,0 +1,164 @@ +#!/bin/bash +# +# Author: Daniel Smith (Ericsson) +# +# Script to update neutron configuration for OVSDB/ODL integratino +# +# Usage - Set / pass CONTROL_HOST to your needs +# +CONTROL_HOST=172.30.9.70 + +# ENV +source ~/openrc + +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUNCTIONS + +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF + sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + cat "[ml2_odl]" >> $ML2_CONF + cat "password = admin" >> $ML2_CONF + cat "username = admin" >> $ML2_CONF + cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF +} + +function reset_neutrondb { + echo "Reseting DB" + mysql -e "drop database if exists neutron_ml2;" + mysql -e "create database neutron_ml2 character set utf8;" + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head +} + +function restart_neutron { + echo "Restarting Neutron Server" + service neutron-server restart + echo "Should see Neutron runing now" + service neutron-server status + echo "Shouldnt be any nets, but should work (return empty)" + neutron net-list +} + +function stop_neutron { + echo "Stopping Neutron / OVS components" + service neutron-plugin-openvswitch-agent stop + if [ $MODE == "0" ] + then + service neutron-server stop + fi +} + + + +function verify_ML2_working { + echo "checking that we can talk via ML2 properly" + curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 + if grep "network" /tmp/check_ml2 + then + echo "Success - ML2 to ODL is working" + else + echo "im sorry Jim, but its dead" + fi + +} + + +function set_mode { + if ls -l /var/lib/glance/images + then + echo "Controller Mode" + MODE=0 + else + echo "Compute Mode" + MODE=1 + fi +} + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function control_setup { + echo "Modifying Controller" + stop_neutron + stop_ovs + rm -rf /var/log/openvswitch/* + mkdir -p /opt/opnfv/odl/ovs_back + mv /etc/openvswitch/conf.db /opt/opnfv/odl/ovs_back/. + mv /etc/openvswitch/.conf*lock* /opt/opnfv/odl/ovs_back/. + service openvswitch-switch start + ovs-vsctl set-manager tcp:172.30.9.70:6640 + ovs-vsctl add-br br-eth0 + ovs-vsctl add-br br-ex + ovs-vsctl add-port br-eth0 eth0 + ovs-vsctl add-port br-eth0 br-eth0--br-ex + ovs-vsctl add-port br-ex br-ex--br-eth0 + ovs-vsctl set interface br-ex--br-eth0 type=patch + ovs-vsctl set interface br-eth0--br-ex type=patch + ovs-vsctl set interface br-ex--br-eth0 options:peer=br-eth0--br-ex + ovs-vsctl set interface br-eth0--br-ex options:peer=br-ex--br-eth0 + ifconfig br-ex 172.30.9.70/24 up + service neutron-server restart + + echo "setting up networks" + ip link add link eth1 name br-mgmt type vlan id 300 + ip link add link eth1 name br-storage type vlan id 301 + /etc/init.d/networking restart + + + echo "Reset Neutron DB" + #reset_neutrondb + echo "Restarting Neutron Components" + #restart_neutron + echo "Verifying ODL ML2 plugin is working" + verify_ML2_working + +} + +function compute_setup { + echo "do compute stuff here" + echo "stopping neutron openvswitch plugin" + stop_neutron + ip link add link eth1 name br-mgmt type vlan id 300 + ifconfig br-mgmt `grep address /etc/network/interfaces.d/ifcfg-br-mgmt | awk -F" " '{print $2}'`/24 + ip link add link eth1 name br-storage type vlan id 301 + ifconfig br-storage `grep address /etc/network/interfaces.d/ifcfg-br-storage | awk -F" " '{print $2}'`/24 + ifconfig eth1 `grep address /etc/network/interfaces.d/ifcfg-br-fw-mgmt | awk -F" " '{print $2}'`/24 + echo "set manager, and route for ODL controller" + ovs-vsctl set-manager tcp:192.168.0.2:6640 + route add 172.17.0.1 gw 192.168.0.2 + verify_ML2_working +} + + +# MAIN +echo "Starting to make call" +update_ml2conf +echo "Check Mode" +set_mode + +if [ $MODE == "0" ]; +then + echo "Calling control setup" + control_setup +elif [ $MODE == "1" ]; +then + echo "Calling compute setup" + compute_setup + +else + echo "Something is bad - call for help" + exit +fi + + diff --git a/fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh b/fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh new file mode 100644 index 000000000..3b688aee5 --- /dev/null +++ b/fuel/build/f_odl_docker/scripts/config_neutron_for_odl.sh @@ -0,0 +1,146 @@ +#!/bin/bash +CONTROL_HOST=172.17.0.3 + +# ENV +source ~/openrc + + + +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUCNTIONS + + +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF +#!/bin/bash +CONTROL_HOST=172.17.0.3 + +# ENV +source ~/openrc + + + +# VARS +ML2_CONF=/etc/neutron/plugins/ml2/ml2_conf.ini +MODE=0 + + +# FUCNTIONS + + +# Update ml2_conf.ini +function update_ml2conf { + echo "Backing up and modifying ml2_conf.ini" + cp $ML2_CONF $ML2_CONF.bak + sed -i -e 's/mechanism_drivers =openvswitch/mechanism_drivers = opendaylight/g' $ML2_CONF + sed -i -e 's/tenant_network_types = flat,vlan,gre,vxlan/tenant_network_types = vxlan/g' $ML2_CONF + cat "[ml2_odl]" >> $ML2_CONF + cat "password = admin" >> $ML2_CONF + cat "username = admin" >> $ML2_CONF + cat "url = http://${CONTROL_HOST}:8080/controller/nb/v2/neutron" >> $ML2_CONF +} + +function reset_neutrondb { + echo "Reseting DB" + mysql -e "drop database if exists neutron_ml2;" + mysql -e "create database neutron_ml2 character set utf8;" + mysql -e "grant all on neutron_ml2.* to 'neutron'@'%';" + neutron-db-manage --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini upgrade head +} + +function restart_neutron { + echo "Restarting Neutron Server" + service neutron-server restart + echo "Should see Neutron runing now" + service neutron-server status + echo "Shouldnt be any nets, but should work (return empty)" + neutron net-list +} + +function stop_neutron { + echo "Stopping Neutron / OVS components" + service neutron-plugin-openvswitch-agent stop + if [ $MODE == "0" ] + then + service neutron-server stop + fi +} + + + +function verify_ML2_working { + echo "checking that we can talk via ML2 properly" + curl -u admin:admin http://${CONTROL_HOST}:8080/controller/nb/v2/neutron/networks > /tmp/check_ml2 + if grep "network" /tmp/check_ml2 + then + echo "Success - ML2 to ODL is working" + else + echo "im sorry Jim, but its dead" + fi + +} + + +function set_mode { + if df -k | grep glance + then + echo "Controller Mode" + MODE=0 + else + echo "Compute Mode" + MODE=1 + fi +} + +function stop_ovs { + echo "Stopping OpenVSwitch" + service openvswitch-switch stop + +} + +function control_setup { + echo "do control stuff here" + echo "Reset Neutron DB" + #reset_neutrondb + echo "Restarting Neutron Components" + #restart_neutron + echo "Verifying ODL ML2 plugin is working" + verify_ML2_working + +} + +function compute_setup { + echo "do compute stuff here" + stop_neutron + verify_ML2_working +} + + +# MAIN +echo "Starting to make call" +#update_ml2conf +echo "Check Mode" +set_mode + +if [ $MODE == "0" ]; +then + echo "Calling control setup" + control_setup +elif [ $MODE == "1" ]; +then + echo "Calling compute setup" + compute_setup + +else + echo "Something is bad - call for help" + exit +fi + + diff --git a/fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh b/fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh new file mode 100755 index 000000000..dd4fc9fc9 --- /dev/null +++ b/fuel/build/f_odl_docker/scripts/prep_nets_for_odl.sh @@ -0,0 +1,90 @@ +#!/bin/bash +# a "cheat" way to install docker on the controller +# can only be used if you have a connecting out to the internet + +# Usage: ./install_docker.sh <ip of default route to remove> <ip of default gw to add> + +OLDGW=$1 +#!/bin/bash +# a "cheat" way to install docker on the controller +# can only be used if you have a connecting out to the internet + +# Usage: ./install_docker.sh <ip of default route to remove> <ip of default gw to add> + +OLDGW=$1 +NEWGW=$2 +IMAGEPATH=/opt/opnfv +IMAGENAME=odl_docker_image.tar +SOURCES=/etc/apt/sources.list + + +if [ "$#" -ne 2]; then + echo "Two args not provided, will not touch networking" +else + + # Fix routes + echo "Fixing routes" + #DEBUG + netstat -rn + + echo "delete old def route" + route delete default gw $1 + echo "adding new def route" + route add default gw $2 + + echo " you should see a good nslookup now" + nslookup www.google.ca +#!/bin/bash +# a "cheat" way to install docker on the controller +# can only be used if you have a connecting out to the internet + +# Usage: ./install_docker.sh <ip of default route to remove> <ip of default gw to add> + +OLDGW=$1 +NEWGW=$2 +IMAGEPATH=/opt/opnfv +IMAGENAME=odl_docker_image.tar +SOURCES=/etc/apt/sources.list + + +if [ "$#" -ne 2]; then + echo "Two args not provided, will not touch networking" +else + + # Fix routes + echo "Fixing routes" + #DEBUG + netstat -rn + + echo "delete old def route" + route delete default gw $1 + echo "adding new def route" + route add default gw $2 + + echo " you should see a good nslookup now" + nslookup www.google.ca +fi + + +if egrep "mirrors.txt" $SOURCES +then + echo "Sources was already updated, not touching" +else + echo "adding the closests mirrors and docker mirror to the mix" + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise main restricted universe multiverse" >> /etc/apt/sources.list + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-updates main restricted universe multiverse" >> /etc/apt/sources.list + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-backports main restricted universe multiverse" >> /etc/apt/sources.list + echo "deb mirror://mirrors.ubuntu.com/mirrors.txt precise-security main restricted universe multiverse" >> /etc/apt/sources.list + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 + echo "deb https://get.docker.com/ubuntu docker main " > /etc/apt/sources.list.d/docker.list +fi + +echo "Updating" +apt-get update +echo "Installing Docker" +apt-get install -y lxc-docker + +echo "Loading ODL Docker Image" +docker load -i $IMAGEPATH/$IMAGENAME + + diff --git a/fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh b/fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh new file mode 100644 index 000000000..42c9451bc --- /dev/null +++ b/fuel/build/f_odl_docker/scripts/setup_ovs_for_odl.sh @@ -0,0 +1,23 @@ +#!/bin/bash + + + +ok .. so they created br-int + +so lets add a physical nic to it + + +# First - Removal all the bridges you find + +for i in $(ovs-vsctl list-br) +do + if [ "$i" == "br-int" ]; + then + echo "skipped br-int" + elif [ "$i" == "br-prv"]; + then + echo "skipped br-pr" + else + ovs-vsctl del-br $i + fi +done diff --git a/fuel/build/f_opnfv_puppet/Makefile b/fuel/build/f_opnfv_puppet/Makefile new file mode 100644 index 000000000..0949737bc --- /dev/null +++ b/fuel/build/f_opnfv_puppet/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: + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_opnfv_puppet/README b/fuel/build/f_opnfv_puppet/README new file mode 100644 index 000000000..35bea5a00 --- /dev/null +++ b/fuel/build/f_opnfv_puppet/README @@ -0,0 +1,12 @@ +############################################################################## +# 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 top level "OPNFV" Puppet class which (hopefully) only will be used to include +an appropriate set of sub-classes which themselves will be self-contained. diff --git a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/add_packages.pp b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/add_packages.pp new file mode 100644 index 000000000..ccb39392f --- /dev/null +++ b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/add_packages.pp @@ -0,0 +1,9 @@ +# Class: opnfv::add_packages +# +# Ensure added packages are installed: +# + +class opnfv::add_packages { + if $::osfamily == 'Debian' { + } +} diff --git a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp new file mode 100644 index 000000000..54f1c86bf --- /dev/null +++ b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/init.pp @@ -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 +############################################################################## + +# == Class: opnfv +# +# This class is used to perform OPNFV inclusions and settings on top of +# the vanilla Fuel installation. +# +# Currently all logic is self contained, i.e. it is sufficient to +# "include opnfv" from site.pp. + +class opnfv { + # Configure resolv.conf if parameters passed through astute + include opnfv::resolver + # Setup OPNFV style NTP config + include opnfv::ntp + # Make sure all added packages are installed + include opnfv::add_packages + # Setup OpenDaylight + include opnfv::odl_docker +} diff --git a/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/opncheck.pp b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/opncheck.pp new file mode 100644 index 000000000..0822f0233 --- /dev/null +++ b/fuel/build/f_opnfv_puppet/puppet/modules/opnfv/manifests/opncheck.pp @@ -0,0 +1,21 @@ +############################################################################## +# 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 +############################################################################## + +# Class: opnfv::opncheck +# +# Make sure that /opt/opnfv/pre-deploy.sh has been run by +# verifying there is an "opnfv:" level in the astute.yaml. + +class opnfv::opncheck() +{ + unless $::fuel_settings['opnfv'] { + fail("Error: You have not run /opt/opnfv/pre-deploy.sh on the Fuel master prior to deploying!") + } +} diff --git a/fuel/build/f_osnaily/Makefile b/fuel/build/f_osnaily/Makefile new file mode 100644 index 000000000..0949737bc --- /dev/null +++ b/fuel/build/f_osnaily/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: + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp b/fuel/build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp new file mode 100644 index 000000000..05cd9e02a --- /dev/null +++ b/fuel/build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp @@ -0,0 +1,366 @@ +$fuel_settings = parseyaml($astute_settings_yaml) + +$openstack_version = { + 'keystone' => 'installed', + 'glance' => 'installed', + 'horizon' => 'installed', + 'nova' => 'installed', + 'novncproxy' => 'installed', + 'cinder' => 'installed', +} + +tag("${::fuel_settings['deployment_id']}::${::fuel_settings['environment']}") + +#Stages configuration +stage {'zero': } -> +stage {'opncheck': } -> +stage {'first': } -> +stage {'openstack-custom-repo': } -> +stage {'netconfig': } -> +stage {'corosync_setup': } -> +stage {'openstack-firewall': } -> Stage['main'] + +class begin_deployment () +{ + $role = $::fuel_settings['role'] + notify { "***** Beginning deployment of node ${::hostname} with role $role *****": } +} + +class {'begin_deployment': stage => 'zero' } + +stage {'glance-image': + require => Stage['main'], +} + +if $::fuel_settings['nodes'] { + $nodes_hash = $::fuel_settings['nodes'] +# OPNFV addition to add to hosts file + if ($::fuel_settings['opnfv'] and + $::fuel_settings['opnfv']['hosts']) { + $extras_hash = $::fuel_settings['opnfv']['hosts'] + } else { + $extras_hash = undef + } + + $dns_nameservers=$::fuel_settings['dns_nameservers'] + $node = filter_nodes($nodes_hash,'name',$::hostname) + if empty($node) { + fail("Node $::hostname is not defined in the hash structure") + } + + $default_gateway = $node[0]['default_gateway'] + + $base_syslog_hash = $::fuel_settings['base_syslog'] + $syslog_hash = $::fuel_settings['syslog'] + + $disable_offload = $::fuel_settings['disable_offload'] + if $disable_offload { + L23network::L3::Ifconfig<||> { + ethtool => { + 'K' => ['gso off', 'gro off'], + } + } + } + + $use_neutron = $::fuel_settings['quantum'] + + if (!empty(filter_nodes($::fuel_settings['nodes'], 'role', 'ceph-osd')) or + $::fuel_settings['storage']['volumes_ceph'] or + $::fuel_settings['storage']['images_ceph'] or + $::fuel_settings['storage']['objects_ceph'] + ) { + $use_ceph = true + } else { + $use_ceph = false + } + + + if $use_neutron { + prepare_network_config($::fuel_settings['network_scheme']) + # + $internal_int = get_network_role_property('management', 'interface') + $internal_address = get_network_role_property('management', 'ipaddr') + $internal_netmask = get_network_role_property('management', 'netmask') + # + $public_int = get_network_role_property('ex', 'interface') + if $public_int { + $public_address = get_network_role_property('ex', 'ipaddr') + $public_netmask = get_network_role_property('ex', 'netmask') + + # TODO(Xarses): remove this after completing merge of + # multiple-cluster-networks + L23network::L3::Ifconfig<| title == $public_int |> { + default_gateway => true + } + } else { + # TODO(Xarses): remove this after completing merge of + # multiple-cluster-networks + $fw_admin_int = get_network_role_property('fw-admin', 'interface') + L23network::L3::Ifconfig<| title == $fw_admin_int |> { + default_gateway => true + } + } + # + $storage_address = get_network_role_property('storage', 'ipaddr') + $storage_netmask = get_network_role_property('storage', 'netmask') + } else { + $internal_address = $node[0]['internal_address'] + $internal_netmask = $node[0]['internal_netmask'] + $public_address = $node[0]['public_address'] + $public_netmask = $node[0]['public_netmask'] + $storage_address = $node[0]['storage_address'] + $storage_netmask = $node[0]['storage_netmask'] + $public_br = $node[0]['public_br'] + $internal_br = $node[0]['internal_br'] + $public_int = $::fuel_settings['public_interface'] + $internal_int = $::fuel_settings['management_interface'] + + # TODO(Xarses): remove this after completing merge of + # multiple-cluster-networks + L23network::L3::Ifconfig<| title == $public_int |> { + default_gateway => true + } + + } +} + +if ($::fuel_settings['neutron_mellanox']) { + $mellanox_mode = $::fuel_settings['neutron_mellanox']['plugin'] +} else { + $mellanox_mode = 'disabled' +} + +# This parameter specifies the verbosity level of log messages +# in openstack components config. +# Debug would have set DEBUG level and ignore verbose settings, if any. +# Verbose would have set INFO level messages +# In case of non debug and non verbose - WARNING, default level would have set. +$verbose = true +$debug = $::fuel_settings['debug'] + +### Storage Settings ### +# Determine if any ceph parts have been asked for. +# This will ensure that monitors are set up on controllers, even if no +# ceph-osd roles during deployment + + +### Syslog ### +#TODO(bogdando) move logging options to astute.yaml +# Enable error messages reporting to rsyslog. Rsyslog must be installed in this case. +$use_syslog = $::fuel_settings['use_syslog'] ? { default=>true } +# Syslog facilities for main openstack services +# should vary (reserved usage) +# local1 is reserved for openstack-dashboard +$syslog_log_facility_glance = 'LOG_LOCAL2' +$syslog_log_facility_cinder = 'LOG_LOCAL3' +$syslog_log_facility_neutron = 'LOG_LOCAL4' +$syslog_log_facility_nova = 'LOG_LOCAL6' +$syslog_log_facility_keystone = 'LOG_LOCAL7' +# could be the same +# local0 is free for use +$syslog_log_facility_murano = 'LOG_LOCAL0' +$syslog_log_facility_heat = 'LOG_LOCAL0' +$syslog_log_facility_sahara = 'LOG_LOCAL0' +$syslog_log_facility_ceilometer = 'LOG_LOCAL0' +$syslog_log_facility_ceph = 'LOG_LOCAL0' + +### Monit ### +# Monit for compute nodes. +# If enabled, will install monit and configure its watchdogs to track +# nova-compute/api/network (and openvswitch service, if neutron enabled) +# at compute nodes. +# TODO(bogdando) set to true once monit package shipped with Fuel ISO +$use_monit = false + +$nova_rate_limits = { + 'POST' => 100000, + 'POST_SERVERS' => 100000, + 'PUT' => 1000, 'GET' => 100000, + 'DELETE' => 100000 +} +$cinder_rate_limits = { + 'POST' => 100000, + 'POST_SERVERS' => 100000, + 'PUT' => 100000, 'GET' => 100000, + 'DELETE' => 100000 +} + +### +class advanced_node_netconfig { + $sdn = generate_network_config() + notify {"SDN: ${sdn}": } +} + +case $::operatingsystem { + 'redhat' : { + $queue_provider = 'qpid' + $custom_mysql_setup_class = 'pacemaker_mysql' + } + default: { + $queue_provider='rabbitmq' + $custom_mysql_setup_class='galera' + } +} + +class os_common { + # OPNFV check if pre_deploy.sh has been run, otherwise fail + class {'opnfv::opncheck': stage => 'opncheck' } + if ($::fuel_settings['neutron_mellanox']) { + if ($::mellanox_mode != 'disabled') { + class { 'mellanox_openstack::ofed_recompile' : + stage => 'zero', + } + } + if ($::fuel_settings['storage']['iser']) { + class { 'mellanox_openstack::iser_rename': + stage => 'zero', + storage_parent => $::fuel_settings['neutron_mellanox']['storage_parent'], + iser_interface_name => $::fuel_settings['neutron_mellanox']['iser_interface_name'], + } + Class['mellanox_openstack::ofed_recompile'] -> Class['mellanox_openstack::iser_rename'] + } + } + class {"l23network::hosts_file": stage => 'netconfig', nodes => $nodes_hash, extras => $extras_hash } + class {'l23network': use_ovs=>$use_neutron, stage=> 'netconfig'} + if $use_neutron { + class {'advanced_node_netconfig': stage => 'netconfig' } + } else { + class {'osnailyfacter::network_setup': stage => 'netconfig'} + } + + if ($::osfamily == 'RedHat') { + package {'irqbalance': ensure => present} -> service {'irqbalance': ensure => running } + } + + class { 'openstack::firewall': + stage => 'openstack-firewall', + nova_vnc_ip_range => $::fuel_settings['management_network_range'], + } + + $base_syslog_rserver = { + 'remote_type' => 'tcp', + 'server' => $base_syslog_hash['syslog_server'], + 'port' => $base_syslog_hash['syslog_port'] + } + + # setting kernel reserved ports + # defaults are 49000,35357,41055,58882 + class { 'openstack::reserved_ports': + stage => 'netconfig', + } + + # setting service down time and report interval + # to 60 and 180 for Nova respectively to allow kernel + # to kill dead connections + # (see zendesk #1158 as well) + $nova_report_interval = '60' + $nova_service_down_time = '180' + + $syslog_rserver = { + 'remote_type' => $syslog_hash['syslog_transport'], + 'server' => $syslog_hash['syslog_server'], + 'port' => $syslog_hash['syslog_port'], + } + if $syslog_hash['syslog_server'] != "" and $syslog_hash['syslog_port'] != "" and $syslog_hash['syslog_transport'] != "" { + $rservers = [$base_syslog_rserver, $syslog_rserver] + } else { + $rservers = [$base_syslog_rserver] + } + + if $use_syslog { + class { "::openstack::logging": + stage => 'first', + role => 'client', + show_timezone => true, + # log both locally include auth, and remote + log_remote => true, + log_local => true, + log_auth_local => true, + # keep four weekly log rotations, force rotate if 300M size have exceeded + rotation => 'weekly', + keep => '4', + # should be > 30M + limitsize => '300M', + # remote servers to send logs to + rservers => $rservers, + # should be true, if client is running at virtual node + virtual => str2bool($::is_virtual), + # Rabbit doesn't support syslog directly + rabbit_log_level => 'NOTICE', + debug => $debug, + } + } + + class { 'osnailyfacter::atop': + stage => 'first', + } + + class { 'osnailyfacter::ssh': } + + #case $role { + # /controller/: { $hostgroup = 'controller' } + # /swift-proxy/: { $hostgroup = 'swift-proxy' } + # /storage/:{ $hostgroup = 'swift-storage' } + # /compute/: { $hostgroup = 'compute' } + # /cinder/: { $hostgroup = 'cinder' } + # default: { $hostgroup = 'generic' } + #} + + # if $nagios != 'false' { + # class {'nagios': + # proj_name => $proj_name, + # services => [ + # 'host-alive','nova-novncproxy','keystone', 'nova-scheduler', + # 'nova-consoleauth', 'nova-cert', 'haproxy', 'nova-api', 'glance-api', + # 'glance-registry','horizon', 'rabbitmq', 'mysql', + # ], + # whitelist => ['127.0.0.1', $nagios_master], + # hostgroup => $hostgroup , + # } + # } + + # Workaround for fuel bug with firewall + firewall {'003 remote rabbitmq ': + sport => [ 4369, 5672, 15672, 41055, 55672, 61613 ], + source => $::fuel_settings['master_ip'], + proto => 'tcp', + action => 'accept', + require => Class['openstack::firewall'], + } + + firewall {'004 remote puppet ': + sport => [ 8140 ], + source => $master_ip, + proto => 'tcp', + action => 'accept', + require => Class['openstack::firewall'], + } + + class { 'puppet::pull' : + modules_source => $::fuel_settings['puppet_modules_source'], + manifests_source => $::fuel_settings['puppet_manifests_source'], + } +} # OS_COMMON ENDS + + + +node default { + case $::fuel_settings['deployment_mode'] { + "singlenode": { + include "osnailyfacter::cluster_simple" + class {'os_common':} + class {'opnfv':} + } + "multinode": { + include "osnailyfacter::cluster_simple" + class {'os_common':} + class {'opnfv':} + } + /^(ha|ha_compact)$/: { + include "osnailyfacter::cluster_ha" + class {'os_common':} + class {'opnfv':} + } + "rpmcache": { include osnailyfacter::rpmcache } + } +} diff --git a/fuel/build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp.orig b/fuel/build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp.orig new file mode 100644 index 000000000..9ed557af3 --- /dev/null +++ b/fuel/build/f_osnaily/puppet/modules/osnailyfacter/examples/site.pp.orig @@ -0,0 +1,353 @@ +$fuel_settings = parseyaml($astute_settings_yaml) + +$openstack_version = { + 'keystone' => 'installed', + 'glance' => 'installed', + 'horizon' => 'installed', + 'nova' => 'installed', + 'novncproxy' => 'installed', + 'cinder' => 'installed', +} + +tag("${::fuel_settings['deployment_id']}::${::fuel_settings['environment']}") + +#Stages configuration +stage {'zero': } -> +stage {'first': } -> +stage {'openstack-custom-repo': } -> +stage {'netconfig': } -> +stage {'corosync_setup': } -> +stage {'openstack-firewall': } -> Stage['main'] + +class begin_deployment () +{ + $role = $::fuel_settings['role'] + notify { "***** Beginning deployment of node ${::hostname} with role $role *****": } +} + +class {'begin_deployment': stage => 'zero' } + +stage {'glance-image': + require => Stage['main'], +} + +if $::fuel_settings['nodes'] { + $nodes_hash = $::fuel_settings['nodes'] + $dns_nameservers=$::fuel_settings['dns_nameservers'] + $node = filter_nodes($nodes_hash,'name',$::hostname) + if empty($node) { + fail("Node $::hostname is not defined in the hash structure") + } + + $default_gateway = $node[0]['default_gateway'] + + $base_syslog_hash = $::fuel_settings['base_syslog'] + $syslog_hash = $::fuel_settings['syslog'] + + $disable_offload = $::fuel_settings['disable_offload'] + if $disable_offload { + L23network::L3::Ifconfig<||> { + ethtool => { + 'K' => ['gso off', 'gro off'], + } + } + } + + $use_neutron = $::fuel_settings['quantum'] + + if (!empty(filter_nodes($::fuel_settings['nodes'], 'role', 'ceph-osd')) or + $::fuel_settings['storage']['volumes_ceph'] or + $::fuel_settings['storage']['images_ceph'] or + $::fuel_settings['storage']['objects_ceph'] + ) { + $use_ceph = true + } else { + $use_ceph = false + } + + + if $use_neutron { + prepare_network_config($::fuel_settings['network_scheme']) + # + $internal_int = get_network_role_property('management', 'interface') + $internal_address = get_network_role_property('management', 'ipaddr') + $internal_netmask = get_network_role_property('management', 'netmask') + # + $public_int = get_network_role_property('ex', 'interface') + if $public_int { + $public_address = get_network_role_property('ex', 'ipaddr') + $public_netmask = get_network_role_property('ex', 'netmask') + + # TODO(Xarses): remove this after completing merge of + # multiple-cluster-networks + L23network::L3::Ifconfig<| title == $public_int |> { + default_gateway => true + } + } else { + # TODO(Xarses): remove this after completing merge of + # multiple-cluster-networks + $fw_admin_int = get_network_role_property('fw-admin', 'interface') + L23network::L3::Ifconfig<| title == $fw_admin_int |> { + default_gateway => true + } + } + # + $storage_address = get_network_role_property('storage', 'ipaddr') + $storage_netmask = get_network_role_property('storage', 'netmask') + } else { + $internal_address = $node[0]['internal_address'] + $internal_netmask = $node[0]['internal_netmask'] + $public_address = $node[0]['public_address'] + $public_netmask = $node[0]['public_netmask'] + $storage_address = $node[0]['storage_address'] + $storage_netmask = $node[0]['storage_netmask'] + $public_br = $node[0]['public_br'] + $internal_br = $node[0]['internal_br'] + $public_int = $::fuel_settings['public_interface'] + $internal_int = $::fuel_settings['management_interface'] + + # TODO(Xarses): remove this after completing merge of + # multiple-cluster-networks + L23network::L3::Ifconfig<| title == $public_int |> { + default_gateway => true + } + + } +} + +if ($::fuel_settings['neutron_mellanox']) { + $mellanox_mode = $::fuel_settings['neutron_mellanox']['plugin'] +} else { + $mellanox_mode = 'disabled' +} + +# This parameter specifies the verbosity level of log messages +# in openstack components config. +# Debug would have set DEBUG level and ignore verbose settings, if any. +# Verbose would have set INFO level messages +# In case of non debug and non verbose - WARNING, default level would have set. +$verbose = true +$debug = $::fuel_settings['debug'] + +### Storage Settings ### +# Determine if any ceph parts have been asked for. +# This will ensure that monitors are set up on controllers, even if no +# ceph-osd roles during deployment + + +### Syslog ### +#TODO(bogdando) move logging options to astute.yaml +# Enable error messages reporting to rsyslog. Rsyslog must be installed in this case. +$use_syslog = $::fuel_settings['use_syslog'] ? { default=>true } +# Syslog facilities for main openstack services +# should vary (reserved usage) +# local1 is reserved for openstack-dashboard +$syslog_log_facility_glance = 'LOG_LOCAL2' +$syslog_log_facility_cinder = 'LOG_LOCAL3' +$syslog_log_facility_neutron = 'LOG_LOCAL4' +$syslog_log_facility_nova = 'LOG_LOCAL6' +$syslog_log_facility_keystone = 'LOG_LOCAL7' +# could be the same +# local0 is free for use +$syslog_log_facility_murano = 'LOG_LOCAL0' +$syslog_log_facility_heat = 'LOG_LOCAL0' +$syslog_log_facility_sahara = 'LOG_LOCAL0' +$syslog_log_facility_ceilometer = 'LOG_LOCAL0' +$syslog_log_facility_ceph = 'LOG_LOCAL0' + +### Monit ### +# Monit for compute nodes. +# If enabled, will install monit and configure its watchdogs to track +# nova-compute/api/network (and openvswitch service, if neutron enabled) +# at compute nodes. +# TODO(bogdando) set to true once monit package shipped with Fuel ISO +$use_monit = false + +$nova_rate_limits = { + 'POST' => 100000, + 'POST_SERVERS' => 100000, + 'PUT' => 1000, 'GET' => 100000, + 'DELETE' => 100000 +} +$cinder_rate_limits = { + 'POST' => 100000, + 'POST_SERVERS' => 100000, + 'PUT' => 100000, 'GET' => 100000, + 'DELETE' => 100000 +} + +### +class advanced_node_netconfig { + $sdn = generate_network_config() + notify {"SDN: ${sdn}": } +} + +case $::operatingsystem { + 'redhat' : { + $queue_provider = 'qpid' + $custom_mysql_setup_class = 'pacemaker_mysql' + } + default: { + $queue_provider='rabbitmq' + $custom_mysql_setup_class='galera' + } +} + +class os_common { + if ($::fuel_settings['neutron_mellanox']) { + if ($::mellanox_mode != 'disabled') { + class { 'mellanox_openstack::ofed_recompile' : + stage => 'zero', + } + } + if ($::fuel_settings['storage']['iser']) { + class { 'mellanox_openstack::iser_rename': + stage => 'zero', + storage_parent => $::fuel_settings['neutron_mellanox']['storage_parent'], + iser_interface_name => $::fuel_settings['neutron_mellanox']['iser_interface_name'], + } + Class['mellanox_openstack::ofed_recompile'] -> Class['mellanox_openstack::iser_rename'] + } + } + + class {"l23network::hosts_file": stage => 'netconfig', nodes => $nodes_hash } + class {'l23network': use_ovs=>$use_neutron, stage=> 'netconfig'} + if $use_neutron { + class {'advanced_node_netconfig': stage => 'netconfig' } + } else { + class {'osnailyfacter::network_setup': stage => 'netconfig'} + } + + if ($::osfamily == 'RedHat') { + package {'irqbalance': ensure => present} -> service {'irqbalance': ensure => running } + } + + class { 'openstack::firewall': + stage => 'openstack-firewall', + nova_vnc_ip_range => $::fuel_settings['management_network_range'], + } + + $base_syslog_rserver = { + 'remote_type' => 'tcp', + 'server' => $base_syslog_hash['syslog_server'], + 'port' => $base_syslog_hash['syslog_port'] + } + + # setting kernel reserved ports + # defaults are 49000,35357,41055,58882 + class { 'openstack::reserved_ports': + stage => 'netconfig', + } + + # setting service down time and report interval + # to 60 and 180 for Nova respectively to allow kernel + # to kill dead connections + # (see zendesk #1158 as well) + $nova_report_interval = '60' + $nova_service_down_time = '180' + + $syslog_rserver = { + 'remote_type' => $syslog_hash['syslog_transport'], + 'server' => $syslog_hash['syslog_server'], + 'port' => $syslog_hash['syslog_port'], + } + if $syslog_hash['syslog_server'] != "" and $syslog_hash['syslog_port'] != "" and $syslog_hash['syslog_transport'] != "" { + $rservers = [$base_syslog_rserver, $syslog_rserver] + } else { + $rservers = [$base_syslog_rserver] + } + + if $use_syslog { + class { "::openstack::logging": + stage => 'first', + role => 'client', + show_timezone => true, + # log both locally include auth, and remote + log_remote => true, + log_local => true, + log_auth_local => true, + # keep four weekly log rotations, force rotate if 300M size have exceeded + rotation => 'weekly', + keep => '4', + # should be > 30M + limitsize => '300M', + # remote servers to send logs to + rservers => $rservers, + # should be true, if client is running at virtual node + virtual => str2bool($::is_virtual), + # Rabbit doesn't support syslog directly + rabbit_log_level => 'NOTICE', + debug => $debug, + } + } + + class { 'osnailyfacter::atop': + stage => 'first', + } + + class { 'osnailyfacter::ssh': } + + #case $role { + # /controller/: { $hostgroup = 'controller' } + # /swift-proxy/: { $hostgroup = 'swift-proxy' } + # /storage/:{ $hostgroup = 'swift-storage' } + # /compute/: { $hostgroup = 'compute' } + # /cinder/: { $hostgroup = 'cinder' } + # default: { $hostgroup = 'generic' } + #} + + # if $nagios != 'false' { + # class {'nagios': + # proj_name => $proj_name, + # services => [ + # 'host-alive','nova-novncproxy','keystone', 'nova-scheduler', + # 'nova-consoleauth', 'nova-cert', 'haproxy', 'nova-api', 'glance-api', + # 'glance-registry','horizon', 'rabbitmq', 'mysql', + # ], + # whitelist => ['127.0.0.1', $nagios_master], + # hostgroup => $hostgroup , + # } + # } + + # Workaround for fuel bug with firewall + firewall {'003 remote rabbitmq ': + sport => [ 4369, 5672, 15672, 41055, 55672, 61613 ], + source => $::fuel_settings['master_ip'], + proto => 'tcp', + action => 'accept', + require => Class['openstack::firewall'], + } + + firewall {'004 remote puppet ': + sport => [ 8140 ], + source => $master_ip, + proto => 'tcp', + action => 'accept', + require => Class['openstack::firewall'], + } + + class { 'puppet::pull' : + modules_source => $::fuel_settings['puppet_modules_source'], + manifests_source => $::fuel_settings['puppet_manifests_source'], + } +} # OS_COMMON ENDS + + + +node default { + case $::fuel_settings['deployment_mode'] { + "singlenode": { + include "osnailyfacter::cluster_simple" + class {'os_common':} + } + "multinode": { + include "osnailyfacter::cluster_simple" + class {'os_common':} + } + /^(ha|ha_compact)$/: { + include "osnailyfacter::cluster_ha" + class {'os_common':} + } + "rpmcache": { include osnailyfacter::rpmcache } + } +} diff --git a/fuel/build/f_resolvconf/Makefile b/fuel/build/f_resolvconf/Makefile new file mode 100644 index 000000000..0949737bc --- /dev/null +++ b/fuel/build/f_resolvconf/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: + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release: + @cp -Rvp puppet/modules/* $(PUPPET_DEST) diff --git a/fuel/build/f_resolvconf/README b/fuel/build/f_resolvconf/README new file mode 100644 index 000000000..5ff570f0a --- /dev/null +++ b/fuel/build/f_resolvconf/README @@ -0,0 +1,36 @@ +############################################################################## +# 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 +############################################################################## + +Addition to generate resolv.conf separately for compute hosts and controller +hosts through Astute. + +The astute.yaml file should contain entries as those below to have them picked +up during deployment: + +opnfv: + dns: + compute: + - 100.100.100.2 + - 100.100.100.3 + controller: + - 100.100.100.102 + - 100.100.100.104 + +The suggested method for adding this information is to prepare for deployment +with the Fuel GUI or CLI, but before actually deploying: + +1. Download the current deployment for all hosts: fuel --env 1 deployment --default +2. Iterate through the hosts in "deployment_1" and add hosts configuration in + the above format to their respective yaml file. +3. Upload the modifed deployment information: fuel --env 1 deployment --upload + +After deploying, the additions will be included in /etc/astute.yaml of each +host. + diff --git a/fuel/build/f_resolvconf/puppet/modules/opnfv/manifests/resolver.pp b/fuel/build/f_resolvconf/puppet/modules/opnfv/manifests/resolver.pp new file mode 100644 index 000000000..44f36a237 --- /dev/null +++ b/fuel/build/f_resolvconf/puppet/modules/opnfv/manifests/resolver.pp @@ -0,0 +1,73 @@ +############################################################################## +# 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 +############################################################################## + +# Class: opnfv::resolver +# +# Add resolver content passed through astute.yaml into resolv.conf +# depending on the role +# +# Suitable yaml content: +# <begin> +# opnfv: +# dns: +# compute: +# - 100.100.100.2 +# - 100.100.100.3 +# controller: +# - 100.100.100.102 +# - 100.100.100.104 +# <end> +# +# +# + +class opnfv::resolver() +{ + if $::fuel_settings['role'] { + if $::fuel_settings['role'] == 'primary-controller' { + $role = 'controller' + } else { + $role = $::fuel_settings['role'] + } + + if ($::fuel_settings['opnfv'] + and $::fuel_settings['opnfv']['dns'] + and $::fuel_settings['opnfv']['dns'][$role]) { + $nameservers=$::fuel_settings['opnfv']['dns'][$role] + + file { '/etc/resolv.conf': + owner => root, + group => root, + mode => '0644', + content => template('opnfv/resolv.conf.erb'), + } + + # /etc/resolv.conf is re-generated at each boot by resolvconf, so we + # need to store there as well. + + case $::operatingsystem { + 'ubuntu': { + file { '/etc/resolvconf/resolv.conf.d/head': + owner => root, + group => root, + mode => '0644', + content => template('opnfv/resolv.conf.erb'), + } + } + 'centos': { + exec { 'for file in ifcfg-eth*; do grep -q -F "PEERDNS=" $file || echo "PEERDNS=no" >> $file; done ': + provider => 'shell', + cwd => '/etc/sysconfig/network-scripts', + } + } + } + } + } +} diff --git a/fuel/build/f_resolvconf/puppet/modules/opnfv/templates/resolv.conf.erb b/fuel/build/f_resolvconf/puppet/modules/opnfv/templates/resolv.conf.erb new file mode 100644 index 000000000..7a29dcaf7 --- /dev/null +++ b/fuel/build/f_resolvconf/puppet/modules/opnfv/templates/resolv.conf.erb @@ -0,0 +1,15 @@ +############################################################################## +# 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 +############################################################################## + +# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) +# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN +# Modified by OPNFV. +<% @nameservers.each do |ns| %>nameserver <%= ns %> +<% end -%> diff --git a/fuel/build/f_resolvconf/testing/README b/fuel/build/f_resolvconf/testing/README new file mode 100644 index 000000000..6846a8dc9 --- /dev/null +++ b/fuel/build/f_resolvconf/testing/README @@ -0,0 +1,13 @@ +############################################################################## +# 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 +############################################################################## + +In order to test the functionality without performing a full deployment, +run "puppet apply" on the fake_init.pp which will call only the +opnfv::resolvconf class. diff --git a/fuel/build/f_resolvconf/testing/fake_init.pp b/fuel/build/f_resolvconf/testing/fake_init.pp new file mode 100644 index 000000000..496dcd216 --- /dev/null +++ b/fuel/build/f_resolvconf/testing/fake_init.pp @@ -0,0 +1,13 @@ +############################################################################## +# 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 +############################################################################## + +$fuel_settings = parseyaml($astute_settings_yaml) + +include opnfv::resolvconf diff --git a/fuel/build/fuel-agent_1.patch b/fuel/build/fuel-agent_1.patch deleted file mode 100644 index b0808966f..000000000 --- a/fuel/build/fuel-agent_1.patch +++ /dev/null @@ -1,36 +0,0 @@ -*** build/repos/nailgun/fuel_agent/fuel_agent/manager.py.orig Thu Sep 24 11:08:38 2015 ---- build/repos/nailgun/fuel_agent/fuel_agent/manager.py Thu Sep 24 11:10:25 2015 -*************** -*** 541,546 **** ---- 541,552 ---- - fs_options=fs.options, - fs_label=fs.label, - dev=str(fs.device)) -+ if fs.type == 'ext4': -+ LOG.debug('Trying to disable journaling for ext4 ' -+ 'in order to speed up the build') -+ utils.execute('tune2fs', '-O', '^has_journal', -+ str(fs.device)) -+ - - # mounting all images into chroot tree - self.mount_target(chroot, treat_mtab=False, pseudo=False) -*************** -*** 631,636 **** ---- 637,652 ---- - self.umount_target(chroot, pseudo=False, try_lazy_umount=False) - - for image in self.driver.image_scheme.images: -+ # find fs with the same loop device object -+ # as image.target_device -+ fs = self.driver.partition_scheme.fs_by_device( -+ image.target_device) -+ -+ if fs.type == 'ext4': -+ LOG.debug('Trying to re-enable journaling for ext4') -+ utils.execute('tune2fs', '-O', 'has_journal', -+ str(fs.device)) -+ - LOG.debug('Deattaching loop device from file: %s', - image.img_tmp_file) - bu.deattach_loop(str(image.target_device)) diff --git a/fuel/build/fuel-main_1.patch b/fuel/build/fuel-main_1.patch new file mode 100644 index 000000000..24b25b2c7 --- /dev/null +++ b/fuel/build/fuel-main_1.patch @@ -0,0 +1,104 @@ +diff --git a/docker/astute/Dockerfile b/docker/astute/Dockerfile +index 55f617a..cd05f19 100644 +--- a/docker/astute/Dockerfile ++++ b/docker/astute/Dockerfile +@@ -5,7 +5,7 @@ + FROM fuel/centos + MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y ruby21-nailgun-mcagents sysstat ++RUN sleep 15; rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y ruby21-nailgun-mcagents sysstat + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/cobbler/Dockerfile b/docker/cobbler/Dockerfile +index 0c80abd..3a3d966 100644 +--- a/docker/cobbler/Dockerfile ++++ b/docker/cobbler/Dockerfile +@@ -5,7 +5,7 @@ + FROM fuel/centos + MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y httpd cobbler dnsmasq xinetd tftp-server; ln -s /etc/dnsmasq.conf /etc/cobbler.dnsmasq.conf ++RUN sleep 15; rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y httpd cobbler dnsmasq xinetd tftp-server; ln -s /etc/dnsmasq.conf /etc/cobbler.dnsmasq.conf + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/mcollective/Dockerfile b/docker/mcollective/Dockerfile +index e70e87d..d6554b7 100644 +--- a/docker/mcollective/Dockerfile ++++ b/docker/mcollective/Dockerfile +@@ -4,7 +4,7 @@ MAINTAINER Aleksandr Didenko adidenko@mirantis.com + + WORKDIR /root + +-RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y sudo ruby21-mcollective ++RUN sleep 15; rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y sudo ruby21-mcollective + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/ostf/Dockerfile b/docker/ostf/Dockerfile +index 43f911e..8da9108 100644 +--- a/docker/ostf/Dockerfile ++++ b/docker/ostf/Dockerfile +@@ -5,7 +5,7 @@ + FROM fuel/centos + MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all; yum --quiet install -y python-fuelclient supervisor postgresql-libs ++RUN sleep 15; rm -rf /etc/yum.repos.d/*;echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all; yum --quiet install -y python-fuelclient supervisor postgresql-libs + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/postgres/Dockerfile b/docker/postgres/Dockerfile +index b2930db..63cc4c2 100644 +--- a/docker/postgres/Dockerfile ++++ b/docker/postgres/Dockerfile +@@ -3,7 +3,7 @@ FROM fuel/centos + + MAINTAINER Aleksandr Didenko adidenko@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;yum --quiet install -y sudo ++RUN sleep 15; rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;yum --quiet install -y sudo + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/rabbitmq/Dockerfile b/docker/rabbitmq/Dockerfile +index 201648f..4f3b67c 100644 +--- a/docker/rabbitmq/Dockerfile ++++ b/docker/rabbitmq/Dockerfile +@@ -3,7 +3,7 @@ + FROM fuel/centos + MAINTAINER Aleksandr Didenko adidenko@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y rabbitmq-server ++RUN sleep 15; rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all; yum --quiet install -y rabbitmq-server + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/rsync/Dockerfile b/docker/rsync/Dockerfile +index ef737bd..b6eefd1 100644 +--- a/docker/rsync/Dockerfile ++++ b/docker/rsync/Dockerfile +@@ -5,7 +5,7 @@ + FROM fuel/centos + MAINTAINER Matthew Mosesohn mmosesohn@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;yum --quiet install -y ruby21-puppet xinetd rsync logrotate ++RUN sleep 15; rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo;yum clean all;yum --quiet install -y ruby21-puppet xinetd rsync logrotate + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh +diff --git a/docker/rsyslog/Dockerfile b/docker/rsyslog/Dockerfile +index 5efd623..8721b39 100644 +--- a/docker/rsyslog/Dockerfile ++++ b/docker/rsyslog/Dockerfile +@@ -2,7 +2,7 @@ FROM fuel/centos + + MAINTAINER Aleksandr Didenko adidenko@mirantis.com + +-RUN rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all;yum --quiet install -y anacron rsyslog ++RUN sleep 15; rm -rf /etc/yum.repos.d/*; echo -e "[nailgun]\nname=Nailgun Local Repo\nbaseurl=http://$(route -n | awk '/^0.0.0.0/ { print $2 }'):_PORT_/os/x86_64/\ngpgcheck=0" > /etc/yum.repos.d/nailgun.repo; yum clean all;yum --quiet install -y anacron rsyslog + + ADD etc /etc + ADD start.sh /usr/local/bin/start.sh diff --git a/fuel/build/fuel-main_2.patch b/fuel/build/fuel-main_2.patch new file mode 100644 index 000000000..72588cba4 --- /dev/null +++ b/fuel/build/fuel-main_2.patch @@ -0,0 +1,18 @@ +*** fuel-main/sandbox.mk.orig 2015-02-13 12:12:55.362989171 +0100 +--- fuel-main/sandbox.mk 2015-02-13 14:50:39.103017653 +0100 +*************** +*** 71,77 **** +--- 71,83 ---- + echo "Updating apt package database" + sudo chroot $(SANDBOX_UBUNTU) apt-get update + echo "Installing additional packages: $(SANDBOX_DEB_PKGS)" ++ test -e $(SANDBOX_UBUNTU)/sbin/start.orig || mv $(SANDBOX_UBUNTU)/sbin/start $(SANDBOX_UBUNTU)/sbin/start.orig ++ echo "#!/bin/sh" > $(SANDBOX_UBUNTU)/sbin/start ++ echo "exit 0" >> $(SANDBOX_UBUNTU)/sbin/start ++ chmod 755 $(SANDBOX_UBUNTU)/sbin/start + test -n "$(SANDBOX_DEB_PKGS)" && sudo chroot $(SANDBOX_UBUNTU) apt-get install --yes $(SANDBOX_DEB_PKGS) ++ test -e $(SANDBOX_UBUNTU)/sbin/start.orig && (cp $(SANDBOX_UBUNTU)/sbin/start.orig $(SANDBOX_UBUNTU)/sbin/start; \ ++ rm $(SANDBOX_UBUNTU)/sbin/start.orig) + echo "SANDBOX_UBUNTU_UP: done" + endef + diff --git a/fuel/build/fuel-main_3.patch b/fuel/build/fuel-main_3.patch deleted file mode 100644 index 8341d72d6..000000000 --- a/fuel/build/fuel-main_3.patch +++ /dev/null @@ -1,19 +0,0 @@ -*** prepare-build-env.sh.orig Tue Sep 8 08:47:46 2015 ---- prepare-build-env.sh Tue Sep 8 08:48:22 2015 -*************** -*** 41,47 **** - - trusty) - GEMPKG="ruby ruby-dev" -! sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys D5A05778 - echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list - sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm - ;; ---- 41,47 ---- - - trusty) - GEMPKG="ruby ruby-dev" -! sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2 - echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list - sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm - ;; diff --git a/fuel/build/fuel-main_5.patch b/fuel/build/fuel-main_5.patch deleted file mode 100644 index ec75626d0..000000000 --- a/fuel/build/fuel-main_5.patch +++ /dev/null @@ -1,19 +0,0 @@ -*** prepare-build-env.sh.orig Tue Sep 8 10:29:08 2015 ---- prepare-build-env.sh Tue Sep 8 10:30:21 2015 -*************** -*** 43,49 **** - GEMPKG="ruby ruby-dev" - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2 - echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list -! sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm - ;; - - precise) ---- 43,49 ---- - GEMPKG="ruby ruby-dev" - sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 1D2B45A2 - echo "deb http://mirror.fuel-infra.org/devops/ubuntu/ ./" | sudo tee /etc/apt/sources.list.d/fuel-devops.list -! sudo apt-get update && sudo apt-get -y install nodejs nodejs-legacy npm dosfstools xorriso - ;; - - precise) diff --git a/fuel/build/install/apt-ftparchive-deb.conf b/fuel/build/install/apt-ftparchive-deb.conf index 0d15aec6f..1101ac95b 100644 --- a/fuel/build/install/apt-ftparchive-deb.conf +++ b/fuel/build/install/apt-ftparchive-deb.conf @@ -17,9 +17,9 @@ TreeDefault { }; BinDirectory "pool/main" { - Packages "dists/trusty/main/binary-amd64/Packages"; - BinOverride "./indices/override.trusty.main"; - ExtraOverride "./indices/override.trusty.extra.main"; + Packages "dists/precise/main/binary-amd64/Packages"; + BinOverride "./indices/override.precise.main"; + ExtraOverride "./indices/override.precise.extra.main"; }; Default { diff --git a/fuel/build/install/apt-ftparchive-release.conf b/fuel/build/install/apt-ftparchive-release.conf index 02706bd7d..02528829d 100644 --- a/fuel/build/install/apt-ftparchive-release.conf +++ b/fuel/build/install/apt-ftparchive-release.conf @@ -10,9 +10,9 @@ APT::FTPArchive::Release::Origin "Ubuntu"; APT::FTPArchive::Release::Label "Ubuntu"; -APT::FTPArchive::Release::Suite "trusty"; -APT::FTPArchive::Release::Version "1.04"; -APT::FTPArchive::Release::Codename "trusty"; +APT::FTPArchive::Release::Suite "precise"; +APT::FTPArchive::Release::Version "12.04"; +APT::FTPArchive::Release::Codename "precise"; APT::FTPArchive::Release::Architectures "amd64"; APT::FTPArchive::Release::Components "main"; -APT::FTPArchive::Release::Description "Ubuntu Trusty Tahr 14.04 LTS"; +APT::FTPArchive::Release::Description "Ubuntu Precise 12.04 LTS"; diff --git a/fuel/build/install/apt-ftparchive-udeb.conf b/fuel/build/install/apt-ftparchive-udeb.conf index 3b5b239a6..2acbcf0de 100644 --- a/fuel/build/install/apt-ftparchive-udeb.conf +++ b/fuel/build/install/apt-ftparchive-udeb.conf @@ -17,8 +17,8 @@ TreeDefault { }; BinDirectory "pool/debian-installer" { - Packages "dists/trusty/main/debian-installer/binary-amd64/Packages"; - BinOverride "./indices/override.trusty.main.debian-installer"; + Packages "dists/precise/main/debian-installer/binary-amd64/Packages"; + BinOverride "./indices/override.precise.main.debian-installer"; }; Default { diff --git a/fuel/build/install/install.sh b/fuel/build/install/install.sh index f0bb84914..dbb26d6d5 100755 --- a/fuel/build/install/install.sh +++ b/fuel/build/install/install.sh @@ -122,17 +122,17 @@ prep_make_live() { ssh-copy-id root@$FUELHOST sshfs root@1${FUELHOST}:/ $TMP_HOSTMOUNT - if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then + if [ -f $REPO/dists/precise/main/binary-amd64/Packages.backup ]; then echo "Error - found backup file for Packages!" exit 1 fi - if [ -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then + if [ -f $REPO/dists/precise/main/binary-amd64/Packages.gz.backup ]; then echo "Error - found backup file for Packages.gz!" exit 1 fi - if [ -f $REPO/dists/trusty/Release.backup ]; then + if [ -f $REPO/dists/precise/Release.backup ]; then echo "Error - found backup file for Release!" exit 1 fi @@ -142,24 +142,20 @@ prep_make_live() { exit 1 fi - cp $REPO/dists/trusty/main/binary-amd64/Packages $REPO/dists/trusty/main/binary-amd64/Packages.backup - cp $REPO/dists/trusty/main/binary-amd64/Packages.gz $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup - cp $REPO/dists/trusty/Release $REPO/dists/trusty/Release.backup + cp $REPO/dists/precise/main/binary-amd64/Packages $REPO/dists/precise/main/binary-amd64/Packages.backup + cp $REPO/dists/precise/main/binary-amd64/Packages.gz $REPO/dists/precise/main/binary-amd64/Packages.gz.backup + cp $REPO/dists/precise/Release $REPO/dists/precise/Release.backup cp -Rvp $DEST/etc/puppet $DEST/etc/puppet.backup } post_make_live() { - if [ -d $TOP/release/puppet/modules ]; then - echo "Installing into Puppet:" - cd $TOP/release/puppet/modules - if [ `ls -1 | wc -l` -gt 0 ]; then - for dir in * - do - echo " $dir" - cp -Rp $dir $DEST/etc/puppet/modules - done - fi - fi + echo "Installing into Puppet:" + cd $TOP/release/puppet/modules + for dir in * + do + echo " $dir" + cp -Rp $dir $DEST/etc/puppet/modules + done } make_live() { @@ -214,21 +210,18 @@ iso_copy_puppet() { tar xzf $DEST/puppet-slave.tgz cd $TOP/release/puppet/modules + verify_orig_files $TMP_ISOPUPPET/release/puppet $TOP/release/puppet/modules # Remove all .orig files before copying as they now have been verfied + find $TOP/release/puppet/modules -type f -name '*.orig' -exec rm {} \; - if [ -d $TOP/release/puppet/modules ]; then - if [ `ls -1 | wc -l` -gt 0 ]; then - verify_orig_files $TMP_ISOPUPPET/release/puppet $TOP/release/puppet/modules - find $TOP/release/puppet/modules -type f -name '*.orig' -exec rm {} \; - for dir in $TOP/release/puppet/modules/* - do - echo " $dir" - cp -Rp $dir $TMP_ISOPUPPET/release/puppet - done - fi - fi - + for dir in $TOP/release/puppet/modules/* + do + echo " $dir" + cp -Rp $dir $TMP_ISOPUPPET/release/puppet + done cd $TMP_ISOPUPPET/release/puppet + + tar czf $DEST/puppet-slave.tgz . cd $TOP rm -Rf $TMP_ISOPUPPET @@ -257,7 +250,7 @@ iso_modify_image () { make_iso() { prep_make_iso copy_packages - #iso_copy_puppet + iso_copy_puppet iso_modify_image make_iso_image } @@ -270,8 +263,6 @@ copy_packages() { do echo " $udeb" cp $udeb $REPO/pool/debian-installer - echo "Did not expect a package here, not supported" - exit 1 done cd $TOP/release/packages/ubuntu/pool/main @@ -279,8 +270,6 @@ copy_packages() { do echo " $deb" cp $deb $REPO/pool/main - echo "Did not expect a package here, not supported" - exit 1 done echo "Running Fuel package patch file" @@ -288,8 +277,6 @@ copy_packages() { for line in `cat $TOP/apply_patches | grep -v "^#" | grep -v "^$"`; do echo "Line is $line" - echo "Did not expect a line here, not supported" - exit 1 ref=`echo $line | cut -d '>' -f 1` origpkg=`echo $line| cut -d '>' -f 2` url=`echo $line | cut -d '>' -f 3` @@ -328,11 +315,10 @@ copy_packages() { done printf "Done running Fuel patch file\n\n" + echo "Running add packages file" for line in `cat $TOP/add_opnfv_packages | grep -v "^#" | grep -v "^$"`; do echo "Line is $line" - echo "Did not expect a line here, not supported" - exit 1 ref=`echo $line | cut -d '>' -f 1` origpkg=`echo $line| cut -d '>' -f 2` url=`echo $line | cut -d '>' -f 3` @@ -384,8 +370,6 @@ copy_packages() { printf "\n\n" | tee -a $REPORTFILE for line in `cat $TOP/patch-packages/release/patch-replacements` do - echo "Did not expect a line here, not supported" - exit 1 frompkg=`echo $line | cut -d ">" -f 1` topkg=`echo $line | cut -d ">" -f 2` echo "CM: Applying patch to $frompkg" | tee -a $REPORTFILE @@ -427,19 +411,17 @@ copy_packages() { APT_DEB_CONF="$TOP/install/apt-ftparchive-deb.conf" APT_UDEB_CONF="$TOP/install/apt-ftparchive-udeb.conf" - echo Not running echo apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}" - echo Not running apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}" - echo Not running apt-ftparchive generate "${APT_UDEB_CONF}" - echo Not running apt-ftparchive generate "${APT_UDEB_CONF}" + apt-ftparchive -c "${APT_REL_CONF}" generate "${APT_DEB_CONF}" + apt-ftparchive generate "${APT_UDEB_CONF}" # Fuel also needs this index file - # cat dists/trusty/main/binary-amd64/Packages | \ - # awk '/^Package:/{pkg=$2} - # /^Version:/{print pkg ": \"" $2 "\""}' > ubuntu-versions.yaml - # cp ubuntu-versions.yaml $DEST + cat dists/precise/main/binary-amd64/Packages | \ + awk '/^Package:/{pkg=$2} + /^Version:/{print pkg ": \"" $2 "\""}' > ubuntu-versions.yaml + cp ubuntu-versions.yaml $DEST - # apt-ftparchive -c "${APT_REL_CONF}" release dists/trusty/ > dists/trusty/Release - # gzip -9cf dists/trusty/Release > dists/trusty/Release.gz + apt-ftparchive -c "${APT_REL_CONF}" release dists/precise/ > dists/precise/Release + gzip -9cf dists/precise/Release > dists/precise/Release.gz popd > /dev/null @@ -462,8 +444,6 @@ if [ $MODE = "iso" ]; then NEWISO=$3 VOLUMEID="$4 $5" REPORTFILE="${NEWISO}.txt" - echo "Opening reportfile at $REPORTFILE" - touch $REPORTFILE if [ ! -f $ORIGISO ]; then echo "Can't find original MOS 5.1 iso at $ORIGISO" rm $CONF diff --git a/fuel/build/install/uninstall.sh b/fuel/build/install/uninstall.sh index a9e74bc39..36b888441 100755 --- a/fuel/build/install/uninstall.sh +++ b/fuel/build/install/uninstall.sh @@ -31,17 +31,17 @@ DEST=$MOUNT REPO=$DEST/var/www/nailgun/ubuntu/fuelweb/x86_64 cd $REPO -if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.backup ]; then +if [ ! -f $REPO/dists/precise/main/binary-amd64/Packages.backup ]; then echo "Error - didn't find backup file for Packages!" exit 1 fi -if [ ! -f $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup ]; then +if [ ! -f $REPO/dists/precise/main/binary-amd64/Packages.gz.backup ]; then echo "Error - didn't find backup file for Packages.gz!" exit 1 fi -if [ ! -f $REPO/dists/trusty/Release.backup ]; then +if [ ! -f $REPO/dists/precise/Release.backup ]; then echo "Error - didn't find backup file for Release!" exit 1 fi @@ -71,9 +71,9 @@ cd $REPO echo "Restoring backups of datafiles" -rm -f $REPO/dists/trusty/main/binary-amd64/Packages $REPO/dists/trusty/main/binary-amd64/Packages.gz -rm -f $REPO/dists/trusty/Release $DEST/etc/puppet/manifests/site.pp -mv $REPO/dists/trusty/main/binary-amd64/Packages.backup $REPO/dists/trusty/main/binary-amd64/Packages -mv $REPO/dists/trusty/main/binary-amd64/Packages.gz.backup $REPO/dists/trusty/main/binary-amd64/Packages.gz -mv $REPO/dists/trusty/Release.backup $REPO/dists/trusty/Release +rm -f $REPO/dists/precise/main/binary-amd64/Packages $REPO/dists/precise/main/binary-amd64/Packages.gz +rm -f $REPO/dists/precise/Release $DEST/etc/puppet/manifests/site.pp +mv $REPO/dists/precise/main/binary-amd64/Packages.backup $REPO/dists/precise/main/binary-amd64/Packages +mv $REPO/dists/precise/main/binary-amd64/Packages.gz.backup $REPO/dists/precise/main/binary-amd64/Packages.gz +mv $REPO/dists/precise/Release.backup $REPO/dists/precise/Release mv $DEST/etc/puppet/manifests/site.pp.backup $DEST/etc/puppet/manifests/site.pp diff --git a/fuel/build/opendaylight/Makefile b/fuel/build/opendaylight/Makefile new file mode 100644 index 000000000..bd2eeb5a3 --- /dev/null +++ b/fuel/build/opendaylight/Makefile @@ -0,0 +1,102 @@ +############################################################################## +# 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 +############################################################################## + +############################################################################ +# BEGIN of variables to customize +# +SHELL = /bin/bash + + +BUILD_DIR := $(shell pwd) +GIT_DIR := /tmp +export CONFIG_SPEC_SCRIPT +export MAVEN_OPTS = -Xmx1024m -XX:MaxPermSize=512m +MAINTAINER = "Main Tainer <main.tainer@example.org>" +ODL_SHORT_NAME = odl +ODL_VERSION = 0.1-1 +DEPEND = openjdk-8-jdk +TARGET_BUILD_PATH="/tmp/controller/opendaylight/distribution/opendaylight-karaf/target/" +MAVEN_SPEC = $(BUILD_DIR)/odl_maven/settings.xml + +# +# END of variables to customize +############################################################################# + +.PHONY: all +all: odl + +############################################################################ +# BEGIN of Include definitions +# +include ../config.mk +# +# END Include definitions +############################################################################# + +.PHONY: setup +setup: + rm -f "$(BUILD_BASE)/f_odl" + ln -s "$(shell readlink -e $(BUILD_DIR))/f_odl" "$(shell readlink -e $(BUILD_BASE))/f_odl" + +.PHONY: validate-cache +validate-cache: + @REMOTE_ID=$(shell git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG)^{} | awk '{print $$(NF-1)}'); \ + if [ -z $$REMOTE_ID ] || [ $$REMOTE_ID = " " ]; \ + then \ + REMOTE_ID=$(shell git ls-remote $(ODL_MAIN_REPO) $(ODL_MAIN_TAG) | awk '{print $$(NF-1)}'); \ + fi; \ + if [ $$REMOTE_ID != $(shell cat $(VERSION_FILE) | grep odl | awk '{print $$NF}') ]; \ + then \ + echo "Cache does not match upstream OpenDaylight, cache must be rebuilt!"; \ + exit 1; \ + fi + +.PHONY: odl +odl: + +ifeq ($(ODL_MAIN_REPO),) + @echo "No config-spec target for ODL, nothing to build" +else + +ifeq ($(shell if [ -e .odl-build.log ];then cat .odl-build.log; fi;),$(ODL_MAIN_TAG)) + @cd /tmp && git clone $(ODL_MAIN_REPO) && cd /tmp/controller && git checkout $(ODL_MAIN_TAG) + + @echo "ODL is up to date" +else + @if [ ! -d "/tmp/controller" ]; then\ + cd /tmp && git clone $(ODL_MAIN_REPO);\ + fi; + + @if [ "$(UNIT_TEST)" = "FALSE" ]; then\ + echo "Building ODL without unit test";\ + cd /tmp/controller &&\ + git checkout $(ODL_MAIN_TAG) &&\ + mvn -D maven.test.skip=true -gs $(MAVEN_SPEC) clean install;\ + else\ + echo "Building ODL with unit test";\ + cd /tmp/controller &&\ + git checkout $(ODL_MAIN_TAG) &&\ + mvn -gs $(MAVEN_SPEC) clean install;\ + fi; + + @echo "odl" `git -C /tmp/controller show | grep commit | head -1 | cut -d " " -f2` >> $(VERSION_FILE) + @./make-odl-deb.sh -N $(ODL_SHORT_NAME)_`cd /tmp/controller; git rev-parse --short HEAD` -n $(ODL_SHORT_NAME) -v "$(ODL_VERSION)" -t "$(ODL_MAIN_TAG)" -m $(MAINTAINER) -d $(DEPEND) -p $(TARGET_BUILD_PATH) + @echo $(ODL_MAIN_TAG) > .odl-build.log +endif +endif + +.PHONY: clean $(SUBCLEAN) +clean: $(SUBCLEAN) + @rm -Rf /tmp/controller + @rm -f .odl-build.log + @./make-odl-deb.sh -C + +.PHONY: release +release: diff --git a/fuel/build/opendaylight/README b/fuel/build/opendaylight/README new file mode 100644 index 000000000..7aa392e92 --- /dev/null +++ b/fuel/build/opendaylight/README @@ -0,0 +1,52 @@ +############################################################################## +# 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 directory builds the OpenDaylight debian package by cloning the +opendaylight.org repo, building the odl tag specified in +"fuel-build/config-spec" and constructing a debian package source tree under +"f_odl", which automatically is linked into "fuel_build/." for further build processing. + +The opendaylight has the following structure: +. ++--------+-------------+-----------+ +| | | | +| Makefile make-odl-deb.sh README +| (this file) +| ++----------+----------+ + | | + odl_maven/ f_odl/ + +Makefile: +Invoked by the git root Makefile, it builds the clones the odl repo from +odl, checkout the tag/branch indicated in "fuelbuild/config-spec", builds +odl, and calls "make-odl-deb.sh" to create a debian package source tree. + +make-odl-deb.sh: +Creates the odl debian package source tree in "f_odl" from the odl build +results. + +odl_maven/: +Contains needed control files for maven OpenDaylight build + +f_odl/: +Contains buildscripts and the generated odl debian package source tree produced +by the odl build (make-odl-deb.sh) which is later used by the root build system. + +NOTE on the controller/ git repo clone: +The git controller repo clone Contains all artifacts from the odl build, it only +exists in /tmp inside the build docker container and is not visible anywhere on +the build host + +Note on build caching: +The latest build results are cached, and will not be rebuilt unless the fuel-build/ +config-spec is changed in respect to odl version or if make clean is applied. +./.odl-build.log and ./.odl-build.history are used to keep adequate bookmaking to +track caching and needed cleanout. diff --git a/fuel/build/opendaylight/f_odl/Makefile b/fuel/build/opendaylight/f_odl/Makefile new file mode 100644 index 000000000..f7ebd3e73 --- /dev/null +++ b/fuel/build/opendaylight/f_odl/Makefile @@ -0,0 +1,49 @@ +############################################################################## +# 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 +############################################################################## + +include $(BUILD_BASE)/config.mk +ODL_NAME_SHORT := odl +PACKAGE := odl_$(shell cd /tmp/controller; git rev-parse --short HEAD) +VERSION := 0.1-1 +DEB_NAME := $(PACKAGE)_$(VERSION) + +.PHONY: all +all: release/pool/main/$(DEB_NAME).deb + +release/pool/main/$(DEB_NAME).deb: +ifeq ($(ODL_MAIN_REPO),) + @echo "No config-spec target for ODL, nothing to build" +else + @mkdir -p tmp/src + @mkdir -p release/pool/main + @cp -rp package/$(DEB_NAME) tmp/src + @gzip -f9 tmp/src/$(DEB_NAME)/usr/share/doc/$(ODL_NAME_SHORT)/changelog.Debian + @fakeroot dpkg-deb --build tmp/src/$(DEB_NAME) + @lintian tmp/src/$(DEB_NAME).deb + @cp tmp/src/$(DEB_NAME).deb release/pool/main +endif + +.PHONY: clean +clean: + @rm -rf tmp + @rm -rf release + @rm -f $(DEB_DEST)/$(DEB_NAME).deb + +.PHONY: validate-cache +validate-cache: + @echo "No cache validation schema available for $(shell pwd)" + @echo "Continuing ..." + +.PHONY: release +release:release/pool/main/$(DEB_NAME).deb +ifneq ($(ODL_MAIN_REPO),) + @cp release/pool/main/$(DEB_NAME).deb $(DEB_DEST) + @cp -Rvp puppet/modules/* $(PUPPET_DEST) +endif diff --git a/fuel/build/opendaylight/f_odl/README b/fuel/build/opendaylight/f_odl/README new file mode 100644 index 000000000..077962de4 --- /dev/null +++ b/fuel/build/opendaylight/f_odl/README @@ -0,0 +1,49 @@ +############################################################################## +# 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 directory adds the OpenDaylight (odl) package and related puppet +deployment manifest such that it gets built into the .iso image an deployed +on the stack controller cluster. + +The f_odl has the following structure: +. ++--------+----------+-----------+------------+ + | | | | + puppet/ Makefile README odl_<change_id> + | (this file) /<version> + | | + | odl deb pkg src + modules/ + | + | + | + opnfv/ + | + | + | + manifests/ + | + | + | + odl.pp + +Makefile: +Invoked by the git root Makefile, it builds the odl debian package from the +debian pkg source directory (inside this directory) and pushes it together +with the manifests to the fuel build source artifact directory, such that it +eventually gets built into the new fuel .iso + +odl.pp: +Controls the installation and configuration of odl + +odl deb pkg src: +Is the debian package source directory tree including all needed odl artifacts +and debian pakage meta data. This debian source package tree is built from +fuel-build/opendaylight and doesnt exist before it has bee built. diff --git a/fuel/build/opendaylight/f_odl/puppet/modules/opnfv/manifests/odl.pp b/fuel/build/opendaylight/f_odl/puppet/modules/opnfv/manifests/odl.pp new file mode 100644 index 000000000..6165646ce --- /dev/null +++ b/fuel/build/opendaylight/f_odl/puppet/modules/opnfv/manifests/odl.pp @@ -0,0 +1,13 @@ +class opnfv::odl { + if $::osfamily == 'Debian' { + + + case $::fuel_settings['role'] { + /controller/: { + package { 'odl': + ensure => installed, + } + } + } + } +} diff --git a/fuel/build/opendaylight/f_odl/testing/README b/fuel/build/opendaylight/f_odl/testing/README new file mode 100644 index 000000000..2ef497656 --- /dev/null +++ b/fuel/build/opendaylight/f_odl/testing/README @@ -0,0 +1,12 @@ +############################################################################## +# 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 +############################################################################## + +In order to test the functionality without performing a full deployment, run "puppet apply" on the +fake_init.pp which will call only the opnfv::odl class. diff --git a/fuel/build/opendaylight/f_odl/testing/fake_init.pp b/fuel/build/opendaylight/f_odl/testing/fake_init.pp new file mode 100644 index 000000000..0600d2e0c --- /dev/null +++ b/fuel/build/opendaylight/f_odl/testing/fake_init.pp @@ -0,0 +1,13 @@ +############################################################################## +# 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 +############################################################################## + +$fuel_settings = parseyaml($astute_settings_yaml) + +include opnfv::odl diff --git a/fuel/build/opendaylight/make-odl-deb.sh b/fuel/build/opendaylight/make-odl-deb.sh new file mode 100755 index 000000000..5222087be --- /dev/null +++ b/fuel/build/opendaylight/make-odl-deb.sh @@ -0,0 +1,314 @@ +#!/bin/bash +set -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 +############################################################################## + +############################################################################## +# Default variable declarations + +COMMAND= +PACKAGE_NAME= +PACKAGE_SHORT_NAME= +PACKAGE_VERSION= +TARGET_BUILD_PATH= +DEPENDENCIES= +MAINTAINER= +ARCH="amd64" +BUILD_HISTORY=".odl-build-history" + +############################################################################## +# subroutine: usage +# Description: Prints out usage of this script + +usage () +{ +cat <<EOF +usage: $0 options + +$0 creates a ${PACKAGE_NAME} Debian package + +OPTIONS: + -n Package shoer name + -N Package name + -v Version + -t Tag + -p Target build path, the path where the built tar ball is to be fetched + -m Maintainer + -d Package dependencies + -h Prints this message + -C Clean + +E.g.: $0 -n my/deb/src/dest/path -N my-package -v 1.0-1 -t myTag -p path/to/the/source -m "Main Tainer <main.tainer.exampe.org> -d myJavaDependence +EOF +} + +############################################################################## +# subroutine: clean +# Description: Cleans up all artifacts from earlier builds + +clean () +{ +if [ -e $BUILD_HISTORY ]; then + while read line + do + rm -rf $line + done < $BUILD_HISTORY + rm ${BUILD_HISTORY} + exit 0 +fi +} + +############################################################################## +# make-DEBIAN_control +# Description: constructs the Debian pack control file + +make-DEBIAN_control () +{ +cat <<EOF +Package: $PACKAGE_SHORT_NAME +Version: $PACKAGE_VERSION +Section: base +Priority: optional +Architecture: $ARCH +Depends: $DEPENDENCIES +Maintainer: $MAINTAINER +Description: OpenDaylight deamon + This is a daemon for the opendaylight/odl controller service. +EOF +} + +############################################################################## +# subroutine: make-DEBIAN_conffiles +# Description: Constructs the Debian package config files assignment + +make-DEBIAN_conffiles () +{ +cat <<EOF +/etc/odl/etc/all.policy +/etc/odl/etc/config.properties +/etc/odl/etc/custom.properties +/etc/odl/etc/distribution.info +/etc/odl/etc/equinox-debug.properties +/etc/odl/etc/java.util.logging.properties +/etc/odl/etc/jmx.acl.cfg +/etc/odl/etc/jmx.acl.java.lang.Memory.cfg +/etc/odl/etc/jmx.acl.org.apache.karaf.bundle.cfg +/etc/odl/etc/jmx.acl.org.apache.karaf.config.cfg +/etc/odl/etc/jmx.acl.org.apache.karaf.security.jmx.cfg +/etc/odl/etc/jmx.acl.osgi.compendium.cm.cfg +/etc/odl/etc/jre.properties +/etc/odl/etc/keys.properties +/etc/odl/etc/org.apache.felix.fileinstall-deploy.cfg +/etc/odl/etc/org.apache.karaf.command.acl.bundle.cfg +/etc/odl/etc/org.apache.karaf.command.acl.config.cfg +/etc/odl/etc/org.apache.karaf.command.acl.feature.cfg +/etc/odl/etc/org.apache.karaf.command.acl.jaas.cfg +/etc/odl/etc/org.apache.karaf.command.acl.kar.cfg +/etc/odl/etc/org.apache.karaf.command.acl.shell.cfg +/etc/odl/etc/org.apache.karaf.command.acl.system.cfg +/etc/odl/etc/org.apache.karaf.features.cfg +/etc/odl/etc/org.apache.karaf.features.obr.cfg +/etc/odl/etc/org.apache.karaf.features.repos.cfg +/etc/odl/etc/org.apache.karaf.jaas.cfg +/etc/odl/etc/org.apache.karaf.kar.cfg +/etc/odl/etc/org.apache.karaf.log.cfg +/etc/odl/etc/org.apache.karaf.management.cfg +/etc/odl/etc/org.apache.karaf.shell.cfg +/etc/odl/etc/org.ops4j.pax.logging.cfg +/etc/odl/etc/org.ops4j.pax.url.mvn.cfg +/etc/odl/etc/regions-config.xml +/etc/odl/etc/shell.init.script +/etc/odl/etc/startup.properties +/etc/odl/etc/system.properties +/etc/odl/etc/users.properties +/etc/odl/configuration/context.xml +/etc/odl/configuration/logback.xml +/etc/odl/configuration/tomcat-logging.properties +/etc/odl/configuration/tomcat-server.xml +EOF +} + +############################################################################## +# subroutine: make-DEBIAN_postinst +# Description: Constructs the Debian package post installation script + +make-DEBIAN_postinst () +{ +cat <<EOF +#!/bin/bash -e +ln -s /etc/${PACKAGE_SHORT_NAME}/* ${TARGET_INSTALL_PATH} +echo "OpenDaylight $TAG version $PACKAGE_VERSION has been installed" +EOF +} + +############################################################################## +# subroutine: make-DEBIAN_bin +# Description: Constructs the bin script (normally under /usr/bin) + +make-DEBIAN_bin () +{ +cat <<EOF +#!/bin/bash -e +${TARGET_INSTALL_PATH}bin/karaf $@ +EOF +} + +############################################################################## +# subroutine: make-DEBIAN_copyright +# Description: Constructs the copyright text (normally under /usr/share/doc...) + +make-DEBIAN_copyright () +{ +cat <<EOF +OpenDaylight - an open source SDN controller +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +EOF +} + +############################################################################## +# subroutine: make-DEBIAN_changelog +# Description: Constructs the changelog text (normally under /usr/share/doc...) + +make-DEBIAN_changelog () +{ +cat <<EOF +$PACKAGE_SHORT_NAME ($PACKAGE_VERSION) precise-proposed; urgency=low + + * Derived from $PACKAGE_NAME $PACHAGE_VERSION + + -- $MAINTAINER $(date) +EOF +} + +############################################################################## +# MAIN + +while getopts "N:n:v:d:Chm:t:p:" OPTION +do + case $OPTION in + h) + usage + exit 0 + ;; + + N) + PACKAGE_NAME=$OPTARG + COMMAND+="-N ${PACKAGE_NAME} " + ;; + + n) + PACKAGE_SHORT_NAME=$OPTARG + COMMAND+="-n ${PACKAGE_SHORT_NAME} " + ;; + + v) + PACKAGE_VERSION=$OPTARG + COMMAND+="-v ${PACKAGE_VERSION} " + ;; + + p) + TARGET_BUILD_PATH=$OPTARG + COMMAND+="-p ${TARGET_BUILD_PATH} " + ;; + + t) + TAG=$OPTARG + COMMAND+="-t ${TAG} " + ;; + + m) + MAINTAINER=$OPTARG + COMMAND+="-m ${MAINTAINER} " + ;; + + d) + DEPENDENCIES=$OPTARG + COMMAND+="-d ${DEPENDENCIES} " + ;; + + A) + ARCH=$OPTARG + COMMAND+="-A ${ARCH} " + ;; + + C) + COMMAND+="-C " + clean + exit 0 + ;; + esac +done + +# Constructing script variables +DEB_PACK_BASE_PATH="f_${PACKAGE_SHORT_NAME}/package/${PACKAGE_NAME}_${PACKAGE_VERSION}" +echo ${DEB_PACK_BASE_PATH} >> "$BUILD_HISTORY" +TARGET_INSTALL_PATH="/usr/share/java/${PACKAGE_SHORT_NAME}/" +DEB_PACK_CONTENT_PATH="${DEB_PACK_BASE_PATH}/usr/share/java/${PACKAGE_SHORT_NAME}/" +DEB_PACK_CONFIG_PATH="${DEB_PACK_BASE_PATH}/etc/${PACKAGE_SHORT_NAME}" +TARGET_TAR=$(ls ${TARGET_BUILD_PATH}*.tar.gz) +TARGET_TAR="${TARGET_TAR##*/}" +TAR_PATH="${TARGET_TAR%.*}" +TAR_PATH="${TAR_PATH%.*}" +if [ -e $DEB_PACK_BASE_PATH ]; then + rm -R $DEB_PACK_BASE_PATH +fi + +# Create Deb pack content and configuration +mkdir -p ${DEB_PACK_CONTENT_PATH} +cp ${TARGET_BUILD_PATH}${TARGET_TAR} ${DEB_PACK_CONTENT_PATH} +tar -xzf ${DEB_PACK_CONTENT_PATH}${TARGET_TAR} -C ${DEB_PACK_CONTENT_PATH} +rm ${DEB_PACK_CONTENT_PATH}${TARGET_TAR} +mv ${DEB_PACK_CONTENT_PATH}${TAR_PATH}/* ${DEB_PACK_CONTENT_PATH}. +rm -R ${DEB_PACK_CONTENT_PATH}${TAR_PATH} + +# Crate and populate Deb pack config target +mkdir -p ${DEB_PACK_CONFIG_PATH}/etc +mv ${DEB_PACK_CONTENT_PATH}etc/* ${DEB_PACK_CONFIG_PATH}/etc/ +rm -R ${DEB_PACK_CONTENT_PATH}etc +mkdir -p ${DEB_PACK_CONFIG_PATH}/configuration +mv ${DEB_PACK_CONTENT_PATH}configuration/* ${DEB_PACK_CONFIG_PATH}/configuration/ +rm -R ${DEB_PACK_CONTENT_PATH}configuration + +# Set package permisions +find ${DEB_PACK_CONTENT_PATH} -type d -print -exec chmod 755 {} \; +find ${DEB_PACK_CONFIG_PATH}/etc/ -type f -print -exec chmod 644 {} \; +find ${DEB_PACK_CONFIG_PATH}/etc/ -type d -print -exec chmod 755 {} \; + +# Create package usr/bin odl script +mkdir "${DEB_PACK_BASE_PATH}/usr/bin" +chmod 755 "${DEB_PACK_BASE_PATH}/usr/bin" +make-DEBIAN_bin > "${DEB_PACK_BASE_PATH}/usr/bin/odl" +chmod 755 "${DEB_PACK_BASE_PATH}/usr/bin/odl" + +# Create Deb pack install meta-data +mkdir "${DEB_PACK_BASE_PATH}/DEBIAN" +make-DEBIAN_control > "${DEB_PACK_BASE_PATH}/DEBIAN/control" +make-DEBIAN_conffiles > "${DEB_PACK_BASE_PATH}/DEBIAN/conffiles" +mkdir -p "${DEB_PACK_BASE_PATH}/usr/share/doc/${PACKAGE_SHORT_NAME}" +make-DEBIAN_copyright > "${DEB_PACK_BASE_PATH}/usr/share/doc/${PACKAGE_SHORT_NAME}/copyright" +make-DEBIAN_changelog > "${DEB_PACK_BASE_PATH}/usr/share/doc/${PACKAGE_SHORT_NAME}/changelog.Debian" + +# Create Deb pack post install symlinks and usr/bin scripts +make-DEBIAN_postinst > "${DEB_PACK_BASE_PATH}/DEBIAN/postinst" +chmod 755 "${DEB_PACK_BASE_PATH}/DEBIAN/postinst" +mkdir -p "${DEB_PACK_BASE_PATH}/usr/bin" diff --git a/fuel/build/opendaylight/odl_maven/settings.xml b/fuel/build/opendaylight/odl_maven/settings.xml new file mode 100644 index 000000000..35a444264 --- /dev/null +++ b/fuel/build/opendaylight/odl_maven/settings.xml @@ -0,0 +1,46 @@ +<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> + + <profiles> + <profile> + <id>opendaylight-release</id> + <repositories> + <repository> + <releases> + <enabled>true</enabled> + <updatePolicy>never</updatePolicy> + </releases> + <snapshots> + <enabled>false</enabled> + </snapshots> + <id>opendaylight-mirror</id> + <name>opendaylight-mirror</name> + <url>http://nexus.opendaylight.org/content/groups/public/</url> + </repository> + </repositories> + </profile> + + <profile> + <id>opendaylight-snapshots</id> + <repositories> + <repository> + <releases> + <enabled>false</enabled> + </releases> + <snapshots> + <enabled>true</enabled> + </snapshots> + <id>opendaylight-snapshot</id> + <name>opendaylight-snapshot</name> + <url>http://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url> + </repository> + </repositories> + </profile> + </profiles> + + <activeProfiles> + <activeProfile>opendaylight-release</activeProfile> + <activeProfile>opendaylight-snapshots</activeProfile> + </activeProfiles> +</settings> diff --git a/fuel/build/patch-packages/Makefile b/fuel/build/patch-packages/Makefile index 339c9e7cf..bd3a43717 100644 --- a/fuel/build/patch-packages/Makefile +++ b/fuel/build/patch-packages/Makefile @@ -8,7 +8,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -SUBDIRS := +SUBDIRS := debootstrap novnc neutron-common SUBCLEAN = $(addsuffix .clean,$(SUBDIRS)) .PHONY: $(SUBDIRS) $(SUBCLEAN) clean diff --git a/fuel/build/patch-packages/debootstrap/Makefile b/fuel/build/patch-packages/debootstrap/Makefile new file mode 100644 index 000000000..010931225 --- /dev/null +++ b/fuel/build/patch-packages/debootstrap/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: + +.PHONY: clean +clean: + @rm -rf udebPackage + @rm -rf *.udeb + @rm -rf patch-replacements + @rm -rf .udebpackage + +.PHONY: release +release: + ../tools/udeb_unpack debootstrap-udeb_1.0.4*.udeb $(ORIGISO) + patch -s -p0 < debootstrap.patch + ../tools/udeb_pack $(REVSTATE) + @cp *.udeb $(UDEB_DEST) diff --git a/fuel/build/patch-packages/debootstrap/debootstrap.patch b/fuel/build/patch-packages/debootstrap/debootstrap.patch new file mode 100644 index 000000000..62342c96c --- /dev/null +++ b/fuel/build/patch-packages/debootstrap/debootstrap.patch @@ -0,0 +1,12 @@ +--- udebPackage/usr/share/debootstrap/scripts/gutsy.orig 2014-11-10 18:21:37.000000000 +0000 ++++ udebPackage/usr/share/debootstrap/scripts/gutsy 2015-04-15 09:28:44.290437000 +0000 +@@ -112,7 +112,8 @@ + + p; progress $baseprog $bases INSTCORE "Installing core packages" #2 + ln -sf mawk "$TARGET/usr/bin/awk" +- x_core_install base-files base-passwd ++ x_core_install base-passwd ++ x_core_install base-files + p; progress $baseprog $bases INSTCORE "Installing core packages" #3 + x_core_install dpkg + diff --git a/fuel/build/patch-packages/neutron-common/Makefile b/fuel/build/patch-packages/neutron-common/Makefile new file mode 100644 index 000000000..e9d43a4c0 --- /dev/null +++ b/fuel/build/patch-packages/neutron-common/Makefile @@ -0,0 +1,19 @@ +TOP := $(shell pwd) + +.PHONY: all +all: + +.PHONY: clean +clean: + @rm -rf package + @rm -rf *.deb + @rm -rf patch-replacements + @rm -rf .package + +.PHONY: release +release: + ../tools/deb_unpack neutron-common_*.deb $(ORIGISO) + patch -s -p0 < quota.patch + ../tools/deb_pack $(REVSTATE) + @cp *.deb ../release/packages + @cat patch-replacements >> ../release/patch-replacements diff --git a/fuel/build/patch-packages/neutron-common/quota.patch b/fuel/build/patch-packages/neutron-common/quota.patch new file mode 100644 index 000000000..6f179f0ab --- /dev/null +++ b/fuel/build/patch-packages/neutron-common/quota.patch @@ -0,0 +1,67 @@ +*** package/etc/neutron/neutron.conf.orig 2015-05-25 15:50:09.933131041 +0200 +--- package/etc/neutron/neutron.conf 2015-05-25 15:55:07.859210010 +0200 +*************** +*** 502,518 **** + # default_quota = -1 + + # Number of networks allowed per tenant. A negative value means unlimited. +! # quota_network = 10 + + # Number of subnets allowed per tenant. A negative value means unlimited. +! # quota_subnet = 10 + + # Number of ports allowed per tenant. A negative value means unlimited. + # quota_port = 50 + + # Number of security groups allowed per tenant. A negative value means + # unlimited. +! # quota_security_group = 10 + + # Number of security group rules allowed per tenant. A negative value means + # unlimited. +--- 502,521 ---- + # default_quota = -1 + + # Number of networks allowed per tenant. A negative value means unlimited. +! # This quota modified by OPNFV: 10 -> 50 +! quota_network = 50 + + # Number of subnets allowed per tenant. A negative value means unlimited. +! # This quota modified by OPNFV: 10 -> 50 +! quota_subnet = 50 + + # Number of ports allowed per tenant. A negative value means unlimited. + # quota_port = 50 + + # Number of security groups allowed per tenant. A negative value means + # unlimited. +! # This quota modified by OPNFV: 10 -> 50 +! quota_security_group = 50 + + # Number of security group rules allowed per tenant. A negative value means + # unlimited. +*************** +*** 538,547 **** + # quota_health_monitor = -1 + + # Number of routers allowed per tenant. A negative value means unlimited. +! # quota_router = 10 + + # Number of floating IPs allowed per tenant. A negative value means unlimited. +! # quota_floatingip = 50 + + # Number of firewalls allowed per tenant. A negative value means unlimited. + # quota_firewall = 1 +--- 541,552 ---- + # quota_health_monitor = -1 + + # Number of routers allowed per tenant. A negative value means unlimited. +! # This quota modified by OPNFV: 10 -> 50 +! quota_router = 50 + + # Number of floating IPs allowed per tenant. A negative value means unlimited. +! # This quota modified by OPNFV: 50 -> 100 +! quota_floatingip = 100 + + # Number of firewalls allowed per tenant. A negative value means unlimited. + # quota_firewall = 1 diff --git a/fuel/build/patch-packages/novnc/Makefile b/fuel/build/patch-packages/novnc/Makefile new file mode 100644 index 000000000..16c0196e9 --- /dev/null +++ b/fuel/build/patch-packages/novnc/Makefile @@ -0,0 +1,22 @@ +# This is a temporary patch which add missing files +# inside novnc ubuntu package. +# Related bug: https://bugs.launchpad.net/fuel/+bug/1433894 +TOP := $(shell pwd) + +.PHONY: all +all: + +.PHONY: clean +clean: + @rm -rf package + @rm -rf *.deb + @rm -rf patch-replacements + @rm -rf .package + +.PHONY: release +release: + ../tools/deb_unpack novnc_0.5.1*.deb $(ORIGISO) + ./fix-missing.sh + ../tools/deb_pack $(REVSTATE) + @cp *.deb ../release/packages + @cat patch-replacements >> ../release/patch-replacements diff --git a/fuel/build/patch-packages/novnc/fix-missing.sh b/fuel/build/patch-packages/novnc/fix-missing.sh new file mode 100755 index 000000000..61ef1db14 --- /dev/null +++ b/fuel/build/patch-packages/novnc/fix-missing.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +MISSING_FILES="keyboard.js keysymdef.js keysym.js" +NOVNC_SOURCE="http://raw.githubusercontent.com/kanaka/noVNC/v0.5.1/include" + +for file in $MISSING_FILES +do + wget -P package/usr/share/novnc/include/ "$NOVNC_SOURCE/$file" +done |