Merge "nosdn fdio scenario fixes"
[apex.git] / build / overcloud-full.sh
1 #!/bin/sh
2 ##############################################################################
3 # Copyright (c) 2015 Tim Rozet (Red Hat), Dan Radez (Red Hat) and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -xe
11 source ./cache.sh
12 source ./variables.sh
13 source ./functions.sh
14
15 populate_cache "$rdo_images_uri/overcloud-full.tar"
16
17 if [ ! -d ${BUILD_DIR} ]; then mkdir ${BUILD_DIR}; fi
18 tar -xf ${CACHE_DIR}/overcloud-full.tar -C ${BUILD_DIR}/
19 mv -f ${BUILD_DIR}/overcloud-full.qcow2 ${BUILD_DIR}/overcloud-full_build.qcow2
20
21 ##########################################################
22 #####  Prep initial overcloud image with common deps #####
23 ##########################################################
24
25 pushd ${BUILD_DIR} > /dev/null
26
27 # prep opnfv-puppet-tripleo for undercloud
28 clone_fork opnfv-puppet-tripleo
29 pushd opnfv-puppet-tripleo > /dev/null
30 git archive --format=tar.gz --prefix=tripleo/ HEAD > ${BUILD_DIR}/opnfv-puppet-tripleo.tar.gz
31 popd > /dev/null
32
33 # download customized os-net-config
34 clone_fork os-net-config
35 pushd os-net-config/os_net_config > /dev/null
36 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ${BUILD_DIR}/os-net-config.tar.gz
37 popd > /dev/null
38
39 dpdk_pkg_str=''
40 for package in ${dpdk_rpms[@]}; do
41   wget "$dpdk_uri_base/$package"
42   dpdk_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/dpdk_rpms"
43 done
44
45 # tar up the congress puppet module
46 rm -rf puppet-congress
47 git clone https://github.com/openstack/puppet-congress
48 pushd puppet-congress > /dev/null
49 git archive --format=tar.gz --prefix=congress/ HEAD > ${BUILD_DIR}/puppet-congress.tar.gz
50 popd > /dev/null
51
52 # tar up the fd.io module
53 rm -rf puppet-fdio
54 git clone https://git.fd.io/puppet-fdio
55 pushd puppet-fdio > /dev/null
56 git archive --format=tar.gz --prefix=fdio/ HEAD > ${BUILD_DIR}/puppet-fdio.tar.gz
57 popd > /dev/null
58
59 # tar up vsperf
60 rm -rf vsperf vsperf.tar.gz
61 git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf
62 tar czf vsperf.tar.gz vsperf
63
64 # tar up the tacker puppet module
65 rm -rf puppet-tacker
66 git clone https://github.com/openstack/puppet-tacker
67 pushd puppet-tacker > /dev/null
68 git archive --format=tar.gz --prefix=tacker/ origin/stable/ocata > ${BUILD_DIR}/puppet-tacker.tar.gz
69 popd > /dev/null
70
71 # Master FD.IO Repo
72 cat > ${BUILD_DIR}/fdio.repo << EOF
73 [fdio-master]
74 name=fd.io master branch latest merge
75 baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/
76 enabled=1
77 gpgcheck=0
78 EOF
79
80 # Get Real Time Kernel from kvm4nfv
81 populate_cache $kvmfornfv_uri_base/$kvmfornfv_kernel_rpm
82
83 # ODL/FDIO packages frozen for L3 scenarios
84 fdio_l3_pkg_str=''
85 for package in ${fdio_l3_pkgs[@]}; do
86   wget "$fdio_l3_uri_base/$package"
87   fdio_l3_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/fdio_l3/"
88 done
89
90 # ODL/FDIO packages frozen for L2 scenarios
91 fdio_l2_pkg_str=''
92 for package in ${fdio_l2_pkgs[@]}; do
93   wget "$fdio_l2_uri_base/$package"
94   fdio_l2_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/fdio_l2/"
95 done
96
97 # FDIO packages frozen for nosdn scenarios
98 fdio_nosdn_pkg_str=''
99 for package in ${fdio_nosdn_pkgs[@]}; do
100   wget "$fdio_nosdn_uri_base/$package"
101   fdio_nosdn_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/fdio_nosdn/"
102 done
103
104 # Increase disk size by 900MB to accommodate more packages
105 qemu-img resize overcloud-full_build.qcow2 +900MB
106
107 # expand file system to max disk size
108 # installing forked opnfv-puppet-tripleo
109 # upload dpdk rpms but do not install
110 # install the congress rpms
111 # upload and explode the congress puppet module
112 # install fd.io yum repo and packages
113 # upload puppet fdio
114 # git clone vsperf into the overcloud image
115 # upload the tacker puppet module and untar it
116 # install tacker
117 # upload the rt_kvm kernel
118 LIBGUESTFS_BACKEND=direct virt-customize \
119     --run-command "xfs_growfs /dev/sda" \
120     --upload ${BUILD_DIR}/opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
121     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
122     --run-command "yum update -y python-ipaddress rabbitmq-server erlang*" \
123     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
124     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
125     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
126     --run-command "mkdir /root/dpdk_rpms" \
127     --upload ${BUILD_DIR}/fdio.repo:/etc/yum.repos.d/fdio.repo \
128     $dpdk_pkg_str \
129     --run-command "mkdir /root/fdio_l3" \
130     --run-command "mkdir /root/fdio_l2" \
131     --run-command "mkdir /root/fdio_nosdn" \
132     --upload ${BUILD_DIR}/noarch/$netvpp_pkg:/root/fdio_nosdn \
133     $fdio_l3_pkg_str \
134     $fdio_l2_pkg_str \
135     $fdio_nosdn_pkg_str \
136     --run-command "yum install -y /root/fdio_l2/*.rpm" \
137     --run-command "yum install -y etcd" \
138     --install python-etcd \
139     --run-command "puppet module install cristifalcas/etcd" \
140     --run-command "yum update -y puppet" \
141     --install "centos-release-qemu-ev" \
142     --run-command "yum install -y qemu-kvm-ev-2.3.0-31.el7_2.21.1.x86_64" \
143     --run-command "yum remove -y qemu-system-x86" \
144     --upload ${BUILD_DIR}/os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
145     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf os-net-config.tar.gz" \
146     --upload ${BUILD_DIR}/noarch/$congress_pkg:/root/ \
147     --install /root/$congress_pkg \
148     --install "python2-congressclient" \
149     --upload ${BUILD_DIR}/puppet-congress.tar.gz:/etc/puppet/modules/ \
150     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-congress.tar.gz" \
151     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
152     --install unzip \
153     --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \
154     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
155     --upload ${BUILD_DIR}/vsperf.tar.gz:/var/opt \
156     --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \
157     --upload ${BUILD_DIR}/puppet-tacker.tar.gz:/etc/puppet/modules/ \
158     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-tacker.tar.gz" \
159     --upload ${BUILD_DIR}/noarch/$tacker_pkg:/root/ \
160     --install /root/$tacker_pkg \
161     --upload ${BUILD_DIR}/noarch/$tackerclient_pkg:/root/ \
162     --install /root/$tackerclient_pkg \
163     --run-command "curl -f https://copr.fedorainfracloud.org/coprs/leifmadsen/ovs-master/repo/epel-7/leifmadsen-ovs-master-epel-7.repo > /etc/yum.repos.d/leifmadsen-ovs-master-epel-7.repo" \
164     --run-command "mkdir /root/ovs27" \
165     --run-command "yumdownloader --destdir=/root/ovs27 openvswitch*2.7* python-openvswitch-2.7*" \
166     --run-command "pip install python-senlinclient" \
167     --run-command "sed -i -E 's/timeout=[0-9]+/timeout=60/g' /usr/share/openstack-puppet/modules/rabbitmq/lib/puppet/provider/rabbitmqctl.rb" \
168     --upload ${BUILD_ROOT}/patches/puppet-neutron-add-odl-settings.patch:/usr/share/openstack-puppet/modules/neutron/ \
169     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 <  puppet-neutron-add-odl-settings.patch" \
170     --upload ${CACHE_DIR}/$kvmfornfv_kernel_rpm:/root/ \
171     --upload ${BUILD_ROOT}/patches/puppet-neutron-vpp-ml2.patch:/usr/share/openstack-puppet/modules/neutron/ \
172     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 <  puppet-neutron-vpp-ml2.patch" \
173     -a overcloud-full_build.qcow2
174
175 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
176 popd > /dev/null