X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=build%2Fundercloud.sh;h=551dbd8847d2325895d4925f52e88def929f9e5b;hb=1fd700e613e2863038479081e8dca5b268fab241;hp=f39ee73f5375c79bbb61f64e7ad34d2adfce23f0;hpb=8a68db21c4780ac22ffe61b27779c9fd729edc4b;p=apex.git diff --git a/build/undercloud.sh b/build/undercloud.sh index f39ee73f..551dbd88 100755 --- a/build/undercloud.sh +++ b/build/undercloud.sh @@ -13,26 +13,73 @@ source ./variables.sh populate_cache "$rdo_images_uri/undercloud.qcow2" if [ ! -d images ]; then mkdir images/; fi -cp -f cache/undercloud.qcow2 images/ +cp -f cache/undercloud.qcow2 images/undercloud_build.qcow2 #Adding OpenStack packages to undercloud pushd images > /dev/null +# Use apex tripleo-heat-templates fork +PR_NUMBER="" +REF="stable/colorado" +REPO="https://github.com/trozet/opnfv-tht" + +if git log -1 | grep 'opnfv-tht-pr:' | grep -o '[0-9]*'; then + PR_NUMBER=$(git log -1 | grep 'opnfv-tht-pr:' | grep -o '[0-9]*') +fi + +if [ "$PR_NUMBER" != "" ]; then + echo "Using pull request $PR_NUMBER from $REPO" + # Source credentials since we are rate limited to 60/day + GHCREDS="" + if [ -f ~/.githubcreds ]; then + source ~/.githubcreds + GHCREDS=" -u $GHUSERNAME:$GHACCESSTOKEN" + fi + + PR=$(curl $GHCREDS https://api.github.com/repos/trozet/opnfv-tht/pulls/$PR_NUMBER) + + # Do not pull from merged branches + MERGED=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['merged']") + if [ "$MERGED" == "False" ]; then + REF=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['ref']") + echo "Setting GitHub Ref to: $REF" + REPO=$(python -c "import json; print json.loads('''$PR'''.replace('\n', '').replace('\r', ''))['head']['repo']['clone_url']") + echo "Setting GitHub URL to: $REPO" + fi +fi + +rm -rf opnfv-tht +git clone $REPO -b $REF opnfv-tht + +pushd opnfv-tht > /dev/null +git archive --format=tar.gz --prefix=openstack-tripleo-heat-templates/ HEAD > ../opnfv-tht.tar.gz +popd > /dev/null +LIBGUESTFS_BACKEND=direct virt-customize --upload opnfv-tht.tar.gz:/usr/share \ + --run-command "cd /usr/share && rm -rf openstack-tripleo-heat-templates && tar xzf opnfv-tht.tar.gz" \ + -a undercloud_build.qcow2 + # install the packages above and enabling ceph to live on the controller # OpenWSMan package update supports the AMT Ironic driver for the TealBox LIBGUESTFS_BACKEND=direct virt-customize \ --run-command "sed -i '/ControllerEnableCephStorage/c\\ ControllerEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \ - --run-command "sed -i '/ \$enable_ceph = /c\\ \$enable_ceph = true' /usr/share/openstack-tripleo-heat-templates/puppet/manifests/overcloud_controller_pacemaker.pp" \ - --run-command "sed -i '/ \$enable_ceph = /c\\ \$enable_ceph = true' /usr/share/openstack-tripleo-heat-templates/puppet/manifests/overcloud_controller.pp" \ + --run-command "sed -i '/ComputeEnableCephStorage/c\\ ComputeEnableCephStorage: true' /usr/share/openstack-tripleo-heat-templates/environments/storage-environment.yaml" \ --run-command "curl http://download.opensuse.org/repositories/Openwsman/CentOS_CentOS-7/Openwsman.repo > /etc/yum.repos.d/wsman.repo" \ --run-command "yum update -y openwsman*" \ --run-command "cp /usr/share/instack-undercloud/undercloud.conf.sample /home/stack/undercloud.conf && chown stack:stack /home/stack/undercloud.conf" \ --upload ../opnfv-environment.yaml:/home/stack/ \ - -a undercloud.qcow2 + --upload ../virtual-environment.yaml:/home/stack/ \ + -a undercloud_build.qcow2 -# Patch in OpenDaylight installation and configuration -#LIBGUESTFS_BACKEND=direct virt-customize --upload ../opnfv-tripleo-heat-templates.patch:/tmp \ -# --run-command "cd /usr/share/openstack-tripleo-heat-templates/ && patch -Np1 < /tmp/opnfv-tripleo-heat-templates.patch" \ -# -a undercloud.qcow2 -popd > /dev/null +# Add custom IPA to allow kernel params +wget https://raw.githubusercontent.com/trozet/ironic-python-agent/opnfv_kernel/ironic_python_agent/extensions/image.py +python3.4 -c 'import py_compile; py_compile.compile("image.py", cfile="image.pyc")' +# Add performance image scripts +LIBGUESTFS_BACKEND=direct virt-customize --upload ../build_perf_image.sh:/home/stack \ + --upload ../set_perf_images.sh:/home/stack \ + --upload image.py:/root \ + --upload image.pyc:/root \ + -a undercloud_build.qcow2 + +mv -f undercloud_build.qcow2 undercloud.qcow2 +popd > /dev/null