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