removing the rabbitmq package installed from dropbox
[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 -e
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 images/ ]; then mkdir images; fi
18 tar -xf cache/overcloud-full.tar -C images/
19 mv -f images/overcloud-full.qcow2 images/overcloud-full_build.qcow2
20
21 # Add extra space to the overcloud image
22 qemu-img resize images/overcloud-full_build.qcow2 +1G
23 LIBGUESTFS_BACKEND=direct virt-customize -a images/overcloud-full_build.qcow2 \
24                                          --run-command 'resize2fs /dev/sda'
25
26 ##########################################################
27 #####  Prep initial overcloud image with common deps #####
28 ##########################################################
29
30 # prep opnfv-puppet-tripleo for undercloud
31 clone_fork opnfv-puppet-tripleo
32 pushd opnfv-puppet-tripleo > /dev/null
33 git archive --format=tar.gz --prefix=tripleo/ HEAD > ../opnfv-puppet-tripleo.tar.gz
34 popd > /dev/null
35
36 # download customized os-net-config
37 rm -fr os-net-config
38 git clone https://github.com/trozet/os-net-config.git -b stable/colorado
39 pushd os-net-config > /dev/null
40 pushd os_net_config > /dev/null
41 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ../../os-net-config.tar.gz
42 popd > /dev/null
43 popd > /dev/null
44
45 pushd images > /dev/null
46
47 dpdk_pkg_str=''
48 for package in ${dpdk_rpms[@]}; do
49   wget "$dpdk_uri_base/$package"
50   dpdk_pkg_str+=" --upload $package:/root/dpdk_rpms"
51 done
52
53 fdio_pkg_str=''
54 for package in ${fdio_pkgs[@]}; do
55   wget "$fdio_uri_base/$package"
56   fdio_pkg_str+=" --upload $package:/root/fdio"
57 done
58
59 # tar up the congress puppet module
60 rm -rf puppet-congress
61 git clone -b stable/mitaka https://github.com/radez/puppet-congress
62 pushd puppet-congress > /dev/null
63 git archive --format=tar.gz --prefix=congress/ origin/stable/mitaka > ../puppet-congress.tar.gz
64 popd > /dev/null
65
66 # create fd.io yum repo file
67 #cat > /tmp/fdio-master.repo << EOF
68 #[fdio-master]
69 #name=fd.io master branch latest merge
70 #baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/
71 #enabled=1
72 #gpgcheck=0
73 #EOF
74
75 # tar up the fd.io module
76 rm -rf puppet-fdio
77 git clone https://github.com/radez/puppet-fdio
78 pushd puppet-fdio > /dev/null
79 git archive --format=tar.gz --prefix=fdio/ HEAD > ../puppet-fdio.tar.gz
80 popd > /dev/null
81
82 # tar up vsperf
83 rm -rf vsperf vsperf.tar.gz
84 git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf
85 tar czf vsperf.tar.gz vsperf
86
87 # tar up the tacker puppet module
88 rm -rf puppet-tacker
89 # TODO move this back to radez puppet-tacker after PR is accepted
90 git clone -b fix_db_sync https://github.com/trozet/puppet-tacker
91 pushd puppet-tacker > /dev/null
92 git archive --format=tar.gz --prefix=tacker/ HEAD > ../puppet-tacker.tar.gz
93 popd > /dev/null
94
95 # installing forked opnfv-puppet-tripleo
96 # enable connection tracking for protocal sctp
97 # upload dpdk rpms but do not install
98 # enable connection tracking for protocal sctp
99 # install the congress rpms
100 # upload and explode the congress puppet module
101 # install doctor driver ## Can be removed in Newton
102 # install fd.io yum repo and packages
103 # upload puppet fdio
104 # git clone vsperf into the overcloud image
105 # upload the tacker puppet module and untar it
106 LIBGUESTFS_BACKEND=direct virt-customize \
107     --upload ../opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
108     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
109     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
110     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
111     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
112     --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
113     --run-command "mkdir /root/dpdk_rpms" \
114     --run-command "mkdir /root/fdio" \
115     $dpdk_pkg_str \
116     $fdio_pkg_str \
117     --upload ../networking-vpp.noarch.rpm:/root/fdio \
118     --run-command "pip install distro flask_restful" \
119     --run-command "yum install -y etcd" \
120     --run-command "pip install python-etcd" \
121     --install "centos-release-qemu-ev" \
122     --run-command "yum update -y" \
123     --run-command "yum remove -y qemu-system-x86" \
124     --upload ../os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
125     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf os-net-config.tar.gz" \
126     --upload ../noarch/openstack-congress-2016.1-1.el7.centos.noarch.rpm:/root/ \
127     --install /root/openstack-congress-2016.1-1.el7.centos.noarch.rpm \
128     --install "python2-congressclient" \
129     --upload puppet-congress.tar.gz:/etc/puppet/modules/ \
130     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-congress.tar.gz" \
131     --run-command "cd /usr/lib/python2.7/site-packages/congress/datasources && curl -O $doctor_driver" \
132     --run-command "sed -i \"s/'--detailed-exitcodes',/'--detailed-exitcodes','-l','syslog','-l','console',/g\" /var/lib/heat-config/hooks/puppet" \
133     --run-command "yum install -y /root/fdio/*.rpm" \
134     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
135     --run-command "tar zxvf /root/fdio/vpp_papi*.tar.gz -C /" \
136     --install unzip \
137     --upload puppet-fdio.tar.gz:/etc/puppet/modules \
138     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
139     --upload vsperf.tar.gz:/var/opt \
140     --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \
141     --upload ../noarch/python-tackerclient-2015.2-1.trozet.noarch.rpm:/root/ \
142     --install /root/python-tackerclient-2015.2-1.trozet.noarch.rpm \
143     --upload ../noarch/openstack-tacker-2015.2-1.trozet.noarch.rpm:/root/ \
144     --install /root/openstack-tacker-2015.2-1.trozet.noarch.rpm \
145     --upload puppet-tacker.tar.gz:/etc/puppet/modules/ \
146     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-tacker.tar.gz" \
147     --run-command "pip install python-senlinclient" \
148     --upload ../neutron/agent/interface/interface.py:/usr/lib/python2.7/site-packages/neutron/agent/linux/ \
149     --run-command "mkdir /root/fdio_neutron_l3" \
150     --upload ../neutron/agent/l3/namespaces.py:/root/fdio_neutron_l3/ \
151     --upload ../neutron/agent/l3/router_info.py:/root/fdio_neutron_l3/ \
152     --upload ../puppet-neutron/manifests/agents/ml2/networking-vpp.pp:/etc/puppet/modules/neutron/manifests/agents/ml2/ \
153     --upload ../puppet-neutron/manifests/plugins/ml2/networking-vpp.pp:/etc/puppet/modules/neutron/manifests/plugins/ml2/ \
154     -a overcloud-full_build.qcow2
155
156 rm -rf ovs_nsh_patches
157 rm -rf ovs
158 git clone https://github.com/yyang13/ovs_nsh_patches.git
159 git clone https://github.com/openvswitch/ovs.git
160 pushd ovs > /dev/null
161 git reset --hard 7d433ae57ebb90cd68e8fa948a096f619ac4e2d8
162 cp ../ovs_nsh_patches/*.patch ./
163 # Hack for build servers that have no git config
164 git config user.email "apex@opnfv.com"
165 git config user.name "apex"
166 git am *.patch
167 popd > /dev/null
168 tar czf ovs.tar.gz ovs
169
170 # Required packages to redirect stdin with virt-customize
171 virt_pkg_str="./$libguestfs_pkg "
172 wget $virt_uri_base/$libguestfs_pkg
173 for package in ${virt_pkgs[@]}; do
174   wget "$virt_uri_base/$package"
175   virt_pkg_str+=" ./$package"
176 done
177
178 if ! sudo yum -y install ${virt_pkg_str}; then
179   if [ "$(rpm -q libguestfs)" != "$(rpm -qpf $libguestfs_pkg)" ]; then
180     echo "ERROR: Failed to update libguestfs"
181     exit 1
182   fi
183 fi
184
185
186
187 # BUILD NSH OVS
188 LIBGUESTFS_BACKEND=direct virt-customize \
189     --upload ../build_ovs_nsh.sh:/root/ \
190     --upload ovs.tar.gz:/root/ \
191     --run-command "cd /root/ && tar xzf ovs.tar.gz" \
192     --run-command "cd /root/ovs && /root/build_ovs_nsh.sh" \
193     -a overcloud-full_build.qcow2
194
195 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
196 popd > /dev/null