Moving to forks on gerrit.opnfv.org
[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
14 populate_cache "$rdo_images_uri/overcloud-full.tar"
15
16 if [ ! -d ${BUILD_DIR} ]; then mkdir ${BUILD_DIR}; fi
17 tar -xf ${CACHE_DIR}/overcloud-full.tar -C ${BUILD_DIR}/
18 mv -f ${BUILD_DIR}/overcloud-full.qcow2 ${BUILD_DIR}/overcloud-full_build.qcow2
19
20 ##########################################################
21 #####  Prep initial overcloud image with common deps #####
22 ##########################################################
23
24 pushd ${BUILD_DIR} > /dev/null
25
26 # prep opnfv-puppet-tripleo for undercloud
27 python3 -B $BUILD_UTILS clone-fork -r apex-puppet-tripleo
28 pushd apex-puppet-tripleo > /dev/null
29 git archive --format=tar.gz --prefix=tripleo/ HEAD > ${BUILD_DIR}/apex-puppet-tripleo.tar.gz
30 popd > /dev/null
31
32 # download customized os-net-config
33 python3 -B $BUILD_UTILS clone-fork -r apex-os-net-config
34 pushd apex-os-net-config/os_net_config > /dev/null
35 git archive --format=tar.gz --prefix=os_net_config/ HEAD > ${BUILD_DIR}/apex-os-net-config.tar.gz
36 popd > /dev/null
37
38 dpdk_pkg_str=''
39 for package in ${dpdk_rpms[@]}; do
40   wget "$dpdk_uri_base/$package"
41   dpdk_pkg_str+=" --upload ${BUILD_DIR}/${package}:/root/dpdk_rpms"
42 done
43
44 # tar up the fd.io module
45 rm -rf puppet-fdio
46 git clone https://git.fd.io/puppet-fdio
47 pushd puppet-fdio > /dev/null
48 git archive --format=tar.gz --prefix=fdio/ HEAD > ${BUILD_DIR}/puppet-fdio.tar.gz
49 popd > /dev/null
50
51 # tar up vsperf
52 rm -rf vsperf vsperf.tar.gz
53 git clone https://gerrit.opnfv.org/gerrit/vswitchperf vsperf
54 tar czf vsperf.tar.gz vsperf
55
56 # Master FD.IO Repo
57 cat > ${BUILD_DIR}/fdio.repo << EOF
58 [fdio-master]
59 name=fd.io master branch latest merge
60 baseurl=https://nexus.fd.io/content/repositories/fd.io.master.centos7/
61 enabled=1
62 gpgcheck=0
63 EOF
64
65 # Get Real Time Kernel from kvm4nfv
66 populate_cache $kvmfornfv_uri_base/$kvmfornfv_kernel_rpm
67
68 # packages frozen for fdio scenarios
69 fdio_pkg_str=''
70 for package in ${fdio_pkgs[@]}; do
71   wget "$package"
72   fdio_pkg_str+=" --upload ${BUILD_DIR}/${package##*/}:/root/fdio/"
73 done
74
75 # Increase disk size by 900MB to accommodate more packages
76 qemu-img resize overcloud-full_build.qcow2 +900MB
77
78 # expand file system to max disk size
79 # installing forked apex-puppet-tripleo
80 # upload dpdk rpms but do not install
81 # install fd.io yum repo and packages
82 # upload puppet fdio
83 # git clone vsperf into the overcloud image
84 # upload the rt_kvm kernel
85 LIBGUESTFS_BACKEND=direct virt-customize \
86     --run-command "xfs_growfs /dev/sda" \
87     --upload ${BUILD_DIR}/apex-puppet-tripleo.tar.gz:/etc/puppet/modules \
88     --run-command "cd /etc/puppet/modules && rm -rf tripleo && tar xzf apex-puppet-tripleo.tar.gz" \
89     --upload ${BUILD_DIR}/apex-os-net-config.tar.gz:/usr/lib/python2.7/site-packages \
90     --run-command "cd /usr/lib/python2.7/site-packages/ && rm -rf os_net_config && tar xzf apex-os-net-config.tar.gz" \
91     --run-command "if ! rpm -qa | grep python-redis; then yum install -y python-redis; fi" \
92     --run-command "sed -i 's/^#UseDNS.*$/UseDNS no/' /etc/ssh/sshd_config" \
93     --run-command "sed -i 's/^GSSAPIAuthentication.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config" \
94     --run-command "mkdir /root/dpdk_rpms" \
95     $dpdk_pkg_str \
96     --run-command "mkdir /root/fdio" \
97     --upload ${BUILD_DIR}/noarch/$netvpp_pkg:/root/fdio \
98     $fdio_pkg_str \
99     --run-command "yum install -y /root/fdio/*.rpm" \
100     --run-command "yum install -y etcd" \
101     --install python-etcd \
102     --run-command "puppet module install cristifalcas/etcd" \
103     --run-command "rm -f /etc/sysctl.d/80-vpp.conf" \
104     --install unzip \
105     --upload ${BUILD_DIR}/puppet-fdio.tar.gz:/etc/puppet/modules \
106     --run-command "cd /etc/puppet/modules && tar xzf puppet-fdio.tar.gz" \
107     --upload ${BUILD_DIR}/vsperf.tar.gz:/var/opt \
108     --run-command "cd /var/opt && tar xzf vsperf.tar.gz" \
109     --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" \
110     --run-command "mkdir /root/ovs27" \
111     --run-command "yumdownloader --destdir=/root/ovs27 openvswitch*2.7* python-openvswitch-2.7*" \
112     --run-command "sed -i -E 's/timeout=[0-9]+/timeout=60/g' /usr/share/openstack-puppet/modules/rabbitmq/lib/puppet/provider/rabbitmqctl.rb" \
113     --upload ${CACHE_DIR}/$kvmfornfv_kernel_rpm:/root/ \
114     --install python2-networking-sfc \
115     -a overcloud-full_build.qcow2
116
117 mv -f overcloud-full_build.qcow2 overcloud-full.qcow2
118 popd > /dev/null