8ec7af6b197f1b76f8e7763c84e9741bc0321aa6
[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 # replace repo with latest delorean mitaka
96 wget https://trunk.rdoproject.org/centos7-mitaka/current-passed-ci/delorean.repo
97
98 # installing forked opnfv-puppet-tripleo
99 # enable connection tracking for protocal sctp
100 # upload dpdk rpms but do not install
101 # enable connection tracking for protocal sctp
102 # install the congress rpms
103 # upload and explode the congress puppet module
104 # install doctor driver ## Can be removed in Newton
105 # install fd.io yum repo and packages
106 # upload puppet fdio
107 # git clone vsperf into the overcloud image
108 # upload the tacker puppet module and untar it
109 LIBGUESTFS_BACKEND=direct virt-customize \
110     --upload delorean.repo:/etc/yum.repos.d/ \
111     --upload ../opnfv-puppet-tripleo.tar.gz:/etc/puppet/modules \
112     --run-command "yum update -y python-ipaddress rabbitmq-server erlang*" \
113     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
114     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
115     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
116     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf opnfv-puppet-tripleo.tar.gz" \
117     --run-command "echo 'nf_conntrack_proto_sctp' > /etc/modules-load.d/nf_conntrack_proto_sctp.conf" \
118     --run-command "mkdir /root/dpdk_rpms" \
119     --run-command "mkdir /root/fdio" \
120     $dpdk_pkg_str \
121     $fdio_pkg_str \
122     --upload ../networking-vpp.noarch.rpm:/root/fdio \
123     --run-command "pip install distro flask_restful" \
124     --run-command "yum install -y etcd" \
125     --run-command "pip install python-etcd" \
126     --run-command "puppet module install cristifalcas/etcd" \
127     --run-command "yum update -y puppet" \
128     --install "centos-release-qemu-ev" \
129     --run-command "yum install -y qemu-kvm-ev-2.3.0-31.el7_2.21.1.x86_64" \
130     --run-command "yum remove -y qemu-system-x86" \
131     --upload ../os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
132     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf os-net-config.tar.gz" \
133     --upload ../noarch/openstack-congress-2016.1-1.el7.centos.noarch.rpm:/root/ \
134     --install /root/openstack-congress-2016.1-1.el7.centos.noarch.rpm \
135     --install "python2-congressclient" \
136     --upload puppet-congress.tar.gz:/etc/puppet/modules/ \
137     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-congress.tar.gz" \
138     --run-command "cd /usr/lib/python2.7/site-packages/congress/datasources && curl -O $doctor_driver" \
139     --run-command "yum install -y /root/fdio/*.rpm" \
140     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
141     --install unzip \
142     --upload puppet-fdio.tar.gz:/etc/puppet/modules \
143     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
144     --upload vsperf.tar.gz:/var/opt \
145     --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \
146     --upload ../noarch/python-tackerclient-2015.2-1.trozet.noarch.rpm:/root/ \
147     --install /root/python-tackerclient-2015.2-1.trozet.noarch.rpm \
148     --upload ../noarch/openstack-tacker-2015.2-1.trozet.noarch.rpm:/root/ \
149     --install /root/openstack-tacker-2015.2-1.trozet.noarch.rpm \
150     --upload puppet-tacker.tar.gz:/etc/puppet/modules/ \
151     --run-command "cd /etc/puppet/modules/ && tar xzf puppet-tacker.tar.gz" \
152     --run-command "pip install python-senlinclient" \
153     --upload ../neutron/agent/interface/interface.py:/usr/lib/python2.7/site-packages/neutron/agent/linux/ \
154     --run-command "mkdir /root/fdio_neutron_l3" \
155     --upload ../neutron/agent/l3/namespaces.py:/root/fdio_neutron_l3/ \
156     --upload ../neutron/agent/l3/router_info.py:/root/fdio_neutron_l3/ \
157     --upload ../puppet-neutron/manifests/agents/ml2/networking-vpp.pp:/etc/puppet/modules/neutron/manifests/agents/ml2/ \
158     --upload ../puppet-neutron/manifests/plugins/ml2/networking-vpp.pp:/etc/puppet/modules/neutron/manifests/plugins/ml2/ \
159     --upload ../puppet-neutron/lib/puppet/type/neutron_agent_vpp.rb:/etc/puppet/modules/neutron/lib/puppet/type/ \
160     --mkdir /etc/puppet/modules/neutron/lib/puppet/provider/neutron_agent_vpp \
161     --upload ../puppet-neutron/lib/puppet/provider/neutron_agent_vpp/ini_setting.rb:/etc/puppet/modules/neutron/lib/puppet/provider/neutron_agent_vpp/ \
162     --upload ../os-client-config/config.py:/usr/lib/python2.7/site-packages/os_client_config/ \
163     -a overcloud-full_build.qcow2
164
165 rm -rf ovs_nsh_patches
166 rm -rf ovs
167 git clone https://github.com/yyang13/ovs_nsh_patches.git
168 git clone https://github.com/openvswitch/ovs.git
169 pushd ovs > /dev/null
170 git reset --hard 7d433ae57ebb90cd68e8fa948a096f619ac4e2d8
171 cp ../ovs_nsh_patches/*.patch ./
172 # Hack for build servers that have no git config
173 git config user.email "apex@opnfv.com"
174 git config user.name "apex"
175 git am *.patch
176 popd > /dev/null
177 tar czf ovs.tar.gz ovs
178
179 # Required packages to redirect stdin with virt-customize
180 virt_pkg_str="./$libguestfs_pkg "
181 wget $virt_uri_base/$libguestfs_pkg
182 for package in ${virt_pkgs[@]}; do
183   wget "$virt_uri_base/$package"
184   virt_pkg_str+=" ./$package"
185 done
186
187 if ! sudo yum -y install ${virt_pkg_str}; then
188   if [ "$(rpm -q libguestfs)" != "$(rpm -qpf $libguestfs_pkg)" ]; then
189     echo "ERROR: Failed to update libguestfs"
190     exit 1
191   fi
192 fi
193
194
195
196 # BUILD NSH OVS
197 LIBGUESTFS_BACKEND=direct virt-customize \
198     --upload ../build_ovs_nsh.sh:/root/ \
199     --upload ovs.tar.gz:/root/ \
200     --run-command "cd /root/ && tar xzf ovs.tar.gz" \
201     --run-command "cd /root/ovs && /root/build_ovs_nsh.sh" \
202     -a overcloud-full_build.qcow2
203
204 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
205 popd > /dev/null