Merge "Install honeycomb and vpp in a single step"
[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
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
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 # Master FD.IO Repo
110 cat > ${BUILD_DIR}/fdio.repo << EOF
111 [fdio-master]
112 name=fd.io master branch latest merge
113 baseurl=https://nexus.fd.io/content/repositories/fd.io.master.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 # Kubernetes Repo
125 cat > ${BUILD_DIR}/kubernetes.repo << EOF
126 [kubernetes]
127 name=Kubernetes
128 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
129 enabled=1
130 gpgcheck=1
131 repo_gpgcheck=1
132 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
133         https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
134 EOF
135
136 # Get Real Time Kernel from kvm4nfv
137 populate_cache $kvmfornfv_uri_base/$kvmfornfv_kernel_rpm
138
139 # upload dpdk rpms but do not install
140 # install fd.io yum repo and packages
141 # upload puppet fdio
142 # git clone vsperf into the overcloud image
143 # upload the rt_kvm kernel
144 LIBGUESTFS_BACKEND=direct virt-customize \
145     --run-command "mkdir /root/dpdk_rpms" \
146     $dpdk_pkg_str \
147     --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \
148     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
149     --upload ${BUILD_DIR}/fdio.repo:/etc/yum.repos.d/ \
150     --run-command "mkdir /root/nosdn_vpp_rpms" \
151     $vpp_nosdn_pkg_str \
152     --upload ${BUILD_DIR}/kubernetes.repo:/etc/yum.repos.d/ \
153     --run-command "mkdir /root/fdio" \
154     --upload ${BUILD_DIR}/noarch/$netvpp_pkg:/root/nosdn_vpp_rpms \
155     --install honeycomb,vpp-plugins,vpp,vpp-lib,vpp-api-python \
156     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
157     --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" \
158     --run-command "mkdir /root/ovs28" \
159     --run-command "yumdownloader --destdir=/root/ovs28 openvswitch*2.8* python-openvswitch-2.8*" \
160     --upload ${CACHE_DIR}/$kvmfornfv_kernel_rpm:/root/ \
161     --install "http://mirror.centos.org/centos/7/cloud/x86_64/openstack-ocata/python2-networking-sfc-4.0.0-1.el7.noarch.rpm" \
162     --install python-etcd,puppet-etcd \
163     --install patch \
164     --install docker,kubelet,kubeadm,kubectl,kubernetes-cni \
165     -a overcloud-full_build.qcow2
166
167     # upload and install barometer packages
168     barometer_pkgs overcloud-full_build.qcow2
169
170 fi # end x86_64 specific items
171
172 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
173 popd > /dev/null