ea04f401bc19c344ca7b79e1252b297c1eb751d4
[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 ./barometer-install.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 python3 -B $BUILD_UTILS clone-fork -r apex-puppet-tripleo -b stable/euphrates
29 pushd apex-puppet-tripleo > /dev/null
30 git archive --format=tar.gz --prefix=tripleo/ HEAD > ${BUILD_DIR}/apex-puppet-tripleo.tar.gz
31 popd > /dev/null
32
33 # download customized os-net-config
34 python3 -B $BUILD_UTILS clone-fork -r apex-os-net-config -b stable/euphrates
35 pushd apex-os-net-config/os_net_config > /dev/null
36 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ${BUILD_DIR}/apex-os-net-config.tar.gz
37 popd > /dev/null
38
39 # tar up vsperf
40 rm -rf vsperf vsperf.tar.gz
41 git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf
42 tar czf vsperf.tar.gz vsperf
43
44 # Increase disk size by 1500MB to accommodate more packages
45 qemu-img resize overcloud-full_build.qcow2 +1500M
46
47 # expand file system to max disk size
48 # installing forked apex-puppet-tripleo
49 # upload neutron port data plane status
50 # REMOVE Tacker VNFFG patch when moving to Pike
51 LIBGUESTFS_BACKEND=direct $VIRT_CUSTOMIZE \
52     --run-command "xfs_growfs /dev/sda" \
53     --upload ${BUILD_DIR}/apex-puppet-tripleo.tar.gz:/etc/puppet/modules \
54     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf apex-puppet-tripleo.tar.gz" \
55     --upload ${BUILD_DIR}/apex-os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
56     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf apex-os-net-config.tar.gz" \
57     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
58     --install epel-release \
59     --install unzip \
60     --upload ${BUILD_DIR}/vsperf.tar.gz:/var/opt \
61     --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \
62     --run-command "sed -i -E 's/timeout=[0-9]+/timeout=60/g' /usr/share/openstack-puppet/modules/rabbitmq/lib/puppet/provider/rabbitmqctl.rb" \
63     --install patch \
64     --upload ${BUILD_ROOT}/patches/neutron_lib_dps.patch:/usr/lib/python2.7/site-packages/ \
65     --upload ${BUILD_ROOT}/patches/neutron_server_dps.patch:/usr/lib/python2.7/site-packages/ \
66     --upload ${BUILD_ROOT}/patches/neutron_openstacksdk_dps.patch:/usr/lib/python2.7/site-packages/ \
67     --upload ${BUILD_ROOT}/patches/neutron_openstackclient_dps.patch:/usr/lib/python2.7/site-packages/ \
68     --upload ${BUILD_ROOT}/patches/puppet-neutron-add-sfc.patch:/usr/share/openstack-puppet/modules/neutron/ \
69     --upload ${BUILD_ROOT}/patches/congress-parallel-execution.patch:/usr/lib/python2.7/site-packages/ \
70     --upload ${BUILD_ROOT}/patches/puppet-neutron-ml2-ip-version-fix.patch:/usr/share/openstack-puppet/modules/neutron/ \
71     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 < puppet-neutron-ml2-ip-version-fix.patch" \
72     --upload ${BUILD_ROOT}/patches/puppet-neutron-vpp-ml2-type_drivers-setting.patch:/usr/share/openstack-puppet/modules/neutron/ \
73     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 < puppet-neutron-vpp-ml2-type_drivers-setting.patch" \
74     --upload ${BUILD_ROOT}/patches/tacker-vnffg-input-params.patch:/usr/lib/python2.7/site-packages/ \
75     --run-command "cd usr/lib/python2.7/site-packages/ && patch -p1 < tacker-vnffg-input-params.patch" \
76     --upload ${BUILD_ROOT}/patches/puppet-neutron-add-external_network_bridge-option.patch:/usr/share/openstack-puppet/modules/neutron/ \
77     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 < puppet-neutron-add-external_network_bridge-option.patch" \
78     -a overcloud-full_build.qcow2
79
80 # apply neutron port data plane status patches
81 # https://specs.openstack.org/openstack/neutron-specs/specs/backlog/ocata/port-data-plane-status.html
82 # apply congress parallel execution patch
83 # Requirements from Doctor project
84 # TODO(cgoncalves): code merged in Pike dev cycle. drop from >= OpenStack Pike / > OPNFV Euphrates
85 LIBGUESTFS_BACKEND=direct $VIRT_CUSTOMIZE \
86     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_lib_dps.patch " \
87     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_server_dps.patch" \
88     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_openstacksdk_dps.patch" \
89     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_openstackclient_dps.patch" \
90     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 < puppet-neutron-add-sfc.patch" \
91     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < congress-parallel-execution.patch" \
92     -a overcloud-full_build.qcow2
93
94 # Arch dependent on x86
95 if [ "$(uname -i)" == 'x86_64' ]; then
96 dpdk_pkg_str=''
97 for package in ${dpdk_rpms[@]}; do
98   wget "$dpdk_uri_base/$package"
99   dpdk_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/dpdk_rpms"
100 done
101
102 # tar up the fd.io module
103 rm -rf puppet-fdio
104 git clone https://git.fd.io/puppet-fdio
105 pushd puppet-fdio > /dev/null
106 git archive --format=tar.gz --prefix=fdio/ HEAD > ${BUILD_DIR}/puppet-fdio.tar.gz
107 popd > /dev/null
108
109 # FD.IO Repo
110 cat > ${BUILD_DIR}/fdio.repo << EOF
111 [fdio-1710]
112 name=fd.io packages
113 baseurl=https://nexus.fd.io/content/repositories/fd.io.stable.1710.centos7/
114 enabled=1
115 gpgcheck=0
116 EOF
117
118 vpp_nosdn_pkg_str=''
119 for package in ${nosdn_vpp_rpms[@]}; do
120   wget $package
121   vpp_nosdn_pkg_str+=" --upload ${BUILD_DIR}/${package##*/}:/root/nosdn_vpp_rpms"
122 done
123
124 # Get Real Time Kernel from kvm4nfv
125 populate_cache $kvmfornfv_uri_base/$kvmfornfv_kernel_rpm
126
127 # upload dpdk rpms but do not install
128 # install fd.io yum repo and packages
129 # upload puppet fdio
130 # git clone vsperf into the overcloud image
131 # upload the rt_kvm kernel
132 LIBGUESTFS_BACKEND=direct $VIRT_CUSTOMIZE \
133     --run-command "mkdir /root/dpdk_rpms" \
134     $dpdk_pkg_str \
135     --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \
136     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
137     --upload ${BUILD_DIR}/fdio.repo:/etc/yum.repos.d/ \
138     --run-command "mkdir /root/nosdn_vpp_rpms" \
139     $vpp_nosdn_pkg_str \
140     --run-command "mkdir /root/fdio" \
141     --upload ${BUILD_DIR}/noarch/$netvpp_pkg:/root/nosdn_vpp_rpms \
142     --install honeycomb,vpp-plugins,vpp,vpp-lib,vpp-api-python \
143     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
144     --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" \
145     --run-command "mkdir /root/ovs28" \
146     --run-command "yumdownloader --destdir=/root/ovs28 openvswitch*2.8* python-openvswitch-2.8*" \
147     --upload ${CACHE_DIR}/$kvmfornfv_kernel_rpm:/root/ \
148     --install "http://mirror.centos.org/centos/7/cloud/x86_64/openstack-ocata/python2-networking-sfc-4.0.0-1.el7.noarch.rpm" \
149     --install python-etcd,puppet-etcd \
150     --install patch \
151     -a overcloud-full_build.qcow2
152
153     # upload and install barometer packages
154     barometer_pkgs overcloud-full_build.qcow2
155
156     # Build OVS with NSH
157     rm -rf ovs_nsh_patches
158     rm -rf ovs
159     git clone https://github.com/yyang13/ovs_nsh_patches.git
160     git clone https://github.com/openvswitch/ovs.git
161     pushd ovs > /dev/null
162     git checkout v2.6.1
163     cp ../ovs_nsh_patches/v2.6.1_centos7/*.patch ./
164     rm -f ./0002-datapath-compat-Fix-build-on-RHEL-7.4.patch
165     # Hack for build servers that have no git config
166     git config user.email "apex@opnfv.com"
167     git config user.name "apex"
168     git am *.patch
169     popd > /dev/null
170     tar czf ovs.tar.gz ovs
171
172
173 LIBGUESTFS_BACKEND=direct $VIRT_CUSTOMIZE \
174     --upload ${BUILD_ROOT}/CentOS-Updates.repo:/etc/yum.repos.d/ \
175     --run-command "yum -y install kernel-devel-\$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' kernel)" \
176     --run-command "yum -y install kernel-headers-\$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' kernel)" \
177     --run-command "yum -y install kernel-tools-\$(rpm -q --queryformat '%{VERSION}-%{RELEASE}' kernel)" \
178     --upload ${BUILD_ROOT}/build_ovs_nsh.sh:/root/ \
179     --upload ovs.tar.gz:/root/ \
180     --run-command "cd /root/ && tar xzf ovs.tar.gz" \
181     --run-command "cd /root/ovs && /root/build_ovs_nsh.sh" \
182     -a overcloud-full_build.qcow2
183
184 fi # end x86_64 specific items
185
186 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
187 popd > /dev/null