Fixes nova migration
[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     -a overcloud-full_build.qcow2
77
78 # apply neutron port data plane status patches
79 # https://specs.openstack.org/openstack/neutron-specs/specs/backlog/ocata/port-data-plane-status.html
80 # apply congress parallel execution patch
81 # Requirements from Doctor project
82 # TODO(cgoncalves): code merged in Pike dev cycle. drop from >= OpenStack Pike / > OPNFV Euphrates
83 LIBGUESTFS_BACKEND=direct virt-customize \
84     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_lib_dps.patch " \
85     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_server_dps.patch" \
86     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_openstacksdk_dps.patch" \
87     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < neutron_openstackclient_dps.patch" \
88     --run-command "cd /usr/share/openstack-puppet/modules/neutron && patch -p1 < puppet-neutron-add-sfc.patch" \
89     --run-command "cd /usr/lib/python2.7/site-packages/ && patch -p1 < congress-parallel-execution.patch" \
90     -a overcloud-full_build.qcow2
91
92 # Arch dependent on x86
93 if [ "$(uname -i)" == 'x86_64' ]; then
94 dpdk_pkg_str=''
95 for package in ${dpdk_rpms[@]}; do
96   wget "$dpdk_uri_base/$package"
97   dpdk_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/dpdk_rpms"
98 done
99
100 # tar up the fd.io module
101 rm -rf puppet-fdio
102 git clone https://git.fd.io/puppet-fdio
103 pushd puppet-fdio > /dev/null
104 git archive --format=tar.gz --prefix=fdio/ HEAD > ${BUILD_DIR}/puppet-fdio.tar.gz
105 popd > /dev/null
106
107 # Master FD.IO Repo
108 cat > ${BUILD_DIR}/fdio.repo << EOF
109 [fdio-master]
110 name=fd.io master branch latest merge
111 baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/
112 enabled=1
113 gpgcheck=0
114 EOF
115
116 # Kubernetes Repo
117 cat > ${BUILD_DIR}/kubernetes.repo << EOF
118 [kubernetes]
119 name=Kubernetes
120 baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
121 enabled=1
122 gpgcheck=1
123 repo_gpgcheck=1
124 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
125         https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
126 EOF
127
128 # Get Real Time Kernel from kvm4nfv
129 populate_cache $kvmfornfv_uri_base/$kvmfornfv_kernel_rpm
130
131 # upload dpdk rpms but do not install
132 # install fd.io yum repo and packages
133 # upload puppet fdio
134 # git clone vsperf into the overcloud image
135 # upload the rt_kvm kernel
136 LIBGUESTFS_BACKEND=direct virt-customize \
137     --run-command "mkdir /root/dpdk_rpms" \
138     $dpdk_pkg_str \
139     --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \
140     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
141     --upload ${BUILD_DIR}/fdio.repo:/etc/yum.repos.d/ \
142     --upload ${BUILD_DIR}/kubernetes.repo:/etc/yum.repos.d/ \
143     --run-command "mkdir /root/fdio" \
144     --upload ${BUILD_DIR}/noarch/$netvpp_pkg:/root/fdio \
145     --install honeycomb \
146     --install vpp-plugins,vpp,vpp-lib,vpp-api-python \
147     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
148     --run-command "yum install -y /root/fdio/*.rpm" \
149     --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" \
150     --run-command "mkdir /root/ovs28" \
151     --run-command "yumdownloader --destdir=/root/ovs28 openvswitch*2.8* python-openvswitch-2.8*" \
152     --upload ${CACHE_DIR}/$kvmfornfv_kernel_rpm:/root/ \
153     --install python2-networking-sfc \
154     --install python-etcd,puppet-etcd \
155     --install patch \
156     --install docker,kubelet,kubeadm,kubectl,kubernetes-cni \
157     -a overcloud-full_build.qcow2
158
159     # upload and install barometer packages
160     barometer_pkgs overcloud-full_build.qcow2
161
162 fi # end x86_64 specific items
163
164 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
165 popd > /dev/null